2024-10-07 10:42:58 -07:00
|
|
|
(identifier) @variable
|
|
|
|
|
|
2020-07-22 16:43:33 +02:00
|
|
|
(dotted_identifier_list) @string
|
2024-01-20 18:47:56 +09:00
|
|
|
|
2020-07-22 16:43:33 +02:00
|
|
|
; Methods
|
2020-09-23 21:48:14 +01:00
|
|
|
; --------------------
|
2021-05-18 20:52:57 +01:00
|
|
|
; TODO: add method/call_expression to grammar and
|
|
|
|
|
; distinguish method call from variable access
|
2024-01-06 15:05:50 +09:00
|
|
|
(function_expression_body
|
2024-10-07 10:42:58 -07:00
|
|
|
(identifier) @function.call)
|
2020-07-22 16:43:33 +02:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
; ((identifier)(selector (argument_part)) @function)
|
2021-07-01 16:55:42 +01:00
|
|
|
; NOTE: This query is a bit of a work around for the fact that the dart grammar doesn't
|
|
|
|
|
; specifically identify a node as a function call
|
2024-10-07 10:42:58 -07:00
|
|
|
(((identifier) @function.call
|
|
|
|
|
(#lua-match? @function.call "^_?[%l]"))
|
2024-01-06 15:05:50 +09:00
|
|
|
.
|
2024-02-18 23:13:39 +09:00
|
|
|
(selector
|
|
|
|
|
.
|
2024-10-07 10:42:58 -07:00
|
|
|
(argument_part))) @function.call
|
2021-07-01 16:55:42 +01:00
|
|
|
|
2020-07-22 16:43:33 +02:00
|
|
|
; Annotations
|
2020-09-23 21:48:14 +01:00
|
|
|
; --------------------
|
2020-07-22 16:43:33 +02:00
|
|
|
(annotation
|
2024-10-07 10:42:58 -07:00
|
|
|
"@" @attribute
|
2020-09-18 16:57:38 +01:00
|
|
|
name: (identifier) @attribute)
|
2020-07-22 16:43:33 +02:00
|
|
|
|
2020-08-07 12:29:06 +01:00
|
|
|
; Operators and Tokens
|
2020-09-23 21:48:14 +01:00
|
|
|
; --------------------
|
|
|
|
|
(template_substitution
|
|
|
|
|
"$" @punctuation.special
|
|
|
|
|
"{" @punctuation.special
|
2024-01-06 15:05:50 +09:00
|
|
|
"}" @punctuation.special) @none
|
2020-08-09 15:13:37 +01:00
|
|
|
|
2020-11-14 18:07:48 +01:00
|
|
|
(template_substitution
|
|
|
|
|
"$" @punctuation.special
|
2024-01-06 15:05:50 +09:00
|
|
|
(identifier_dollar_escaped) @variable) @none
|
2020-11-14 18:07:48 +01:00
|
|
|
|
2020-11-15 01:20:07 +01:00
|
|
|
(escape_sequence) @string.escape
|
|
|
|
|
|
2020-07-22 16:43:33 +02:00
|
|
|
[
|
2024-01-06 15:05:50 +09:00
|
|
|
"=>"
|
|
|
|
|
".."
|
|
|
|
|
"??"
|
|
|
|
|
"=="
|
2024-10-07 10:42:58 -07:00
|
|
|
"!"
|
2024-01-06 15:05:50 +09:00
|
|
|
"?"
|
|
|
|
|
"&&"
|
|
|
|
|
"%"
|
|
|
|
|
"<"
|
|
|
|
|
">"
|
|
|
|
|
"="
|
|
|
|
|
">="
|
|
|
|
|
"<="
|
|
|
|
|
"||"
|
2024-10-07 10:42:58 -07:00
|
|
|
">>>="
|
|
|
|
|
">>="
|
|
|
|
|
"<<="
|
|
|
|
|
"&="
|
|
|
|
|
"|="
|
|
|
|
|
"??="
|
|
|
|
|
"%="
|
|
|
|
|
"+="
|
|
|
|
|
"-="
|
|
|
|
|
"*="
|
|
|
|
|
"/="
|
|
|
|
|
"^="
|
|
|
|
|
"~/="
|
|
|
|
|
(shift_operator)
|
2024-01-06 15:05:50 +09:00
|
|
|
(multiplicative_operator)
|
|
|
|
|
(increment_operator)
|
|
|
|
|
(is_operator)
|
|
|
|
|
(prefix_operator)
|
|
|
|
|
(equality_operator)
|
|
|
|
|
(additive_operator)
|
2020-07-22 16:43:33 +02:00
|
|
|
] @operator
|
2020-07-22 23:25:02 +01:00
|
|
|
|
2020-08-07 12:29:06 +01:00
|
|
|
[
|
|
|
|
|
"("
|
|
|
|
|
")"
|
|
|
|
|
"["
|
|
|
|
|
"]"
|
|
|
|
|
"{"
|
|
|
|
|
"}"
|
2024-01-06 15:05:50 +09:00
|
|
|
] @punctuation.bracket
|
2020-07-22 23:25:02 +01:00
|
|
|
|
2020-08-07 12:29:06 +01:00
|
|
|
; Delimiters
|
2020-09-23 21:48:14 +01:00
|
|
|
; --------------------
|
2020-08-07 12:29:06 +01:00
|
|
|
[
|
|
|
|
|
";"
|
|
|
|
|
"."
|
|
|
|
|
","
|
2024-10-07 10:42:58 -07:00
|
|
|
":"
|
|
|
|
|
"?."
|
|
|
|
|
"?"
|
2020-08-07 12:29:06 +01:00
|
|
|
] @punctuation.delimiter
|
2020-07-22 23:25:02 +01:00
|
|
|
|
2020-07-22 16:43:33 +02:00
|
|
|
; Types
|
2020-09-23 21:48:14 +01:00
|
|
|
; --------------------
|
2020-07-22 16:43:33 +02:00
|
|
|
(class_definition
|
|
|
|
|
name: (identifier) @type)
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2020-07-22 16:43:33 +02:00
|
|
|
(constructor_signature
|
|
|
|
|
name: (identifier) @type)
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2020-07-22 16:43:33 +02:00
|
|
|
(scoped_identifier
|
|
|
|
|
scope: (identifier) @type)
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2020-07-22 16:43:33 +02:00
|
|
|
(function_signature
|
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
|
|
|
name: (identifier) @function.method)
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2020-07-23 09:28:48 +01:00
|
|
|
(getter_signature
|
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
|
|
|
(identifier) @function.method)
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2020-07-23 09:28:48 +01:00
|
|
|
(setter_signature
|
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
|
|
|
name: (identifier) @function.method)
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2020-07-22 16:43:33 +02:00
|
|
|
(enum_declaration
|
|
|
|
|
name: (identifier) @type)
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2020-07-22 16:43:33 +02:00
|
|
|
(enum_constant
|
|
|
|
|
name: (identifier) @type)
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2020-07-22 16:43:33 +02:00
|
|
|
(void_type) @type
|
|
|
|
|
|
|
|
|
|
((scoped_identifier
|
|
|
|
|
scope: (identifier) @type
|
|
|
|
|
name: (identifier) @type)
|
2024-01-06 15:05:50 +09:00
|
|
|
(#lua-match? @type "^[%u%l]"))
|
2020-07-22 16:43:33 +02:00
|
|
|
|
|
|
|
|
(type_identifier) @type
|
|
|
|
|
|
2022-10-22 14:00:28 +03:00
|
|
|
(type_alias
|
|
|
|
|
(type_identifier) @type.definition)
|
|
|
|
|
|
2024-10-07 10:42:58 -07:00
|
|
|
(type_arguments
|
|
|
|
|
[
|
|
|
|
|
"<"
|
|
|
|
|
">"
|
|
|
|
|
] @punctuation.bracket)
|
|
|
|
|
|
2020-07-22 16:43:33 +02:00
|
|
|
; Variables
|
2020-09-23 21:48:14 +01:00
|
|
|
; --------------------
|
2020-08-07 12:29:06 +01:00
|
|
|
; var keyword
|
|
|
|
|
(inferred_type) @keyword
|
|
|
|
|
|
2020-07-22 23:25:02 +01:00
|
|
|
((identifier) @type
|
2024-01-06 15:05:50 +09:00
|
|
|
(#lua-match? @type "^_?[%u].*[%l]")) ; catch Classes or IClasses not CLASSES
|
2020-07-22 16:43:33 +02:00
|
|
|
|
2024-01-21 22:05:44 +09:00
|
|
|
"Function" @type
|
2020-09-18 14:36:52 +01:00
|
|
|
|
2020-08-09 15:13:37 +01:00
|
|
|
; properties
|
2020-08-07 14:59:02 +01:00
|
|
|
(unconditional_assignable_selector
|
2020-08-09 15:13:37 +01:00
|
|
|
(identifier) @property)
|
|
|
|
|
|
2021-07-01 13:36:40 +01:00
|
|
|
(conditional_assignable_selector
|
|
|
|
|
(identifier) @property)
|
|
|
|
|
|
2020-08-09 15:13:37 +01:00
|
|
|
(this) @variable.builtin
|
2020-08-07 12:29:06 +01:00
|
|
|
|
|
|
|
|
; Parameters
|
2020-09-23 21:48:14 +01:00
|
|
|
; --------------------
|
2020-07-22 16:43:33 +02:00
|
|
|
(formal_parameter
|
2024-10-07 10:42:58 -07:00
|
|
|
(identifier) @variable.parameter)
|
2020-07-22 16:43:33 +02:00
|
|
|
|
2020-08-07 15:15:16 +01:00
|
|
|
(named_argument
|
2024-01-06 15:05:50 +09:00
|
|
|
(label
|
|
|
|
|
(identifier) @variable.parameter))
|
2020-07-22 16:43:33 +02:00
|
|
|
|
2020-08-07 12:29:06 +01:00
|
|
|
; Literals
|
2020-09-23 21:48:14 +01:00
|
|
|
; --------------------
|
2020-08-07 12:29:06 +01:00
|
|
|
[
|
2024-01-06 15:05:50 +09:00
|
|
|
(hex_integer_literal)
|
|
|
|
|
(decimal_integer_literal)
|
|
|
|
|
(decimal_floating_point_literal)
|
|
|
|
|
; TODO: inaccessible nodes
|
|
|
|
|
; (octal_integer_literal)
|
|
|
|
|
; (hex_floating_point_literal)
|
2020-08-07 12:29:06 +01:00
|
|
|
] @number
|
|
|
|
|
|
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_literal) @string.special.symbol
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2020-07-22 16:43:33 +02:00
|
|
|
(string_literal) @string
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2020-07-22 16:43:33 +02:00
|
|
|
(true) @boolean
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2020-07-22 16:43:33 +02:00
|
|
|
(false) @boolean
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2020-07-22 16:43:33 +02:00
|
|
|
(null_literal) @constant.builtin
|
|
|
|
|
|
2023-03-02 08:06:35 -05:00
|
|
|
(comment) @comment @spell
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2023-03-02 08:06:35 -05:00
|
|
|
(documentation_comment) @comment.documentation @spell
|
2020-07-22 16:43:33 +02:00
|
|
|
|
|
|
|
|
; Keywords
|
2020-09-23 21:48:14 +01:00
|
|
|
; --------------------
|
2022-10-22 14:00:28 +03:00
|
|
|
[
|
|
|
|
|
"import"
|
|
|
|
|
"library"
|
|
|
|
|
"export"
|
|
|
|
|
"as"
|
|
|
|
|
"show"
|
|
|
|
|
"hide"
|
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.import
|
2020-07-22 16:43:33 +02:00
|
|
|
|
2020-08-09 15:13:37 +01:00
|
|
|
; Reserved words (cannot be used as identifiers)
|
2020-07-22 16:43:33 +02:00
|
|
|
[
|
2024-01-06 15:05:50 +09:00
|
|
|
; TODO:
|
|
|
|
|
; "rethrow" cannot be targeted at all and seems to be an invisible node
|
|
|
|
|
; TODO:
|
|
|
|
|
; the assert keyword cannot be specifically targeted
|
|
|
|
|
; because the grammar selects the whole node or the content
|
|
|
|
|
; of the assertion not just the keyword
|
|
|
|
|
; assert
|
|
|
|
|
(case_builtin)
|
|
|
|
|
"late"
|
|
|
|
|
"required"
|
|
|
|
|
"on"
|
|
|
|
|
"extends"
|
|
|
|
|
"in"
|
|
|
|
|
"is"
|
|
|
|
|
"new"
|
|
|
|
|
"super"
|
|
|
|
|
"with"
|
2020-08-07 12:29:06 +01:00
|
|
|
] @keyword
|
|
|
|
|
|
2024-04-23 12:23:15 -07:00
|
|
|
[
|
|
|
|
|
"class"
|
|
|
|
|
"enum"
|
|
|
|
|
"extension"
|
|
|
|
|
] @keyword.type
|
|
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
"return" @keyword.return
|
2020-08-09 16:45:50 +01:00
|
|
|
|
|
|
|
|
; Built in identifiers:
|
|
|
|
|
; alone these are marked as keywords
|
2020-08-07 12:29:06 +01:00
|
|
|
[
|
2024-01-06 15:05:50 +09:00
|
|
|
"deferred"
|
|
|
|
|
"factory"
|
|
|
|
|
"get"
|
|
|
|
|
"implements"
|
|
|
|
|
"interface"
|
|
|
|
|
"library"
|
|
|
|
|
"operator"
|
|
|
|
|
"mixin"
|
|
|
|
|
"part"
|
|
|
|
|
"set"
|
|
|
|
|
"typedef"
|
2020-08-07 12:29:06 +01:00
|
|
|
] @keyword
|
2020-07-22 16:43:33 +02:00
|
|
|
|
2023-02-24 06:37:45 -05:00
|
|
|
[
|
|
|
|
|
"async"
|
|
|
|
|
"async*"
|
|
|
|
|
"sync*"
|
|
|
|
|
"await"
|
|
|
|
|
"yield"
|
|
|
|
|
] @keyword.coroutine
|
|
|
|
|
|
2022-10-22 14:00:28 +03:00
|
|
|
[
|
2024-01-06 15:05:50 +09:00
|
|
|
(const_builtin)
|
|
|
|
|
(final_builtin)
|
|
|
|
|
"abstract"
|
|
|
|
|
"covariant"
|
|
|
|
|
"external"
|
|
|
|
|
"static"
|
|
|
|
|
"final"
|
|
|
|
|
"base"
|
|
|
|
|
"sealed"
|
2024-03-08 19:09:51 +09:00
|
|
|
] @keyword.modifier
|
2022-10-22 14:00:28 +03:00
|
|
|
|
2020-08-09 16:45:50 +01:00
|
|
|
; when used as an identifier:
|
|
|
|
|
((identifier) @variable.builtin
|
2024-02-23 17:42:01 +09:00
|
|
|
(#any-of? @variable.builtin
|
|
|
|
|
"abstract" "as" "covariant" "deferred" "dynamic" "export" "external" "factory" "Function" "get"
|
|
|
|
|
"implements" "import" "interface" "library" "operator" "mixin" "part" "set" "static" "typedef"))
|
2024-01-06 15:05:50 +09:00
|
|
|
|
|
|
|
|
[
|
|
|
|
|
"if"
|
|
|
|
|
"else"
|
|
|
|
|
"switch"
|
|
|
|
|
"default"
|
|
|
|
|
] @keyword.conditional
|
2020-07-22 16:43:33 +02:00
|
|
|
|
2024-10-07 10:42:58 -07:00
|
|
|
(conditional_expression
|
|
|
|
|
[
|
|
|
|
|
"?"
|
|
|
|
|
":"
|
|
|
|
|
] @keyword.conditional.ternary)
|
|
|
|
|
|
2020-08-07 15:15:16 +01:00
|
|
|
[
|
|
|
|
|
"try"
|
|
|
|
|
"throw"
|
|
|
|
|
"catch"
|
|
|
|
|
"finally"
|
|
|
|
|
(break_statement)
|
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
|
2020-07-22 16:43:33 +02:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
[
|
|
|
|
|
"do"
|
|
|
|
|
"while"
|
|
|
|
|
"continue"
|
|
|
|
|
"for"
|
|
|
|
|
] @keyword.repeat
|