2020-06-17 18:01:29 +05:30
|
|
|
; CREDITS @maxbrunsfeld (maxbrunsfeld@gmail.com)
|
2020-09-12 20:57:01 +02:00
|
|
|
; Variables
|
|
|
|
|
(identifier) @variable
|
|
|
|
|
|
2024-09-19 23:15:01 -07:00
|
|
|
(underscore_pattern) @character.special
|
|
|
|
|
|
2020-09-12 20:57:01 +02:00
|
|
|
; Methods
|
2020-06-11 22:31:45 +05:30
|
|
|
(method_declaration
|
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-06-11 22:31:45 +05:30
|
|
|
(method_invocation
|
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.call)
|
2020-06-29 14:18:13 +05:30
|
|
|
|
2020-06-11 22:31:45 +05:30
|
|
|
(super) @function.builtin
|
|
|
|
|
|
2020-06-29 14:18:13 +05:30
|
|
|
; Parameters
|
|
|
|
|
(formal_parameter
|
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) @variable.parameter)
|
2020-06-29 14:18:13 +05:30
|
|
|
|
2021-02-19 22:35:23 +01:00
|
|
|
(spread_parameter
|
2024-01-06 15:05:50 +09:00
|
|
|
(variable_declarator
|
|
|
|
|
name: (identifier) @variable.parameter)) ; int... foo
|
2021-02-19 22:35:23 +01:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
; Lambda parameter
|
|
|
|
|
(inferred_parameters
|
|
|
|
|
(identifier) @variable.parameter) ; (x,y) -> ...
|
2023-02-23 17:04:07 -05:00
|
|
|
|
2020-06-30 07:44:35 +02:00
|
|
|
(lambda_expression
|
2024-01-06 15:05:50 +09:00
|
|
|
parameters: (identifier) @variable.parameter) ; x -> ...
|
2020-06-29 14:18:13 +05:30
|
|
|
|
2020-06-15 22:45:56 +05:30
|
|
|
; Operators
|
|
|
|
|
[
|
2023-02-23 17:04:07 -05:00
|
|
|
"+"
|
|
|
|
|
":"
|
|
|
|
|
"++"
|
|
|
|
|
"-"
|
|
|
|
|
"--"
|
|
|
|
|
"&"
|
|
|
|
|
"&&"
|
|
|
|
|
"|"
|
|
|
|
|
"||"
|
|
|
|
|
"!"
|
|
|
|
|
"!="
|
|
|
|
|
"=="
|
|
|
|
|
"*"
|
|
|
|
|
"/"
|
|
|
|
|
"%"
|
|
|
|
|
"<"
|
|
|
|
|
"<="
|
|
|
|
|
">"
|
|
|
|
|
">="
|
|
|
|
|
"="
|
|
|
|
|
"-="
|
|
|
|
|
"+="
|
|
|
|
|
"*="
|
|
|
|
|
"/="
|
|
|
|
|
"%="
|
|
|
|
|
"->"
|
|
|
|
|
"^"
|
|
|
|
|
"^="
|
|
|
|
|
"&="
|
|
|
|
|
"|="
|
|
|
|
|
"~"
|
|
|
|
|
">>"
|
|
|
|
|
">>>"
|
|
|
|
|
"<<"
|
|
|
|
|
"::"
|
2020-06-15 22:45:56 +05:30
|
|
|
] @operator
|
2020-06-11 22:31:45 +05:30
|
|
|
|
|
|
|
|
; Types
|
|
|
|
|
(interface_declaration
|
|
|
|
|
name: (identifier) @type)
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2023-06-20 10:51:36 +03:00
|
|
|
(annotation_type_declaration
|
|
|
|
|
name: (identifier) @type)
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2020-06-11 22:31:45 +05:30
|
|
|
(class_declaration
|
|
|
|
|
name: (identifier) @type)
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2021-04-10 02:46:11 +02:00
|
|
|
(record_declaration
|
|
|
|
|
name: (identifier) @type)
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2020-06-11 22:31:45 +05:30
|
|
|
(enum_declaration
|
|
|
|
|
name: (identifier) @type)
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2020-06-29 14:18:13 +05:30
|
|
|
(constructor_declaration
|
|
|
|
|
name: (identifier) @type)
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2024-05-02 17:27:26 -04:00
|
|
|
(compact_constructor_declaration
|
|
|
|
|
name: (identifier) @type)
|
|
|
|
|
|
2020-06-29 14:18:13 +05:30
|
|
|
(type_identifier) @type
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2023-10-14 00:12:18 +02:00
|
|
|
((type_identifier) @type.builtin
|
|
|
|
|
(#eq? @type.builtin "var"))
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2022-01-18 20:53:20 +07:00
|
|
|
((method_invocation
|
|
|
|
|
object: (identifier) @type)
|
2024-01-06 15:05:50 +09:00
|
|
|
(#lua-match? @type "^[A-Z]"))
|
|
|
|
|
|
2022-01-18 20:53:20 +07:00
|
|
|
((method_reference
|
2024-01-06 15:05:50 +09:00
|
|
|
.
|
|
|
|
|
(identifier) @type)
|
|
|
|
|
(#lua-match? @type "^[A-Z]"))
|
2020-06-29 14:18:13 +05:30
|
|
|
|
2020-06-11 22:31:45 +05:30
|
|
|
((field_access
|
|
|
|
|
object: (identifier) @type)
|
2021-11-18 09:51:03 +00:00
|
|
|
(#lua-match? @type "^[A-Z]"))
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2023-10-06 12:22:53 +09:00
|
|
|
(scoped_identifier
|
|
|
|
|
(identifier) @type
|
2021-11-18 09:51:03 +00:00
|
|
|
(#lua-match? @type "^[A-Z]"))
|
2020-06-11 22:31:45 +05:30
|
|
|
|
2021-03-26 19:25:28 +01:00
|
|
|
; Fields
|
|
|
|
|
(field_declaration
|
2024-03-21 20:44:35 +09:00
|
|
|
declarator: (variable_declarator
|
|
|
|
|
name: (identifier) @variable.member))
|
2021-03-26 19:25:28 +01:00
|
|
|
|
|
|
|
|
(field_access
|
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
|
|
|
field: (identifier) @variable.member)
|
2021-03-26 19:25:28 +01:00
|
|
|
|
2020-06-29 14:18:13 +05:30
|
|
|
[
|
2023-02-23 17:04:07 -05:00
|
|
|
(boolean_type)
|
|
|
|
|
(integral_type)
|
|
|
|
|
(floating_point_type)
|
|
|
|
|
(void_type)
|
2020-06-29 14:18:13 +05:30
|
|
|
] @type.builtin
|
2020-06-11 22:31:45 +05:30
|
|
|
|
|
|
|
|
; Variables
|
|
|
|
|
((identifier) @constant
|
2021-11-18 09:51:03 +00:00
|
|
|
(#lua-match? @constant "^[A-Z_][A-Z%d_]+$"))
|
2020-06-11 22:31:45 +05:30
|
|
|
|
2020-09-12 20:57:01 +02:00
|
|
|
(this) @variable.builtin
|
2020-06-11 22:31:45 +05:30
|
|
|
|
2023-12-04 20:37:26 +02:00
|
|
|
; Annotations
|
|
|
|
|
(annotation
|
|
|
|
|
"@" @attribute
|
|
|
|
|
name: (identifier) @attribute)
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2023-12-04 20:37:26 +02:00
|
|
|
(marker_annotation
|
|
|
|
|
"@" @attribute
|
|
|
|
|
name: (identifier) @attribute)
|
|
|
|
|
|
2020-06-11 22:31:45 +05:30
|
|
|
; Literals
|
2023-02-23 17:04:07 -05:00
|
|
|
(string_literal) @string
|
2020-06-29 14:18:13 +05:30
|
|
|
|
2023-02-23 17:04:07 -05:00
|
|
|
(escape_sequence) @string.escape
|
2020-06-29 14:18:13 +05:30
|
|
|
|
2020-06-15 23:23:17 +05:30
|
|
|
(character_literal) @character
|
2020-06-11 22:31:45 +05:30
|
|
|
|
2022-01-13 09:58:57 +01:00
|
|
|
[
|
2023-02-23 17:04:07 -05:00
|
|
|
(hex_integer_literal)
|
|
|
|
|
(decimal_integer_literal)
|
|
|
|
|
(octal_integer_literal)
|
|
|
|
|
(binary_integer_literal)
|
|
|
|
|
] @number
|
2020-06-11 22:31:45 +05:30
|
|
|
|
|
|
|
|
[
|
2023-02-23 17:04:07 -05:00
|
|
|
(decimal_floating_point_literal)
|
|
|
|
|
(hex_floating_point_literal)
|
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
|
|
|
] @number.float
|
2023-02-23 17:04:07 -05:00
|
|
|
|
|
|
|
|
[
|
|
|
|
|
(true)
|
|
|
|
|
(false)
|
2020-06-11 22:31:45 +05:30
|
|
|
] @boolean
|
|
|
|
|
|
2023-02-23 17:04:07 -05:00
|
|
|
(null_literal) @constant.builtin
|
|
|
|
|
|
2020-06-11 22:31:45 +05:30
|
|
|
; Keywords
|
|
|
|
|
[
|
2023-02-23 17:04:07 -05:00
|
|
|
"assert"
|
|
|
|
|
"default"
|
|
|
|
|
"extends"
|
|
|
|
|
"implements"
|
|
|
|
|
"instanceof"
|
2023-06-20 10:51:36 +03:00
|
|
|
"@interface"
|
2023-02-23 17:04:07 -05:00
|
|
|
"permits"
|
|
|
|
|
"to"
|
|
|
|
|
"with"
|
2022-11-18 17:45:31 +02:00
|
|
|
] @keyword
|
|
|
|
|
|
2024-04-23 12:23:15 -07:00
|
|
|
[
|
|
|
|
|
"record"
|
|
|
|
|
"class"
|
|
|
|
|
"enum"
|
|
|
|
|
"interface"
|
|
|
|
|
] @keyword.type
|
|
|
|
|
|
2022-11-18 17:45:31 +02:00
|
|
|
(synchronized_statement
|
|
|
|
|
"synchronized" @keyword)
|
|
|
|
|
|
|
|
|
|
[
|
2023-02-23 17:04:07 -05:00
|
|
|
"abstract"
|
|
|
|
|
"final"
|
|
|
|
|
"native"
|
|
|
|
|
"non-sealed"
|
|
|
|
|
"open"
|
|
|
|
|
"private"
|
|
|
|
|
"protected"
|
|
|
|
|
"public"
|
|
|
|
|
"sealed"
|
|
|
|
|
"static"
|
|
|
|
|
"strictfp"
|
|
|
|
|
"transitive"
|
2024-03-08 19:09:51 +09:00
|
|
|
] @keyword.modifier
|
2022-11-18 17:45:31 +02:00
|
|
|
|
|
|
|
|
(modifiers
|
2024-03-08 19:09:51 +09:00
|
|
|
"synchronized" @keyword.modifier)
|
2022-11-18 17:45:31 +02:00
|
|
|
|
|
|
|
|
[
|
2023-02-23 17:04:07 -05:00
|
|
|
"transient"
|
|
|
|
|
"volatile"
|
2024-03-16 14:23:57 +09:00
|
|
|
] @keyword.modifier
|
2020-06-11 22:31:45 +05:30
|
|
|
|
2021-07-04 19:55:59 +03:00
|
|
|
[
|
2023-02-23 17:04:07 -05:00
|
|
|
"return"
|
|
|
|
|
"yield"
|
2021-07-04 20:24:25 +03:00
|
|
|
] @keyword.return
|
2021-07-04 19:55:59 +03:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
"new" @keyword.operator
|
2020-09-13 15:08:11 +02:00
|
|
|
|
2020-06-11 22:31:45 +05:30
|
|
|
; Conditionals
|
|
|
|
|
[
|
2023-02-23 17:04:07 -05:00
|
|
|
"if"
|
|
|
|
|
"else"
|
|
|
|
|
"switch"
|
|
|
|
|
"case"
|
2024-04-09 21:25:02 +02:00
|
|
|
"when"
|
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
|
2020-06-11 22:31:45 +05:30
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
(ternary_expression
|
|
|
|
|
[
|
|
|
|
|
"?"
|
|
|
|
|
":"
|
|
|
|
|
] @keyword.conditional.ternary)
|
2020-11-19 16:03:58 +05:30
|
|
|
|
2025-10-01 20:33:49 -07:00
|
|
|
(wildcard
|
|
|
|
|
"?" @character.special)
|
|
|
|
|
|
2023-02-23 17:04:07 -05:00
|
|
|
; Loops
|
2020-06-11 22:31:45 +05:30
|
|
|
[
|
2023-02-23 17:04:07 -05:00
|
|
|
"for"
|
|
|
|
|
"while"
|
|
|
|
|
"do"
|
|
|
|
|
"continue"
|
|
|
|
|
"break"
|
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
|
2020-06-11 22:31:45 +05:30
|
|
|
|
2020-06-29 14:18:13 +05:30
|
|
|
; Includes
|
2023-02-23 17:04:07 -05:00
|
|
|
[
|
|
|
|
|
"exports"
|
|
|
|
|
"import"
|
|
|
|
|
"module"
|
|
|
|
|
"opens"
|
|
|
|
|
"package"
|
|
|
|
|
"provides"
|
|
|
|
|
"requires"
|
|
|
|
|
"uses"
|
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-06-11 22:31:45 +05:30
|
|
|
|
2024-08-01 01:24:40 -07:00
|
|
|
(import_declaration
|
|
|
|
|
(asterisk
|
|
|
|
|
"*" @character.special))
|
|
|
|
|
|
2020-06-11 22:31:45 +05:30
|
|
|
; Punctuation
|
2020-06-29 14:18:13 +05:30
|
|
|
[
|
2023-02-23 17:04:07 -05:00
|
|
|
";"
|
|
|
|
|
"."
|
|
|
|
|
"..."
|
|
|
|
|
","
|
2020-06-29 14:18:13 +05:30
|
|
|
] @punctuation.delimiter
|
|
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
[
|
|
|
|
|
"{"
|
|
|
|
|
"}"
|
|
|
|
|
] @punctuation.bracket
|
2020-08-16 10:26:11 +05:30
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
[
|
|
|
|
|
"["
|
|
|
|
|
"]"
|
|
|
|
|
] @punctuation.bracket
|
2023-05-04 19:50:31 +00:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
[
|
|
|
|
|
"("
|
|
|
|
|
")"
|
|
|
|
|
] @punctuation.bracket
|
|
|
|
|
|
|
|
|
|
(type_arguments
|
|
|
|
|
[
|
|
|
|
|
"<"
|
|
|
|
|
">"
|
|
|
|
|
] @punctuation.bracket)
|
|
|
|
|
|
|
|
|
|
(type_parameters
|
|
|
|
|
[
|
|
|
|
|
"<"
|
|
|
|
|
">"
|
|
|
|
|
] @punctuation.bracket)
|
|
|
|
|
|
|
|
|
|
(string_interpolation
|
|
|
|
|
[
|
|
|
|
|
"\\{"
|
|
|
|
|
"}"
|
|
|
|
|
] @punctuation.special)
|
2023-08-18 16:03:46 +09:00
|
|
|
|
2020-09-13 15:08:11 +02:00
|
|
|
; Exceptions
|
|
|
|
|
[
|
2023-02-23 17:04:07 -05:00
|
|
|
"throw"
|
|
|
|
|
"throws"
|
|
|
|
|
"finally"
|
|
|
|
|
"try"
|
|
|
|
|
"catch"
|
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-09-13 15:08:11 +02:00
|
|
|
|
2020-08-16 10:26:11 +05:30
|
|
|
; Labels
|
|
|
|
|
(labeled_statement
|
|
|
|
|
(identifier) @label)
|
2023-02-23 17:04:07 -05:00
|
|
|
|
|
|
|
|
; Comments
|
|
|
|
|
[
|
|
|
|
|
(line_comment)
|
|
|
|
|
(block_comment)
|
|
|
|
|
] @comment @spell
|
2023-03-02 08:06:35 -05:00
|
|
|
|
|
|
|
|
((block_comment) @comment.documentation
|
|
|
|
|
(#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$"))
|
|
|
|
|
|
|
|
|
|
((line_comment) @comment.documentation
|
|
|
|
|
(#lua-match? @comment.documentation "^///[^/]"))
|
|
|
|
|
|
|
|
|
|
((line_comment) @comment.documentation
|
|
|
|
|
(#lua-match? @comment.documentation "^///$"))
|