Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'runtime/queries/kotlin/highlights.scm')
| -rw-r--r-- | runtime/queries/kotlin/highlights.scm | 72 |
1 files changed, 39 insertions, 33 deletions
diff --git a/runtime/queries/kotlin/highlights.scm b/runtime/queries/kotlin/highlights.scm index 68b08c3d..208a673f 100644 --- a/runtime/queries/kotlin/highlights.scm +++ b/runtime/queries/kotlin/highlights.scm @@ -1,20 +1,21 @@ -;;; Identifiers -(simple_identifier) @variable - -; `field` keyword inside property getter/setter -; FIXME: This will highlight the keyword outside of getters and setters -; since tree-sitter does not allow us to check for arbitrary nestation -((simple_identifier) @variable.builtin -(#eq? @variable.builtin "field")) - -; `it` keyword inside lambdas -; FIXME: This will highlight the keyword outside of lambdas since tree-sitter -; does not allow us to check for arbitrary nestation -((simple_identifier) @variable.builtin -(#eq? @variable.builtin "it")) +;;; Operators & Punctuation +(multi_line_string_literal + "$" @punctuation + (interpolated_identifier) @none) +(multi_line_string_literal + "${" @punctuation + (interpolated_expression) @none + "}" @punctuation.) -;;; Operators & Punctuation +; NOTE: `interpolated_identifier`s can be highlighted in any way +(line_string_literal + "$" @punctuation + (interpolated_identifier) @none) +(line_string_literal + "${" @punctuation + (interpolated_expression) @none + "}" @punctuation) [ "." @@ -68,14 +69,6 @@ "->" ] @operator -(string_literal - "$" @punctuation - (interpolated_identifier) @none) -(string_literal - "${" @punctuation - (interpolated_expression) @none - "}" @punctuation) - ;;; Keywords (type_alias "typealias" @keyword) @@ -99,7 +92,6 @@ "class" "object" "interface" - "companion" ; "typeof" ; NOTE: It is reserved for future use ] @keyword @@ -148,14 +140,17 @@ ;;; Literals ; NOTE: Escapes not allowed in multi-line strings -(character_literal (character_escape_seq) @constant.character.escape) +(line_string_literal (character_escape_seq) @constant.character.escape) -(string_literal) @string +[ + (line_string_literal) + (multi_line_string_literal) +] @string (character_literal) @constant.character [ - (null_literal) ; should be highlighted the same as booleans + "null" ; should be highlighted the same as booleans (boolean_literal) ] @constant.builtin.boolean @@ -169,8 +164,7 @@ ] @constant.numeric.integer [ - (line_comment) - (multiline_comment) + (comment) (shebang_line) ] @comment @@ -250,10 +244,7 @@ . (identifier)) @namespace ((type_identifier) @type.builtin - (#match? @type.builtin "^(Byte|Short|Int|Long|UByte|UShort|UInt|ULong|Float|Double|Boolean|Char|String|Array|ByteArray|ShortArray|IntArray|LongArray|UByteArray|UShortArray|UIntArray|ULongArray|FloatArray|DoubleArray|BooleanArray|CharArray|Map|Set|List|EmptyMap|EmptySet|EmptyList|MutableMap|MutableSet|MutableList)$")) - -(type_parameter - (type_identifier) @type.parameter) + (#match? @function.builtin "^(Byte|Short|Int|Long|UByte|UShort|UInt|ULong|Float|Double|Boolean|Char|String|Array|ByteArray|ShortArray|IntArray|LongArray|UByteArray|UShortArray|UIntArray|ULongArray|FloatArray|DoubleArray|BooleanArray|CharArray|Map|Set|List|EmptyMap|EmptySet|EmptyList|MutableMap|MutableSet|MutableList)$")) (type_identifier) @type @@ -287,3 +278,18 @@ ; `this` this keyword inside classes (this_expression) @variable.builtin + +;;; Identifiers +; `field` keyword inside property getter/setter +; FIXME: This will highlight the keyword outside of getters and setters +; since tree-sitter does not allow us to check for arbitrary nestation +((simple_identifier) @variable.builtin +(#eq? @variable.builtin "field")) + +; `it` keyword inside lambdas +; FIXME: This will highlight the keyword outside of lambdas since tree-sitter +; does not allow us to check for arbitrary nestation +((simple_identifier) @variable.builtin +(#eq? @variable.builtin "it")) + +(simple_identifier) @variable |