nvim-treesitter/queries/vala/highlights.scm

347 lines
4.6 KiB
Scheme
Raw Normal View History

; highlights.scm
2023-02-23 20:30:36 +01:00
; highlight comments and symbols
(comment) @comment @spell
2024-01-06 15:05:50 +09:00
((comment) @comment.documentation
(#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$"))
2024-01-06 15:05:50 +09:00
feat!: align standard captures with upstream Problem: Sharing highlight queries with upstream tree-sitter and Helix is difficult. Solution: Where reasonable, use capture names in tree-sitter's standard list or Helix's Atom-style hierarchy. Specifically: * tree-sitter "standard capture names" (https://github.com/tree-sitter/tree-sitter/blob/3f44b896852eb7daaa6df4fb778c9bb52c70c815/highlight/src/lib.rs#L20-L72): - `@parameter` -> `@variable.parameter` - `@field` -> `@variable.member` - `@namespace` -> `@module` - `@float` -> `@number.float` - `@symbol` -> `@string.special.symbol` - `@string.regex` -> `@string.regexp` - `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below) - `@text.title` -> `@markup.heading` - `@text.literal` -> `@markup.raw` - `@text.reference` -> `@markup.link` - `@text.uri` -> `@markup.link.url` (in markup links) - `@string.special` -> `@markup.link.label` (non-url links) - `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`) * Helix captures (https://docs.helix-editor.com/master/themes.html#syntax-highlighting): - `@method` -> `@function.method` - `@method.call` -> `@function.method.call` - `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}` - `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}` - `@text.uri` -> `@string.special.url` (outside markup) - `@preproc` -> `@keyword.directive` - `@define` -> `@keyword.directive`(`.define`?) - `@storageclass` -> `@keyword.storage` - `@conditional` -> `@keyword.conditional` - `@debug` -> `@keyword.debug` - `@exception` -> `@keyword.exception` - `@include` -> `@keyword.import` - `@repeat` -> `@keyword.repeat` * cleanup - remove some redundant `@conceal` (but still allow it for conceal-only patterns) - remove obsolete `@error` (syntax linting is out of scope for this repo) - sort, cleanup capture list in `CONTRIBUTING.md`
2023-12-24 10:00:20 +01:00
(symbol) @string.special.symbol
2024-01-06 15:05:50 +09:00
(member_access_expression
(_)
(identifier) @string.special.symbol)
; highlight constants
2024-01-06 15:05:50 +09:00
((member_access_expression
(identifier) @constant)
(#lua-match? @constant "^[%u][%u%d_]*$"))
2024-01-06 15:05:50 +09:00
((member_access_expression
(member_access_expression) @keyword.import
(identifier) @constant)
(#lua-match? @constant "^[%u][%u%d_]*$"))
; highlight types and probable types
2024-01-06 15:05:50 +09:00
(type
(symbol
(_)? @module
(identifier) @type))
((member_access_expression
.
(identifier) @type)
(#match? @type "^[A-Z][A-Za-z_0-9]{2,}$"))
; highlight creation methods in object creation expressions
2024-01-06 15:05:50 +09:00
((object_creation_expression
(type
(symbol
(symbol
(symbol)? @keyword.import
(identifier) @type)
(identifier) @constructor)))
(#lua-match? @constructor "^[%l][%l%d_]*$"))
(unqualified_type
(symbol
.
(identifier) @type))
2024-01-06 15:05:50 +09:00
(unqualified_type
(symbol
(symbol) @module
(identifier) @type))
(attribute) @attribute
2024-01-06 15:05:50 +09:00
(namespace_declaration
(symbol) @module)
(method_declaration
(symbol
(symbol) @type
(identifier) @function))
(method_declaration
(symbol
(identifier) @function))
(local_declaration
(assignment
(identifier) @variable))
(local_function_declaration
(identifier) @function)
(destructor_declaration
(identifier) @function)
(creation_method_declaration
(symbol
(symbol) @type
(identifier) @constructor))
(creation_method_declaration
(symbol
(identifier) @constructor))
(constructor_declaration
(_)?
"construct" @keyword.function)
(enum_declaration
(symbol) @type)
(enum_value
(identifier) @constant)
(errordomain_declaration
(symbol) @type)
(errorcode
(identifier) @constant)
(constant_declaration
(identifier) @constant)
(method_call_expression
(member_access_expression
(identifier) @function))
; highlight macros
2024-01-06 15:05:50 +09:00
((method_call_expression
(member_access_expression
(identifier) @function.macro))
(#match? @function.macro "^assert[A-Za-z_0-9]*|error|info|debug|print|warning|warning_once$"))
(lambda_expression
(identifier) @variable.parameter)
(parameter
(identifier) @variable.parameter)
(property_declaration
(symbol
(identifier) @property))
(field_declaration
(identifier) @variable.member)
2022-01-28 19:13:39 -03:00
[
2024-01-06 15:05:50 +09:00
(this_access)
(base_access)
(value_access)
] @constant.builtin
2024-01-06 15:05:50 +09:00
(boolean) @boolean
2024-01-06 15:05:50 +09:00
(character) @character
2024-01-06 15:05:50 +09:00
2022-10-22 12:24:11 +03:00
(escape_sequence) @string.escape
2024-01-06 15:05:50 +09:00
(integer) @number
2024-01-06 15:05:50 +09:00
(null) @constant.builtin
2024-01-06 15:05:50 +09:00
feat!: align standard captures with upstream Problem: Sharing highlight queries with upstream tree-sitter and Helix is difficult. Solution: Where reasonable, use capture names in tree-sitter's standard list or Helix's Atom-style hierarchy. Specifically: * tree-sitter "standard capture names" (https://github.com/tree-sitter/tree-sitter/blob/3f44b896852eb7daaa6df4fb778c9bb52c70c815/highlight/src/lib.rs#L20-L72): - `@parameter` -> `@variable.parameter` - `@field` -> `@variable.member` - `@namespace` -> `@module` - `@float` -> `@number.float` - `@symbol` -> `@string.special.symbol` - `@string.regex` -> `@string.regexp` - `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below) - `@text.title` -> `@markup.heading` - `@text.literal` -> `@markup.raw` - `@text.reference` -> `@markup.link` - `@text.uri` -> `@markup.link.url` (in markup links) - `@string.special` -> `@markup.link.label` (non-url links) - `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`) * Helix captures (https://docs.helix-editor.com/master/themes.html#syntax-highlighting): - `@method` -> `@function.method` - `@method.call` -> `@function.method.call` - `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}` - `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}` - `@text.uri` -> `@string.special.url` (outside markup) - `@preproc` -> `@keyword.directive` - `@define` -> `@keyword.directive`(`.define`?) - `@storageclass` -> `@keyword.storage` - `@conditional` -> `@keyword.conditional` - `@debug` -> `@keyword.debug` - `@exception` -> `@keyword.exception` - `@include` -> `@keyword.import` - `@repeat` -> `@keyword.repeat` * cleanup - remove some redundant `@conceal` (but still allow it for conceal-only patterns) - remove obsolete `@error` (syntax linting is out of scope for this repo) - sort, cleanup capture list in `CONTRIBUTING.md`
2023-12-24 10:00:20 +01:00
(real) @number.float
2024-01-06 15:05:50 +09:00
feat!: align standard captures with upstream Problem: Sharing highlight queries with upstream tree-sitter and Helix is difficult. Solution: Where reasonable, use capture names in tree-sitter's standard list or Helix's Atom-style hierarchy. Specifically: * tree-sitter "standard capture names" (https://github.com/tree-sitter/tree-sitter/blob/3f44b896852eb7daaa6df4fb778c9bb52c70c815/highlight/src/lib.rs#L20-L72): - `@parameter` -> `@variable.parameter` - `@field` -> `@variable.member` - `@namespace` -> `@module` - `@float` -> `@number.float` - `@symbol` -> `@string.special.symbol` - `@string.regex` -> `@string.regexp` - `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below) - `@text.title` -> `@markup.heading` - `@text.literal` -> `@markup.raw` - `@text.reference` -> `@markup.link` - `@text.uri` -> `@markup.link.url` (in markup links) - `@string.special` -> `@markup.link.label` (non-url links) - `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`) * Helix captures (https://docs.helix-editor.com/master/themes.html#syntax-highlighting): - `@method` -> `@function.method` - `@method.call` -> `@function.method.call` - `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}` - `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}` - `@text.uri` -> `@string.special.url` (outside markup) - `@preproc` -> `@keyword.directive` - `@define` -> `@keyword.directive`(`.define`?) - `@storageclass` -> `@keyword.storage` - `@conditional` -> `@keyword.conditional` - `@debug` -> `@keyword.debug` - `@exception` -> `@keyword.exception` - `@include` -> `@keyword.import` - `@repeat` -> `@keyword.repeat` * cleanup - remove some redundant `@conceal` (but still allow it for conceal-only patterns) - remove obsolete `@error` (syntax linting is out of scope for this repo) - sort, cleanup capture list in `CONTRIBUTING.md`
2023-12-24 10:00:20 +01:00
(regex) @string.regexp
2024-01-06 15:05:50 +09:00
(string) @string
2024-01-06 15:05:50 +09:00
(string_formatter) @string.special
2024-01-06 15:05:50 +09:00
(template_string) @string
2024-01-06 15:05:50 +09:00
(template_string_expression) @string.special
2024-01-06 15:05:50 +09:00
(verbatim_string) @string
2024-01-06 15:05:50 +09:00
[
2024-01-06 15:05:50 +09:00
"var"
"void"
] @type.builtin
(if_directive
2024-01-06 15:05:50 +09:00
expression: (_) @keyword.directive) @keyword
(elif_directive
2024-01-06 15:05:50 +09:00
expression: (_) @keyword.directive) @keyword
(else_directive) @keyword
2024-01-06 15:05:50 +09:00
(endif_directive) @keyword
2022-01-28 19:13:39 -03:00
[
2024-01-06 15:05:50 +09:00
"abstract"
"construct"
"continue"
"default"
"errordomain"
"get"
"inline"
"new"
"out"
"override"
"partial"
"ref"
"set"
"signal"
"virtual"
"with"
] @keyword
2022-01-28 19:13:39 -03:00
2024-04-23 12:23:15 -07:00
[
"enum"
"class"
"struct"
"interface"
"namespace"
] @keyword.type
"delegate" @keyword.function
[
"async"
"yield"
] @keyword.coroutine
[
2024-01-06 15:05:50 +09:00
"const"
"dynamic"
"owned"
"weak"
"unowned"
] @keyword.modifier
2022-01-29 11:18:26 -03:00
[
2024-01-06 15:05:50 +09:00
"case"
"else"
"if"
"switch"
feat!: align standard captures with upstream Problem: Sharing highlight queries with upstream tree-sitter and Helix is difficult. Solution: Where reasonable, use capture names in tree-sitter's standard list or Helix's Atom-style hierarchy. Specifically: * tree-sitter "standard capture names" (https://github.com/tree-sitter/tree-sitter/blob/3f44b896852eb7daaa6df4fb778c9bb52c70c815/highlight/src/lib.rs#L20-L72): - `@parameter` -> `@variable.parameter` - `@field` -> `@variable.member` - `@namespace` -> `@module` - `@float` -> `@number.float` - `@symbol` -> `@string.special.symbol` - `@string.regex` -> `@string.regexp` - `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below) - `@text.title` -> `@markup.heading` - `@text.literal` -> `@markup.raw` - `@text.reference` -> `@markup.link` - `@text.uri` -> `@markup.link.url` (in markup links) - `@string.special` -> `@markup.link.label` (non-url links) - `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`) * Helix captures (https://docs.helix-editor.com/master/themes.html#syntax-highlighting): - `@method` -> `@function.method` - `@method.call` -> `@function.method.call` - `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}` - `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}` - `@text.uri` -> `@string.special.url` (outside markup) - `@preproc` -> `@keyword.directive` - `@define` -> `@keyword.directive`(`.define`?) - `@storageclass` -> `@keyword.storage` - `@conditional` -> `@keyword.conditional` - `@debug` -> `@keyword.debug` - `@exception` -> `@keyword.exception` - `@include` -> `@keyword.import` - `@repeat` -> `@keyword.repeat` * cleanup - remove some redundant `@conceal` (but still allow it for conceal-only patterns) - remove obsolete `@error` (syntax linting is out of scope for this repo) - sort, cleanup capture list in `CONTRIBUTING.md`
2023-12-24 10:00:20 +01:00
] @keyword.conditional
2022-01-29 11:18:26 -03:00
; specially highlight break statements in switch sections
2024-01-06 15:05:50 +09:00
(switch_section
(break_statement
"break" @keyword.conditional))
2022-01-29 14:21:10 -03:00
[
2024-01-06 15:05:50 +09:00
"extern"
"internal"
"private"
"protected"
"public"
"static"
] @keyword.modifier
2022-01-29 14:21:10 -03:00
2022-01-29 11:18:26 -03:00
[
2024-01-06 15:05:50 +09:00
"and"
"as"
"delete"
"in"
"is"
"lock"
"not"
"or"
"sizeof"
"typeof"
2022-01-29 14:21:10 -03:00
] @keyword.operator
feat!: align standard captures with upstream Problem: Sharing highlight queries with upstream tree-sitter and Helix is difficult. Solution: Where reasonable, use capture names in tree-sitter's standard list or Helix's Atom-style hierarchy. Specifically: * tree-sitter "standard capture names" (https://github.com/tree-sitter/tree-sitter/blob/3f44b896852eb7daaa6df4fb778c9bb52c70c815/highlight/src/lib.rs#L20-L72): - `@parameter` -> `@variable.parameter` - `@field` -> `@variable.member` - `@namespace` -> `@module` - `@float` -> `@number.float` - `@symbol` -> `@string.special.symbol` - `@string.regex` -> `@string.regexp` - `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below) - `@text.title` -> `@markup.heading` - `@text.literal` -> `@markup.raw` - `@text.reference` -> `@markup.link` - `@text.uri` -> `@markup.link.url` (in markup links) - `@string.special` -> `@markup.link.label` (non-url links) - `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`) * Helix captures (https://docs.helix-editor.com/master/themes.html#syntax-highlighting): - `@method` -> `@function.method` - `@method.call` -> `@function.method.call` - `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}` - `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}` - `@text.uri` -> `@string.special.url` (outside markup) - `@preproc` -> `@keyword.directive` - `@define` -> `@keyword.directive`(`.define`?) - `@storageclass` -> `@keyword.storage` - `@conditional` -> `@keyword.conditional` - `@debug` -> `@keyword.debug` - `@exception` -> `@keyword.exception` - `@include` -> `@keyword.import` - `@repeat` -> `@keyword.repeat` * cleanup - remove some redundant `@conceal` (but still allow it for conceal-only patterns) - remove obsolete `@error` (syntax linting is out of scope for this repo) - sort, cleanup capture list in `CONTRIBUTING.md`
2023-12-24 10:00:20 +01:00
"using" @keyword.import
2022-01-28 19:13:39 -03:00
2024-01-06 15:05:50 +09:00
(using_directive
(symbol) @module)
(symbol
"global::" @module)
(array_creation_expression
"new" @keyword.operator)
2022-01-28 19:13:39 -03:00
2024-01-06 15:05:50 +09:00
(object_creation_expression
"new" @keyword.operator)
(argument
"out" @keyword.operator)
(argument
"ref" @keyword.operator)
2022-01-28 19:13:39 -03:00
2022-01-29 11:18:26 -03:00
[
"break"
"continue"
"do"
2022-01-29 11:18:26 -03:00
"for"
"foreach"
"while"
feat!: align standard captures with upstream Problem: Sharing highlight queries with upstream tree-sitter and Helix is difficult. Solution: Where reasonable, use capture names in tree-sitter's standard list or Helix's Atom-style hierarchy. Specifically: * tree-sitter "standard capture names" (https://github.com/tree-sitter/tree-sitter/blob/3f44b896852eb7daaa6df4fb778c9bb52c70c815/highlight/src/lib.rs#L20-L72): - `@parameter` -> `@variable.parameter` - `@field` -> `@variable.member` - `@namespace` -> `@module` - `@float` -> `@number.float` - `@symbol` -> `@string.special.symbol` - `@string.regex` -> `@string.regexp` - `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below) - `@text.title` -> `@markup.heading` - `@text.literal` -> `@markup.raw` - `@text.reference` -> `@markup.link` - `@text.uri` -> `@markup.link.url` (in markup links) - `@string.special` -> `@markup.link.label` (non-url links) - `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`) * Helix captures (https://docs.helix-editor.com/master/themes.html#syntax-highlighting): - `@method` -> `@function.method` - `@method.call` -> `@function.method.call` - `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}` - `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}` - `@text.uri` -> `@string.special.url` (outside markup) - `@preproc` -> `@keyword.directive` - `@define` -> `@keyword.directive`(`.define`?) - `@storageclass` -> `@keyword.storage` - `@conditional` -> `@keyword.conditional` - `@debug` -> `@keyword.debug` - `@exception` -> `@keyword.exception` - `@include` -> `@keyword.import` - `@repeat` -> `@keyword.repeat` * cleanup - remove some redundant `@conceal` (but still allow it for conceal-only patterns) - remove obsolete `@error` (syntax linting is out of scope for this repo) - sort, cleanup capture list in `CONTRIBUTING.md`
2023-12-24 10:00:20 +01:00
] @keyword.repeat
2022-01-29 11:18:26 -03:00
[
"catch"
"finally"
"throw"
"throws"
"try"
feat!: align standard captures with upstream Problem: Sharing highlight queries with upstream tree-sitter and Helix is difficult. Solution: Where reasonable, use capture names in tree-sitter's standard list or Helix's Atom-style hierarchy. Specifically: * tree-sitter "standard capture names" (https://github.com/tree-sitter/tree-sitter/blob/3f44b896852eb7daaa6df4fb778c9bb52c70c815/highlight/src/lib.rs#L20-L72): - `@parameter` -> `@variable.parameter` - `@field` -> `@variable.member` - `@namespace` -> `@module` - `@float` -> `@number.float` - `@symbol` -> `@string.special.symbol` - `@string.regex` -> `@string.regexp` - `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below) - `@text.title` -> `@markup.heading` - `@text.literal` -> `@markup.raw` - `@text.reference` -> `@markup.link` - `@text.uri` -> `@markup.link.url` (in markup links) - `@string.special` -> `@markup.link.label` (non-url links) - `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`) * Helix captures (https://docs.helix-editor.com/master/themes.html#syntax-highlighting): - `@method` -> `@function.method` - `@method.call` -> `@function.method.call` - `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}` - `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}` - `@text.uri` -> `@string.special.url` (outside markup) - `@preproc` -> `@keyword.directive` - `@define` -> `@keyword.directive`(`.define`?) - `@storageclass` -> `@keyword.storage` - `@conditional` -> `@keyword.conditional` - `@debug` -> `@keyword.debug` - `@exception` -> `@keyword.exception` - `@include` -> `@keyword.import` - `@repeat` -> `@keyword.repeat` * cleanup - remove some redundant `@conceal` (but still allow it for conceal-only patterns) - remove obsolete `@error` (syntax linting is out of scope for this repo) - sort, cleanup capture list in `CONTRIBUTING.md`
2023-12-24 10:00:20 +01:00
] @keyword.exception
2022-01-28 19:13:39 -03:00
2024-01-06 15:05:50 +09:00
"return" @keyword.return
2022-01-28 19:13:39 -03:00
[
2024-01-06 15:05:50 +09:00
"="
"=="
"+"
"+="
"-"
"-="
"++"
"--"
"|"
"|="
"&"
"&="
"^"
"^="
"/"
"/="
"*"
"*="
"%"
"%="
"<<"
"<<="
">>"
">>="
"."
"?."
"->"
"!"
"!="
"~"
"??"
"?"
":"
"<"
"<="
">"
">="
"||"
"&&"
"=>"
] @operator
2022-01-28 19:13:39 -03:00
[
2024-01-06 15:05:50 +09:00
","
";"
] @punctuation.delimiter
2022-01-28 19:13:39 -03:00
[
2024-01-06 15:05:50 +09:00
"$("
"("
")"
"{"
"}"
"["
"]"
] @punctuation.bracket