2020-07-08 12:35:53 +02:00
|
|
|
; Forked from https://github.com/tree-sitter/tree-sitter-rust
|
|
|
|
|
; Copyright (c) 2017 Maxim Sokolov
|
|
|
|
|
; Licensed under the MIT license.
|
|
|
|
|
; Identifier conventions
|
2024-01-24 01:16:04 -05:00
|
|
|
(shebang) @keyword.directive
|
|
|
|
|
|
2021-03-13 14:18:51 -05:00
|
|
|
(identifier) @variable
|
2023-05-08 21:07:41 -04:00
|
|
|
|
2021-10-30 12:09:54 -05:00
|
|
|
((identifier) @type
|
2023-05-08 21:07:41 -04:00
|
|
|
(#lua-match? @type "^[A-Z]"))
|
|
|
|
|
|
2021-05-21 14:46:54 -05:00
|
|
|
(const_item
|
|
|
|
|
name: (identifier) @constant)
|
2023-05-08 21:07:41 -04:00
|
|
|
|
2020-07-08 12:35:53 +02:00
|
|
|
; Assume all-caps names are constants
|
|
|
|
|
((identifier) @constant
|
2023-05-08 21:07:41 -04:00
|
|
|
(#lua-match? @constant "^[A-Z][A-Z%d_]*$"))
|
2020-07-08 12:35:53 +02:00
|
|
|
|
|
|
|
|
; Other identifiers
|
|
|
|
|
(type_identifier) @type
|
2023-05-08 21:07:41 -04:00
|
|
|
|
2020-07-08 12:35:53 +02:00
|
|
|
(primitive_type) @type.builtin
|
2023-05-08 21:07:41 -04: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_identifier) @variable.member
|
2023-05-08 21:07:41 -04:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
(shorthand_field_initializer
|
|
|
|
|
(identifier) @variable.member)
|
2023-05-08 21:07:41 -04:00
|
|
|
|
2020-09-22 23:01:19 +02:00
|
|
|
(mod_item
|
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) @module)
|
2020-07-08 12:35:53 +02:00
|
|
|
|
2024-05-07 13:36:07 -07:00
|
|
|
[
|
|
|
|
|
(self)
|
|
|
|
|
"_"
|
|
|
|
|
] @variable.builtin
|
2021-11-05 11:35:41 -05:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
(label
|
|
|
|
|
[
|
|
|
|
|
"'"
|
|
|
|
|
(identifier)
|
|
|
|
|
] @label)
|
2021-11-05 11:35:41 -05:00
|
|
|
|
|
|
|
|
; Function definitions
|
2024-01-06 15:05:50 +09:00
|
|
|
(function_item
|
|
|
|
|
(identifier) @function)
|
2021-11-05 11:35:41 -05:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
(function_signature_item
|
|
|
|
|
(identifier) @function)
|
2021-11-05 11:35:41 -05:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
(parameter
|
2024-05-07 13:36:07 -07:00
|
|
|
[
|
|
|
|
|
(identifier)
|
|
|
|
|
"_"
|
|
|
|
|
] @variable.parameter)
|
2023-05-08 21:07:41 -04:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
(closure_parameters
|
|
|
|
|
(_) @variable.parameter)
|
2021-11-05 11:35:41 -05:00
|
|
|
|
2020-07-08 12:35:53 +02:00
|
|
|
; Function calls
|
|
|
|
|
(call_expression
|
2022-07-29 21:09:58 -03:00
|
|
|
function: (identifier) @function.call)
|
2023-05-08 21:07:41 -04:00
|
|
|
|
2020-09-22 23:01:19 +02:00
|
|
|
(call_expression
|
2024-03-21 20:44:35 +09:00
|
|
|
function: (scoped_identifier
|
|
|
|
|
(identifier) @function.call .))
|
2023-05-08 21:07:41 -04:00
|
|
|
|
2020-07-08 12:35:53 +02:00
|
|
|
(call_expression
|
2024-03-21 20:44:35 +09:00
|
|
|
function: (field_expression
|
|
|
|
|
field: (field_identifier) @function.call))
|
2020-07-08 12:35:53 +02:00
|
|
|
|
|
|
|
|
(generic_function
|
2022-07-29 21:09:58 -03:00
|
|
|
function: (identifier) @function.call)
|
2023-05-08 21:07:41 -04:00
|
|
|
|
2020-07-08 12:35:53 +02:00
|
|
|
(generic_function
|
2024-03-21 20:44:35 +09:00
|
|
|
function: (scoped_identifier
|
|
|
|
|
name: (identifier) @function.call))
|
2023-05-08 21:07:41 -04:00
|
|
|
|
2020-07-08 12:35:53 +02:00
|
|
|
(generic_function
|
2024-03-21 20:44:35 +09:00
|
|
|
function: (field_expression
|
|
|
|
|
field: (field_identifier) @function.call))
|
2020-07-08 12:35:53 +02:00
|
|
|
|
|
|
|
|
; Assume other uppercase names are enum constructors
|
2021-09-30 22:13:18 -05:00
|
|
|
((field_identifier) @constant
|
2024-01-06 15:05:50 +09:00
|
|
|
(#lua-match? @constant "^[A-Z]"))
|
2020-07-08 12:35:53 +02:00
|
|
|
|
2021-09-30 22:13:18 -05:00
|
|
|
(enum_variant
|
|
|
|
|
name: (identifier) @constant)
|
|
|
|
|
|
2020-07-08 12:35:53 +02:00
|
|
|
; Assume that uppercase names in paths are types
|
2020-09-22 23:01:19 +02:00
|
|
|
(scoped_identifier
|
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
|
|
|
path: (identifier) @module)
|
2023-05-08 21:07:41 -04:00
|
|
|
|
2020-09-22 23:01:19 +02:00
|
|
|
(scoped_identifier
|
2024-01-06 15:05:50 +09:00
|
|
|
(scoped_identifier
|
|
|
|
|
name: (identifier) @module))
|
2023-05-08 21:07:41 -04:00
|
|
|
|
2020-09-22 23:01:19 +02:00
|
|
|
(scoped_type_identifier
|
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
|
|
|
path: (identifier) @module)
|
2023-05-08 21:07:41 -04:00
|
|
|
|
2022-10-18 11:44:54 +02:00
|
|
|
(scoped_type_identifier
|
|
|
|
|
path: (identifier) @type
|
|
|
|
|
(#lua-match? @type "^[A-Z]"))
|
2023-05-08 21:07:41 -04:00
|
|
|
|
2020-09-22 23:01:19 +02:00
|
|
|
(scoped_type_identifier
|
2024-01-06 15:05:50 +09:00
|
|
|
(scoped_identifier
|
|
|
|
|
name: (identifier) @module))
|
2023-05-08 21:07:41 -04:00
|
|
|
|
2020-07-08 12:35:53 +02:00
|
|
|
((scoped_identifier
|
|
|
|
|
path: (identifier) @type)
|
2024-01-06 15:05:50 +09:00
|
|
|
(#lua-match? @type "^[A-Z]"))
|
2023-05-08 21:07:41 -04:00
|
|
|
|
2020-07-08 12:35:53 +02:00
|
|
|
((scoped_identifier
|
2024-01-06 15:05:50 +09:00
|
|
|
name: (identifier) @type)
|
|
|
|
|
(#lua-match? @type "^[A-Z]"))
|
2023-05-08 21:07:41 -04:00
|
|
|
|
2023-04-08 14:23:05 +09:00
|
|
|
((scoped_identifier
|
2024-01-06 15:05:50 +09:00
|
|
|
name: (identifier) @constant)
|
|
|
|
|
(#lua-match? @constant "^[A-Z][A-Z%d_]*$"))
|
2020-07-08 12:35:53 +02:00
|
|
|
|
2023-05-08 21:07:32 -04:00
|
|
|
((scoped_identifier
|
|
|
|
|
path: (identifier) @type
|
|
|
|
|
name: (identifier) @constant)
|
|
|
|
|
(#lua-match? @type "^[A-Z]")
|
|
|
|
|
(#lua-match? @constant "^[A-Z]"))
|
|
|
|
|
|
|
|
|
|
((scoped_type_identifier
|
|
|
|
|
path: (identifier) @type
|
|
|
|
|
name: (type_identifier) @constant)
|
|
|
|
|
(#lua-match? @type "^[A-Z]")
|
|
|
|
|
(#lua-match? @constant "^[A-Z]"))
|
|
|
|
|
|
2021-11-05 11:35:41 -05:00
|
|
|
[
|
|
|
|
|
(crate)
|
|
|
|
|
(super)
|
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
|
|
|
] @module
|
2021-11-05 11:35:41 -05:00
|
|
|
|
2020-09-22 23:01:19 +02:00
|
|
|
(scoped_use_list
|
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
|
|
|
path: (identifier) @module)
|
2023-05-08 21:07:41 -04:00
|
|
|
|
2020-09-22 23:01:19 +02:00
|
|
|
(scoped_use_list
|
2024-03-21 20:44:35 +09:00
|
|
|
path: (scoped_identifier
|
|
|
|
|
(identifier) @module))
|
2024-01-06 15:05:50 +09:00
|
|
|
|
|
|
|
|
(use_list
|
|
|
|
|
(scoped_identifier
|
|
|
|
|
(identifier) @module
|
|
|
|
|
.
|
|
|
|
|
(_)))
|
|
|
|
|
|
|
|
|
|
(use_list
|
|
|
|
|
(identifier) @type
|
|
|
|
|
(#lua-match? @type "^[A-Z]"))
|
2023-05-08 21:07:41 -04:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
(use_as_clause
|
|
|
|
|
alias: (identifier) @type
|
|
|
|
|
(#lua-match? @type "^[A-Z]"))
|
2020-08-07 10:47:39 +02:00
|
|
|
|
2023-05-08 21:07:41 -04:00
|
|
|
; Correct enum constructors
|
2020-07-08 12:35:53 +02:00
|
|
|
(call_expression
|
2024-03-21 20:44:35 +09:00
|
|
|
function: (scoped_identifier
|
|
|
|
|
"::"
|
|
|
|
|
name: (identifier) @constant)
|
2021-11-18 09:51:03 +00:00
|
|
|
(#lua-match? @constant "^[A-Z]"))
|
2020-07-08 12:35:53 +02:00
|
|
|
|
2021-10-30 12:09:54 -05:00
|
|
|
; Assume uppercase names in a match arm are constants.
|
|
|
|
|
((match_arm
|
2024-03-21 20:44:35 +09:00
|
|
|
pattern: (match_pattern
|
|
|
|
|
(identifier) @constant))
|
2024-01-06 15:05:50 +09:00
|
|
|
(#lua-match? @constant "^[A-Z]"))
|
2023-05-08 21:07:41 -04:00
|
|
|
|
2021-10-30 12:09:54 -05:00
|
|
|
((match_arm
|
2024-03-21 20:44:35 +09:00
|
|
|
pattern: (match_pattern
|
|
|
|
|
(scoped_identifier
|
|
|
|
|
name: (identifier) @constant)))
|
2024-01-06 15:05:50 +09:00
|
|
|
(#lua-match? @constant "^[A-Z]"))
|
2021-10-30 12:09:54 -05:00
|
|
|
|
|
|
|
|
((identifier) @constant.builtin
|
2024-01-06 15:05:50 +09:00
|
|
|
(#any-of? @constant.builtin "Some" "None" "Ok" "Err"))
|
2021-10-30 12:09:54 -05:00
|
|
|
|
2023-05-08 21:07:41 -04:00
|
|
|
; Macro definitions
|
2021-07-08 13:16:34 -05:00
|
|
|
"$" @function.macro
|
2023-05-08 21:07:41 -04:00
|
|
|
|
2021-07-08 13:16:34 -05:00
|
|
|
(metavariable) @function.macro
|
2023-05-08 21:07:41 -04:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
(macro_definition
|
|
|
|
|
"macro_rules!" @function.macro)
|
2021-07-08 13:16:34 -05:00
|
|
|
|
2023-05-08 21:07:41 -04:00
|
|
|
; Attribute macros
|
2024-01-06 15:05:50 +09:00
|
|
|
(attribute_item
|
|
|
|
|
(attribute
|
|
|
|
|
(identifier) @function.macro))
|
2023-05-08 21:07:41 -04:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
(inner_attribute_item
|
|
|
|
|
(attribute
|
|
|
|
|
(identifier) @function.macro))
|
2023-05-08 21:07:41 -04:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
(attribute
|
|
|
|
|
(scoped_identifier
|
|
|
|
|
(identifier) @function.macro .))
|
2021-07-08 13:16:34 -05:00
|
|
|
|
2023-05-08 21:07:41 -04:00
|
|
|
; Derive macros (assume all arguments are types)
|
2022-11-05 10:31:02 +01:00
|
|
|
; (attribute
|
|
|
|
|
; (identifier) @_name
|
|
|
|
|
; arguments: (attribute (attribute (identifier) @type))
|
|
|
|
|
; (#eq? @_name "derive"))
|
2023-05-08 21:07:41 -04:00
|
|
|
; Function-like macros
|
2020-07-08 12:35:53 +02:00
|
|
|
(macro_invocation
|
2020-09-22 23:01:19 +02:00
|
|
|
macro: (identifier) @function.macro)
|
2023-05-08 21:07:41 -04:00
|
|
|
|
2020-09-22 23:01:19 +02:00
|
|
|
(macro_invocation
|
2024-03-21 20:44:35 +09:00
|
|
|
macro: (scoped_identifier
|
|
|
|
|
(identifier) @function.macro .))
|
2020-07-08 12:35:53 +02:00
|
|
|
|
2023-05-08 21:07:41 -04:00
|
|
|
; Literals
|
2020-07-08 12:35:53 +02:00
|
|
|
[
|
2021-11-05 11:35:41 -05:00
|
|
|
(line_comment)
|
|
|
|
|
(block_comment)
|
2022-09-26 10:19:02 +01:00
|
|
|
] @comment @spell
|
2022-09-06 11:56:27 +01:00
|
|
|
|
2024-02-16 11:47:10 +01:00
|
|
|
(line_comment
|
|
|
|
|
(doc_comment)) @comment.documentation
|
2023-05-08 21:07:41 -04:00
|
|
|
|
2024-02-16 11:47:10 +01:00
|
|
|
(block_comment
|
|
|
|
|
(doc_comment)) @comment.documentation
|
2023-03-02 08:06:35 -05:00
|
|
|
|
2021-11-05 11:35:41 -05:00
|
|
|
(boolean_literal) @boolean
|
2023-05-08 21:07:41 -04:00
|
|
|
|
2021-11-05 11:35:41 -05:00
|
|
|
(integer_literal) @number
|
2023-05-08 21:07:41 -04: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
|
|
|
(float_literal) @number.float
|
2020-07-08 12:35:53 +02:00
|
|
|
|
2021-11-05 11:35:41 -05:00
|
|
|
[
|
|
|
|
|
(raw_string_literal)
|
|
|
|
|
(string_literal)
|
|
|
|
|
] @string
|
2023-05-08 21:07:41 -04:00
|
|
|
|
2021-11-05 11:35:41 -05:00
|
|
|
(escape_sequence) @string.escape
|
2020-07-08 12:35:53 +02:00
|
|
|
|
2023-05-08 21:07:41 -04:00
|
|
|
(char_literal) @character
|
2021-11-05 11:35:41 -05:00
|
|
|
|
2023-05-08 21:07:41 -04:00
|
|
|
; Keywords
|
2020-09-22 23:01:19 +02:00
|
|
|
[
|
2021-11-05 11:35:41 -05:00
|
|
|
"use"
|
|
|
|
|
"mod"
|
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-05-08 21:07:41 -04:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
(use_as_clause
|
|
|
|
|
"as" @keyword.import)
|
2020-09-22 23:01:19 +02:00
|
|
|
|
2020-07-08 12:35:53 +02:00
|
|
|
[
|
2021-11-05 11:35:41 -05:00
|
|
|
"default"
|
|
|
|
|
"impl"
|
|
|
|
|
"let"
|
|
|
|
|
"move"
|
|
|
|
|
"unsafe"
|
|
|
|
|
"where"
|
2021-06-10 23:31:31 -05:00
|
|
|
] @keyword
|
2020-07-08 12:35:53 +02:00
|
|
|
|
2024-04-23 12:23:15 -07:00
|
|
|
[
|
|
|
|
|
"enum"
|
|
|
|
|
"struct"
|
|
|
|
|
"union"
|
|
|
|
|
"trait"
|
|
|
|
|
"type"
|
|
|
|
|
] @keyword.type
|
|
|
|
|
|
2023-02-24 06:37:45 -05:00
|
|
|
[
|
|
|
|
|
"async"
|
|
|
|
|
"await"
|
|
|
|
|
] @keyword.coroutine
|
|
|
|
|
|
2024-01-24 01:16:04 -05:00
|
|
|
"try" @keyword.exception
|
|
|
|
|
|
2022-10-15 15:47:15 +03:00
|
|
|
[
|
2023-04-19 02:25:04 -04:00
|
|
|
"ref"
|
2024-03-16 17:36:53 -07:00
|
|
|
"pub"
|
2024-01-06 15:05:50 +09:00
|
|
|
(mutable_specifier)
|
2023-04-19 02:25:04 -04:00
|
|
|
"const"
|
|
|
|
|
"static"
|
|
|
|
|
"dyn"
|
|
|
|
|
"extern"
|
2024-03-16 14:23:57 +09:00
|
|
|
] @keyword.modifier
|
2022-10-15 15:47:15 +03:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
(lifetime
|
2024-03-16 14:39:24 +09:00
|
|
|
"'" @keyword.modifier)
|
|
|
|
|
|
|
|
|
|
(lifetime
|
|
|
|
|
(identifier) @attribute)
|
|
|
|
|
|
|
|
|
|
(lifetime
|
|
|
|
|
(identifier) @attribute.builtin
|
|
|
|
|
(#any-of? @attribute.builtin "static" "_"))
|
2022-10-15 15:47:15 +03:00
|
|
|
|
2021-11-05 11:35:41 -05:00
|
|
|
"fn" @keyword.function
|
2023-04-19 02:25:04 -04:00
|
|
|
|
2022-01-07 22:35:09 +01:00
|
|
|
[
|
|
|
|
|
"return"
|
|
|
|
|
"yield"
|
|
|
|
|
] @keyword.return
|
2021-07-04 19:55:59 +03:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
(type_cast_expression
|
|
|
|
|
"as" @keyword.operator)
|
2021-01-16 19:02:09 +01:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
(qualified_type
|
|
|
|
|
"as" @keyword.operator)
|
2023-05-08 21:07:41 -04:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
(use_list
|
|
|
|
|
(self) @module)
|
2023-05-08 21:07:41 -04:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
(scoped_use_list
|
|
|
|
|
(self) @module)
|
2023-05-08 21:07:41 -04:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
(scoped_identifier
|
|
|
|
|
[
|
|
|
|
|
(crate)
|
|
|
|
|
(super)
|
|
|
|
|
(self)
|
|
|
|
|
] @module)
|
|
|
|
|
|
|
|
|
|
(visibility_modifier
|
|
|
|
|
[
|
|
|
|
|
(crate)
|
|
|
|
|
(super)
|
|
|
|
|
(self)
|
|
|
|
|
] @module)
|
2020-07-08 12:35:53 +02:00
|
|
|
|
|
|
|
|
[
|
2021-11-05 11:35:41 -05:00
|
|
|
"if"
|
2023-04-19 02:25:04 -04:00
|
|
|
"else"
|
|
|
|
|
"match"
|
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-07-08 12:35:53 +02:00
|
|
|
|
|
|
|
|
[
|
2021-11-05 11:35:41 -05:00
|
|
|
"break"
|
|
|
|
|
"continue"
|
|
|
|
|
"in"
|
|
|
|
|
"loop"
|
|
|
|
|
"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
|
2020-07-08 12:35:53 +02:00
|
|
|
|
2022-10-18 12:10:13 +02:00
|
|
|
"for" @keyword
|
2020-07-08 12:35:53 +02:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
(for_expression
|
|
|
|
|
"for" @keyword.repeat)
|
2020-09-13 15:08:11 +02:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
; Operators
|
2020-09-13 15:08:11 +02:00
|
|
|
[
|
2021-11-05 11:18:39 -05:00
|
|
|
"!"
|
|
|
|
|
"!="
|
|
|
|
|
"%"
|
|
|
|
|
"%="
|
|
|
|
|
"&"
|
|
|
|
|
"&&"
|
|
|
|
|
"&="
|
|
|
|
|
"*"
|
|
|
|
|
"*="
|
|
|
|
|
"+"
|
|
|
|
|
"+="
|
|
|
|
|
"-"
|
|
|
|
|
"-="
|
|
|
|
|
".."
|
|
|
|
|
"..="
|
2024-01-24 01:16:04 -05:00
|
|
|
"..."
|
2021-11-05 11:18:39 -05:00
|
|
|
"/"
|
|
|
|
|
"/="
|
|
|
|
|
"<"
|
|
|
|
|
"<<"
|
|
|
|
|
"<<="
|
|
|
|
|
"<="
|
|
|
|
|
"="
|
|
|
|
|
"=="
|
|
|
|
|
">"
|
|
|
|
|
">="
|
|
|
|
|
">>"
|
|
|
|
|
">>="
|
|
|
|
|
"?"
|
|
|
|
|
"@"
|
|
|
|
|
"^"
|
|
|
|
|
"^="
|
|
|
|
|
"|"
|
|
|
|
|
"|="
|
|
|
|
|
"||"
|
2020-08-18 21:09:47 -04:00
|
|
|
] @operator
|
2020-07-08 12:35:53 +02:00
|
|
|
|
2023-05-08 21:07:41 -04:00
|
|
|
; Punctuation
|
2024-01-06 15:05:50 +09:00
|
|
|
[
|
|
|
|
|
"("
|
|
|
|
|
")"
|
|
|
|
|
"["
|
|
|
|
|
"]"
|
|
|
|
|
"{"
|
|
|
|
|
"}"
|
|
|
|
|
] @punctuation.bracket
|
|
|
|
|
|
|
|
|
|
(closure_parameters
|
|
|
|
|
"|" @punctuation.bracket)
|
|
|
|
|
|
|
|
|
|
(type_arguments
|
|
|
|
|
[
|
|
|
|
|
"<"
|
|
|
|
|
">"
|
|
|
|
|
] @punctuation.bracket)
|
|
|
|
|
|
|
|
|
|
(type_parameters
|
|
|
|
|
[
|
|
|
|
|
"<"
|
|
|
|
|
">"
|
|
|
|
|
] @punctuation.bracket)
|
|
|
|
|
|
|
|
|
|
(bracketed_type
|
|
|
|
|
[
|
|
|
|
|
"<"
|
|
|
|
|
">"
|
|
|
|
|
] @punctuation.bracket)
|
|
|
|
|
|
|
|
|
|
(for_lifetimes
|
|
|
|
|
[
|
|
|
|
|
"<"
|
|
|
|
|
">"
|
|
|
|
|
] @punctuation.bracket)
|
2023-05-08 21:07:41 -04:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
[
|
|
|
|
|
","
|
|
|
|
|
"."
|
|
|
|
|
":"
|
|
|
|
|
"::"
|
|
|
|
|
";"
|
|
|
|
|
"->"
|
|
|
|
|
"=>"
|
|
|
|
|
] @punctuation.delimiter
|
|
|
|
|
|
|
|
|
|
(attribute_item
|
|
|
|
|
"#" @punctuation.special)
|
|
|
|
|
|
|
|
|
|
(inner_attribute_item
|
|
|
|
|
[
|
|
|
|
|
"!"
|
|
|
|
|
"#"
|
|
|
|
|
] @punctuation.special)
|
2023-05-08 21:07:41 -04:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
(macro_invocation
|
|
|
|
|
"!" @function.macro)
|
2023-05-08 21:07:41 -04:00
|
|
|
|
2024-04-07 02:46:13 -04:00
|
|
|
(never_type
|
2024-01-06 15:05:50 +09:00
|
|
|
"!" @type.builtin)
|
2022-10-18 13:02:22 +02:00
|
|
|
|
2023-05-08 21:07:41 -04:00
|
|
|
(macro_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
|
|
|
macro: (identifier) @keyword.exception
|
|
|
|
|
"!" @keyword.exception
|
|
|
|
|
(#eq? @keyword.exception "panic"))
|
2023-05-08 21:07:41 -04:00
|
|
|
|
|
|
|
|
(macro_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
|
|
|
macro: (identifier) @keyword.exception
|
|
|
|
|
"!" @keyword.exception
|
|
|
|
|
(#contains? @keyword.exception "assert"))
|
2023-05-08 21:07:41 -04:00
|
|
|
|
|
|
|
|
(macro_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
|
|
|
macro: (identifier) @keyword.debug
|
|
|
|
|
"!" @keyword.debug
|
|
|
|
|
(#eq? @keyword.debug "dbg"))
|