nvim-treesitter/queries/inko/highlights.scm
Yorick Peterse 4ae2b452e9
fix(inko): highlighting of numeric call names (#6566)
Inko allows for syntax such as `some_value.42.to_string`, where `42` is
a method name. Similar to other languages that allow this (e.g. Rust),
these numeric names should be highlighted as numbers instead of
identifiers.

To fix this, the query to highlight call names is adjusted to only
highlight "name" and "constant" nodes as the function group, ensuring
the remaining possible node ("integer") continues to use the same group
as regular numbers.
2024-05-03 13:06:54 -07:00

198 lines
1.9 KiB
Scheme

; Brackets and operators
[
"("
")"
"["
"]"
"{"
"}"
] @punctuation.bracket
[
","
"->"
"."
":"
] @punctuation.delimiter
[
"!="
"%"
"%="
"&"
"&="
"*"
"**"
"**="
"*="
"+"
"+="
"-"
"-="
"/"
"/="
"<"
"<<"
"<<="
"<="
"<="
"=="
">"
">="
">="
">>"
">>="
">>>"
">>>="
"^"
"^="
"|"
"|="
] @operator
; Keywords
[
"as"
"for"
"impl"
"let"
"mut"
"ref"
"uni"
"move"
"recover"
] @keyword
"fn" @keyword.function
"import" @keyword.import
[
"and"
"or"
] @keyword.operator
[
"class"
"trait"
] @keyword.type
[
"extern"
(modifier)
(visibility)
] @keyword.modifier
[
"loop"
"while"
(break)
(next)
] @keyword.repeat
"return" @keyword.return
[
"throw"
"try"
] @keyword.exception
[
"case"
"else"
"if"
"match"
] @keyword.conditional
; Identifiers/variable references
(identifier) @variable
; Comments
(line_comment) @comment @spell
; Literals
(self) @variable.builtin
(nil) @constant.builtin
[
(true)
(false)
] @boolean
(integer) @number
(float) @number.float
(string) @string
(escape_sequence) @string.escape
(interpolation
"${" @punctuation.special
"}" @punctuation.special) @none
(constant) @constant
; Patterns
(integer_pattern) @number
(string_pattern) @string
(constant_pattern) @constant
; Types
(generic_type
name: _ @type)
(type) @type
; Imports
(extern_import
path: _ @string)
(import
(path
(identifier) @module))
; Classes
(class
name: _ @type)
(define_field
name: _ @variable.member)
; Traits
(trait
name: _ @type)
; Implementations
(implement_trait
class: _ @type)
(reopen_class
name: _ @type)
(bound
name: _ @type)
; Methods
(method
name: _ @function)
(external_function
name: _ @function)
(argument
name: _ @variable.parameter)
(named_argument
name: _ @variable.parameter)
(call
name: [
(name)
(constant)
] @function)
(field) @variable.member