2024-06-26 09:52:56 +02:00
|
|
|
(shebang) @keyword.directive
|
|
|
|
|
|
2023-07-04 04:12:21 -04:00
|
|
|
; Includes
|
|
|
|
|
[
|
|
|
|
|
"import"
|
|
|
|
|
"module"
|
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
|
2023-07-04 04:12:21 -04:00
|
|
|
|
|
|
|
|
; Keywords
|
|
|
|
|
[
|
|
|
|
|
"asm"
|
|
|
|
|
"assert"
|
|
|
|
|
"const"
|
|
|
|
|
"defer"
|
|
|
|
|
"goto"
|
|
|
|
|
"sql"
|
|
|
|
|
"unsafe"
|
|
|
|
|
] @keyword
|
|
|
|
|
|
2024-04-23 12:23:15 -07:00
|
|
|
[
|
|
|
|
|
"enum"
|
|
|
|
|
"union"
|
|
|
|
|
"struct"
|
|
|
|
|
"interface"
|
|
|
|
|
"type"
|
|
|
|
|
] @keyword.type
|
|
|
|
|
|
2023-07-04 04:12:21 -04:00
|
|
|
[
|
|
|
|
|
"as"
|
|
|
|
|
"in"
|
|
|
|
|
"!in"
|
|
|
|
|
"or"
|
|
|
|
|
"is"
|
|
|
|
|
"!is"
|
|
|
|
|
] @keyword.operator
|
|
|
|
|
|
|
|
|
|
[
|
|
|
|
|
"match"
|
|
|
|
|
"if"
|
|
|
|
|
"$if"
|
|
|
|
|
"else"
|
|
|
|
|
"$else"
|
|
|
|
|
"select"
|
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
|
2023-07-04 04:12:21 -04:00
|
|
|
|
|
|
|
|
[
|
|
|
|
|
"for"
|
|
|
|
|
"$for"
|
|
|
|
|
"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
|
2023-07-04 04:12:21 -04:00
|
|
|
|
|
|
|
|
"fn" @keyword.function
|
|
|
|
|
|
|
|
|
|
"return" @keyword.return
|
|
|
|
|
|
|
|
|
|
[
|
|
|
|
|
"__global"
|
|
|
|
|
"shared"
|
|
|
|
|
"static"
|
|
|
|
|
"const"
|
2024-03-16 14:23:57 +09:00
|
|
|
] @keyword.modifier
|
2023-07-04 04:12:21 -04:00
|
|
|
|
|
|
|
|
[
|
|
|
|
|
"pub"
|
|
|
|
|
"mut"
|
2024-03-08 19:09:51 +09:00
|
|
|
] @keyword.modifier
|
2023-07-04 04:12:21 -04:00
|
|
|
|
|
|
|
|
[
|
|
|
|
|
"go"
|
|
|
|
|
"spawn"
|
|
|
|
|
"lock"
|
|
|
|
|
"rlock"
|
|
|
|
|
] @keyword.coroutine
|
|
|
|
|
|
|
|
|
|
; Variables
|
2022-02-23 16:53:43 +03:00
|
|
|
(identifier) @variable
|
|
|
|
|
|
2023-07-04 04:12:21 -04:00
|
|
|
; Namespace
|
|
|
|
|
(module_clause
|
2024-01-06 15:05:50 +09:00
|
|
|
(identifier) @module)
|
2022-02-22 17:36:44 +03:00
|
|
|
|
2023-07-04 04:12:21 -04:00
|
|
|
(import_path
|
2024-01-06 15:05:50 +09:00
|
|
|
(import_name) @module)
|
2022-02-22 17:36:44 +03:00
|
|
|
|
2023-07-04 04:12:21 -04:00
|
|
|
(import_alias
|
2024-01-06 15:05:50 +09:00
|
|
|
(import_name) @module)
|
2022-02-22 17:36:44 +03:00
|
|
|
|
2023-07-04 04:12:21 -04:00
|
|
|
; Literals
|
2024-01-06 15:05:50 +09:00
|
|
|
[
|
|
|
|
|
(true)
|
|
|
|
|
(false)
|
|
|
|
|
] @boolean
|
2022-02-22 17:36:44 +03:00
|
|
|
|
2023-07-04 04:12:21 -04:00
|
|
|
(interpreted_string_literal) @string
|
2022-02-22 17:36:44 +03:00
|
|
|
|
2023-07-04 04:12:21 -04:00
|
|
|
(string_interpolation) @none
|
2022-02-22 17:36:44 +03:00
|
|
|
|
2023-07-04 04:12:21 -04:00
|
|
|
; Types
|
|
|
|
|
(struct_declaration
|
|
|
|
|
name: (identifier) @type)
|
2022-02-22 17:36:44 +03:00
|
|
|
|
2023-07-04 04:12:21 -04:00
|
|
|
(enum_declaration
|
|
|
|
|
name: (identifier) @type)
|
2022-02-22 17:36:44 +03:00
|
|
|
|
2023-07-04 04:12:21 -04:00
|
|
|
(interface_declaration
|
|
|
|
|
name: (identifier) @type)
|
2022-02-22 17:36:44 +03:00
|
|
|
|
2023-07-04 04:12:21 -04:00
|
|
|
(type_declaration
|
|
|
|
|
name: (identifier) @type)
|
2022-02-22 17:36:44 +03:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
(type_reference_expression
|
|
|
|
|
(identifier) @type)
|
2022-02-22 17:36:44 +03:00
|
|
|
|
2023-07-04 04:12:21 -04:00
|
|
|
; Labels
|
|
|
|
|
(label_reference) @label
|
2022-02-22 17:36:44 +03:00
|
|
|
|
2023-07-04 04:12:21 -04:00
|
|
|
; Fields
|
2024-01-06 15:05:50 +09:00
|
|
|
(selector_expression
|
2024-03-21 20:44:35 +09:00
|
|
|
field: (reference_expression
|
|
|
|
|
(identifier) @variable.member))
|
2022-02-26 13:54:19 +01: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
|
|
|
(field_name) @variable.member
|
2022-02-26 13:54:19 +01:00
|
|
|
|
2023-07-04 04:12:21 -04:00
|
|
|
(struct_field_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) @variable.member)
|
2022-02-26 13:54:19 +01:00
|
|
|
|
2023-07-04 04:12:21 -04:00
|
|
|
; Parameters
|
|
|
|
|
(parameter_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) @variable.parameter)
|
2022-02-22 17:36:44 +03:00
|
|
|
|
2023-07-04 04:12:21 -04:00
|
|
|
(receiver
|
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)
|
2022-02-22 17:36:44 +03:00
|
|
|
|
2023-07-04 04:12:21 -04:00
|
|
|
; Constants
|
|
|
|
|
((identifier) @constant
|
|
|
|
|
(#has-ancestor? @constant compile_time_if_expression))
|
|
|
|
|
|
|
|
|
|
(enum_fetch
|
|
|
|
|
(reference_expression) @constant)
|
2022-02-22 17:36:44 +03:00
|
|
|
|
2023-07-04 04:12:21 -04:00
|
|
|
(enum_field_definition
|
|
|
|
|
(identifier) @constant)
|
2022-02-22 17:36:44 +03:00
|
|
|
|
2023-07-04 04:12:21 -04:00
|
|
|
(const_definition
|
|
|
|
|
name: (identifier) @constant)
|
2022-02-22 17:36:44 +03:00
|
|
|
|
2023-07-04 04:12:21 -04:00
|
|
|
((identifier) @variable.builtin
|
|
|
|
|
(#any-of? @variable.builtin "err" "macos" "linux" "windows"))
|
2022-02-22 17:36:44 +03:00
|
|
|
|
2023-07-04 04:12:21 -04:00
|
|
|
; Attributes
|
|
|
|
|
(attribute) @attribute
|
2022-02-22 17:36:44 +03:00
|
|
|
|
2023-07-04 04:12:21 -04:00
|
|
|
; Functions
|
|
|
|
|
(function_declaration
|
|
|
|
|
name: (identifier) @function)
|
|
|
|
|
|
|
|
|
|
(function_declaration
|
|
|
|
|
receiver: (receiver)
|
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)
|
2023-07-04 04:12:21 -04:00
|
|
|
|
|
|
|
|
(call_expression
|
2024-03-21 20:44:35 +09:00
|
|
|
name: (selector_expression
|
|
|
|
|
field: (reference_expression) @function.method.call))
|
2023-07-04 04:12:21 -04:00
|
|
|
|
|
|
|
|
(call_expression
|
2024-01-06 15:05:50 +09:00
|
|
|
name: (reference_expression) @function.call)
|
2022-02-22 17:36:44 +03:00
|
|
|
|
|
|
|
|
((identifier) @function.builtin
|
2024-02-23 17:42:01 +09:00
|
|
|
(#any-of? @function.builtin
|
|
|
|
|
"eprint" "eprintln" "error" "exit" "panic" "print" "println" "after" "after_char" "all"
|
|
|
|
|
"all_after" "all_after_last" "all_before" "all_before_last" "any" "ascii_str" "before" "bool"
|
|
|
|
|
"byte" "byterune" "bytes" "bytestr" "c_error_number_str" "capitalize" "clear" "clone"
|
|
|
|
|
"clone_to_depth" "close" "code" "compare" "compare_strings" "contains" "contains_any"
|
|
|
|
|
"contains_any_substr" "copy" "count" "cstring_to_vstring" "delete" "delete_last" "delete_many"
|
|
|
|
|
"ends_with" "eprint" "eprintln" "eq_epsilon" "error" "error_with_code" "exit" "f32" "f32_abs"
|
|
|
|
|
"f32_max" "f32_min" "f64" "f64_max" "fields" "filter" "find_between" "first" "flush_stderr"
|
|
|
|
|
"flush_stdout" "free" "gc_check_leaks" "get_str_intp_u32_format" "get_str_intp_u64_format"
|
|
|
|
|
"grow_cap" "grow_len" "hash" "hex" "hex2" "hex_full" "i16" "i64" "i8" "index" "index_after"
|
|
|
|
|
"index_any" "index_byte" "insert" "int" "is_alnum" "is_bin_digit" "is_capital" "is_digit"
|
|
|
|
|
"is_hex_digit" "is_letter" "is_lower" "is_oct_digit" "is_space" "is_title" "is_upper" "isnil"
|
|
|
|
|
"join" "join_lines" "keys" "last" "last_index" "last_index_byte" "length_in_bytes" "limit"
|
|
|
|
|
"malloc" "malloc_noscan" "map" "match_glob" "memdup" "memdup_noscan" "move" "msg" "panic"
|
|
|
|
|
"panic_error_number" "panic_lasterr" "panic_optional_not_set" "parse_int" "parse_uint"
|
|
|
|
|
"pointers" "pop" "prepend" "print" "print_backtrace" "println" "proc_pidpath" "ptr_str"
|
|
|
|
|
"push_many" "realloc_data" "reduce" "repeat" "repeat_to_depth" "replace" "replace_each"
|
|
|
|
|
"replace_once" "reverse" "reverse_in_place" "runes" "sort" "sort_by_len" "sort_ignore_case"
|
|
|
|
|
"sort_with_compare" "split" "split_any" "split_into_lines" "split_nth" "starts_with"
|
|
|
|
|
"starts_with_capital" "str" "str_escaped" "str_intp" "str_intp_g32" "str_intp_g64"
|
|
|
|
|
"str_intp_rune" "str_intp_sq" "str_intp_sub" "strg" "string_from_wide" "string_from_wide2"
|
|
|
|
|
"strip_margin" "strip_margin_custom" "strlong" "strsci" "substr" "substr_ni" "substr_with_check"
|
|
|
|
|
"title" "to_lower" "to_upper" "to_wide" "tos" "tos2" "tos3" "tos4" "tos5" "tos_clone" "trim"
|
|
|
|
|
"trim_left" "trim_pr" "try_pop" "try_push" "utf32_decode_to_buffer" "utf32_to_str"
|
|
|
|
|
"utf32_to_str_no_malloc" "utf8_char_len" "utf8_getchar" "utf8_str_len" "utf8_str_visible_length"
|
|
|
|
|
"utf8_to_utf32" "v_realloc" "vbytes" "vcalloc" "vcalloc_noscan" "vmemcmp" "vmemcpy" "vmemmove"
|
|
|
|
|
"vmemset" "vstring" "vstring_literal" "vstring_literal_with_len" "vstring_with_len" "vstrlen"
|
|
|
|
|
"vstrlen_char" "winapi_lasterr_str"))
|
2024-01-20 18:47:56 +09:00
|
|
|
|
2023-07-04 04:12:21 -04:00
|
|
|
; Operators
|
|
|
|
|
[
|
|
|
|
|
"++"
|
|
|
|
|
"--"
|
|
|
|
|
"+"
|
|
|
|
|
"-"
|
|
|
|
|
"*"
|
|
|
|
|
"/"
|
|
|
|
|
"%"
|
|
|
|
|
"~"
|
|
|
|
|
"&"
|
|
|
|
|
"|"
|
|
|
|
|
"^"
|
|
|
|
|
"!"
|
|
|
|
|
"&&"
|
|
|
|
|
"||"
|
|
|
|
|
"!="
|
|
|
|
|
"<<"
|
|
|
|
|
">>"
|
|
|
|
|
"<"
|
|
|
|
|
">"
|
|
|
|
|
"<="
|
|
|
|
|
">="
|
|
|
|
|
"+="
|
|
|
|
|
"-="
|
|
|
|
|
"*="
|
|
|
|
|
"/="
|
|
|
|
|
"&="
|
|
|
|
|
"|="
|
|
|
|
|
"^="
|
|
|
|
|
"<<="
|
|
|
|
|
">>="
|
|
|
|
|
"="
|
|
|
|
|
":="
|
|
|
|
|
"=="
|
|
|
|
|
"?"
|
|
|
|
|
"<-"
|
|
|
|
|
"$"
|
|
|
|
|
".."
|
|
|
|
|
"..."
|
|
|
|
|
] @operator
|
|
|
|
|
|
|
|
|
|
; Punctuation
|
2024-01-06 15:05:50 +09:00
|
|
|
[
|
|
|
|
|
"."
|
|
|
|
|
","
|
|
|
|
|
":"
|
|
|
|
|
";"
|
|
|
|
|
] @punctuation.delimiter
|
2023-07-04 04:12:21 -04:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
[
|
|
|
|
|
"("
|
|
|
|
|
")"
|
|
|
|
|
"{"
|
|
|
|
|
"}"
|
|
|
|
|
"["
|
|
|
|
|
"]"
|
|
|
|
|
] @punctuation.bracket
|
2023-07-04 04:12:21 -04:00
|
|
|
|
|
|
|
|
; Literals
|
2022-02-22 17:36:44 +03:00
|
|
|
(int_literal) @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
|
|
|
(float_literal) @number.float
|
2022-02-22 17:36:44 +03:00
|
|
|
|
2023-07-04 04:12:21 -04:00
|
|
|
[
|
|
|
|
|
(c_string_literal)
|
|
|
|
|
(raw_string_literal)
|
|
|
|
|
(interpreted_string_literal)
|
|
|
|
|
(string_interpolation)
|
|
|
|
|
(rune_literal)
|
|
|
|
|
] @string
|
|
|
|
|
|
|
|
|
|
(string_interpolation
|
2023-12-15 10:00:18 +01:00
|
|
|
(interpolation_opening) @punctuation.bracket
|
|
|
|
|
(interpolation_expression) @none
|
|
|
|
|
(interpolation_closing) @punctuation.bracket)
|
2023-03-03 18:55:49 +01:00
|
|
|
|
2022-02-22 17:36:44 +03:00
|
|
|
(escape_sequence) @string.escape
|
|
|
|
|
|
2023-07-04 04:12:21 -04:00
|
|
|
[
|
|
|
|
|
(true)
|
|
|
|
|
(false)
|
|
|
|
|
] @boolean
|
2022-02-22 17:36:44 +03:00
|
|
|
|
2023-07-04 04:12:21 -04:00
|
|
|
(nil) @constant.builtin
|
2022-02-22 17:36:44 +03:00
|
|
|
|
2023-07-04 04:12:21 -04:00
|
|
|
(none) @variable.builtin
|
|
|
|
|
|
|
|
|
|
; Comments
|
2024-03-30 06:35:04 +00:00
|
|
|
[
|
|
|
|
|
(line_comment)
|
|
|
|
|
(block_comment)
|
|
|
|
|
] @comment @spell
|
2022-02-22 17:36:44 +03:00
|
|
|
|
2023-03-02 08:06:35 -05:00
|
|
|
(_
|
2024-03-30 06:35:04 +00:00
|
|
|
(line_comment)+ @comment.documentation
|
2024-06-28 05:33:06 +02:00
|
|
|
.
|
2024-01-06 15:05:50 +09:00
|
|
|
[
|
|
|
|
|
(function_declaration)
|
|
|
|
|
(type_declaration)
|
|
|
|
|
(enum_declaration)
|
|
|
|
|
])
|