2022-03-10 19:14:49 +08:00
|
|
|
; Pragma
|
2023-02-24 07:42:04 -05:00
|
|
|
[
|
2024-01-06 15:05:50 +09:00
|
|
|
"pragma"
|
2023-02-24 07:42:04 -05:00
|
|
|
"solidity"
|
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.directive
|
2023-02-24 07:42:04 -05:00
|
|
|
|
|
|
|
|
(solidity_pragma_token
|
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
|
|
|
"||" @string.special.symbol)
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2023-02-24 07:42:04 -05:00
|
|
|
(solidity_pragma_token
|
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
|
|
|
"-" @string.special.symbol)
|
2023-02-24 07:42:04 -05:00
|
|
|
|
|
|
|
|
(solidity_version_comparison_operator) @operator
|
2022-03-10 19:14:49 +08: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
|
|
|
(solidity_version) @string.special
|
2023-04-25 13:09:18 -04:00
|
|
|
|
2022-03-10 19:14:49 +08:00
|
|
|
; Literals
|
|
|
|
|
[
|
2024-01-06 15:05:50 +09:00
|
|
|
(string)
|
|
|
|
|
(yul_string_literal)
|
2022-03-10 19:14:49 +08:00
|
|
|
] @string
|
2023-02-24 07:42:04 -05:00
|
|
|
|
|
|
|
|
(hex_string_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
|
|
|
"hex" @string.special.symbol
|
2023-02-24 07:42:04 -05:00
|
|
|
(_) @string)
|
|
|
|
|
|
|
|
|
|
(unicode_string_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
|
|
|
"unicode" @string.special.symbol
|
2023-02-24 07:42:04 -05:00
|
|
|
(_) @string)
|
|
|
|
|
|
2022-03-10 19:14:49 +08:00
|
|
|
[
|
2024-01-06 15:05:50 +09:00
|
|
|
(number_literal)
|
|
|
|
|
(yul_decimal_number)
|
|
|
|
|
(yul_hex_number)
|
2022-03-10 19:14:49 +08:00
|
|
|
] @number
|
|
|
|
|
|
2023-02-24 07:42:04 -05:00
|
|
|
(yul_boolean) @boolean
|
2022-03-10 19:14:49 +08:00
|
|
|
|
2023-04-25 13:09:18 -04:00
|
|
|
; Variables
|
|
|
|
|
[
|
|
|
|
|
(identifier)
|
|
|
|
|
(yul_identifier)
|
|
|
|
|
] @variable
|
|
|
|
|
|
|
|
|
|
; Types
|
2024-01-06 15:05:50 +09:00
|
|
|
(type_name
|
|
|
|
|
(identifier) @type)
|
2023-04-25 13:09:18 -04:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
(type_name
|
|
|
|
|
(user_defined_type
|
|
|
|
|
(identifier) @type))
|
|
|
|
|
|
|
|
|
|
(type_name
|
|
|
|
|
"mapping" @function.builtin)
|
2023-02-24 07:42:04 -05:00
|
|
|
|
|
|
|
|
[
|
|
|
|
|
(primitive_type)
|
|
|
|
|
(number_unit)
|
|
|
|
|
] @type.builtin
|
|
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
(contract_declaration
|
|
|
|
|
name: (identifier) @type)
|
|
|
|
|
|
|
|
|
|
(struct_declaration
|
|
|
|
|
name: (identifier) @type)
|
|
|
|
|
|
|
|
|
|
(struct_member
|
|
|
|
|
name: (identifier) @variable.member)
|
|
|
|
|
|
|
|
|
|
(enum_declaration
|
|
|
|
|
name: (identifier) @type)
|
|
|
|
|
|
|
|
|
|
(emit_statement
|
|
|
|
|
.
|
2024-04-13 18:46:25 +02:00
|
|
|
(expression
|
|
|
|
|
(identifier)) @type)
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2022-10-28 17:26:32 +03:00
|
|
|
; Handles ContractA, ContractB in function foo() override(ContractA, contractB) {}
|
2024-01-06 15:05:50 +09:00
|
|
|
(override_specifier
|
|
|
|
|
(user_defined_type) @type)
|
2022-03-10 19:14:49 +08:00
|
|
|
|
|
|
|
|
; Functions and parameters
|
|
|
|
|
(function_definition
|
2023-04-25 13:09:18 -04:00
|
|
|
name: (identifier) @function)
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2022-03-10 19:14:49 +08:00
|
|
|
(modifier_definition
|
2023-04-25 13:09:18 -04:00
|
|
|
name: (identifier) @function)
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2022-03-10 19:14:49 +08:00
|
|
|
(yul_evm_builtin) @function.builtin
|
|
|
|
|
|
2023-02-23 20:30:36 +01:00
|
|
|
; Use constructor coloring for special functions
|
2024-01-06 15:05:50 +09:00
|
|
|
(constructor_definition
|
|
|
|
|
"constructor" @constructor)
|
2022-03-10 19:14:49 +08:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
(modifier_invocation
|
|
|
|
|
(identifier) @function)
|
2022-03-10 19:14:49 +08:00
|
|
|
|
|
|
|
|
; Handles expressions like structVariable.g();
|
2024-01-06 15:05:50 +09:00
|
|
|
(call_expression
|
|
|
|
|
.
|
2024-04-13 18:46:25 +02:00
|
|
|
(expression
|
|
|
|
|
(member_expression
|
|
|
|
|
(identifier) @function.method.call)))
|
2022-03-10 19:14:49 +08:00
|
|
|
|
|
|
|
|
; Handles expressions like g();
|
2024-01-06 15:05:50 +09:00
|
|
|
(call_expression
|
|
|
|
|
.
|
2024-04-13 18:46:25 +02:00
|
|
|
(expression
|
|
|
|
|
(identifier) @function.call))
|
2022-03-10 19:14:49 +08:00
|
|
|
|
|
|
|
|
; Function parameters
|
2024-04-10 03:22:05 -04:00
|
|
|
(event_parameter
|
2024-04-13 18:46:25 +02:00
|
|
|
name: (_) @variable.parameter)
|
2024-01-06 15:05:50 +09:00
|
|
|
|
|
|
|
|
(parameter
|
2024-04-13 18:46:25 +02:00
|
|
|
name: (_) @variable.parameter)
|
2022-03-10 19:14:49 +08:00
|
|
|
|
|
|
|
|
; Yul functions
|
2024-01-06 15:05:50 +09:00
|
|
|
(yul_function_call
|
|
|
|
|
function: (yul_identifier) @function.call)
|
2022-03-10 19:14:49 +08:00
|
|
|
|
|
|
|
|
; Yul function parameters
|
2024-01-06 15:05:50 +09:00
|
|
|
(yul_function_definition
|
|
|
|
|
.
|
|
|
|
|
(yul_identifier) @function
|
|
|
|
|
(yul_identifier) @variable.parameter)
|
|
|
|
|
|
|
|
|
|
(meta_type_expression
|
|
|
|
|
"type" @keyword)
|
2022-03-10 19:14:49 +08:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
(member_expression
|
2024-04-13 18:46:25 +02:00
|
|
|
property: (_) @variable.member)
|
2024-01-06 15:05:50 +09:00
|
|
|
|
|
|
|
|
(call_struct_argument
|
2024-04-13 18:46:25 +02:00
|
|
|
name: (_) @variable.member)
|
2024-01-06 15:05:50 +09:00
|
|
|
|
|
|
|
|
(struct_field_assignment
|
|
|
|
|
name: (identifier) @variable.member)
|
2022-03-10 19:14:49 +08:00
|
|
|
|
2022-03-12 01:11:17 +08:00
|
|
|
(enum_value) @constant
|
2022-03-10 19:14:49 +08:00
|
|
|
|
|
|
|
|
; Keywords
|
|
|
|
|
[
|
2025-05-12 17:43:10 +01:00
|
|
|
"abstract"
|
2023-02-24 07:42:04 -05:00
|
|
|
"library"
|
|
|
|
|
"is"
|
|
|
|
|
"event"
|
|
|
|
|
"assembly"
|
|
|
|
|
"emit"
|
|
|
|
|
"override"
|
|
|
|
|
"modifier"
|
|
|
|
|
"var"
|
|
|
|
|
"let"
|
2023-09-27 13:08:46 +07:00
|
|
|
"error"
|
2023-02-24 07:42:04 -05:00
|
|
|
"fallback"
|
|
|
|
|
"receive"
|
|
|
|
|
(virtual)
|
2022-10-28 17:26:32 +03:00
|
|
|
] @keyword
|
|
|
|
|
|
2024-04-23 12:23:15 -07:00
|
|
|
[
|
|
|
|
|
"enum"
|
|
|
|
|
"struct"
|
|
|
|
|
"contract"
|
|
|
|
|
"interface"
|
|
|
|
|
] @keyword.type
|
|
|
|
|
|
2023-02-24 07:42:04 -05:00
|
|
|
; FIXME: update grammar
|
|
|
|
|
; (block_statement "unchecked" @keyword)
|
2024-04-10 03:22:05 -04:00
|
|
|
(event_parameter
|
2024-01-06 15:05:50 +09:00
|
|
|
"indexed" @keyword)
|
2023-02-24 07:42:04 -05:00
|
|
|
|
2022-10-28 17:26:32 +03:00
|
|
|
[
|
2023-02-24 07:42:04 -05:00
|
|
|
"public"
|
|
|
|
|
"internal"
|
|
|
|
|
"private"
|
|
|
|
|
"external"
|
|
|
|
|
"pure"
|
|
|
|
|
"view"
|
|
|
|
|
"payable"
|
|
|
|
|
(immutable)
|
2024-03-08 19:09:51 +09:00
|
|
|
] @keyword.modifier
|
2022-10-28 17:26:32 +03:00
|
|
|
|
|
|
|
|
[
|
2023-02-24 07:42:04 -05:00
|
|
|
"memory"
|
|
|
|
|
"storage"
|
|
|
|
|
"calldata"
|
|
|
|
|
"constant"
|
2024-03-16 14:23:57 +09:00
|
|
|
] @keyword.modifier
|
2022-03-10 19:14:49 +08:00
|
|
|
|
2022-03-11 05:07:26 +08:00
|
|
|
[
|
2023-02-24 07:42:04 -05:00
|
|
|
"for"
|
|
|
|
|
"while"
|
|
|
|
|
"do"
|
|
|
|
|
"break"
|
|
|
|
|
"continue"
|
feat!: align standard captures with upstream
Problem: Sharing highlight queries with upstream tree-sitter and
Helix is difficult.
Solution: Where reasonable, use capture names in tree-sitter's standard
list or Helix's Atom-style hierarchy.
Specifically:
* tree-sitter "standard capture names"
(https://github.com/tree-sitter/tree-sitter/blob/3f44b896852eb7daaa6df4fb778c9bb52c70c815/highlight/src/lib.rs#L20-L72):
- `@parameter` -> `@variable.parameter`
- `@field` -> `@variable.member`
- `@namespace` -> `@module`
- `@float` -> `@number.float`
- `@symbol` -> `@string.special.symbol`
- `@string.regex` -> `@string.regexp`
- `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below)
- `@text.title` -> `@markup.heading`
- `@text.literal` -> `@markup.raw`
- `@text.reference` -> `@markup.link`
- `@text.uri` -> `@markup.link.url` (in markup links)
- `@string.special` -> `@markup.link.label` (non-url links)
- `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`)
* Helix captures
(https://docs.helix-editor.com/master/themes.html#syntax-highlighting):
- `@method` -> `@function.method`
- `@method.call` -> `@function.method.call`
- `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}`
- `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}`
- `@text.uri` -> `@string.special.url` (outside markup)
- `@preproc` -> `@keyword.directive`
- `@define` -> `@keyword.directive`(`.define`?)
- `@storageclass` -> `@keyword.storage`
- `@conditional` -> `@keyword.conditional`
- `@debug` -> `@keyword.debug`
- `@exception` -> `@keyword.exception`
- `@include` -> `@keyword.import`
- `@repeat` -> `@keyword.repeat`
* cleanup
- remove some redundant `@conceal` (but still allow it for conceal-only patterns)
- remove obsolete `@error` (syntax linting is out of scope for this repo)
- sort, cleanup capture list in `CONTRIBUTING.md`
2023-12-24 10:00:20 +01:00
|
|
|
] @keyword.repeat
|
2022-03-11 05:07:26 +08:00
|
|
|
|
2022-03-12 01:11:17 +08:00
|
|
|
[
|
2023-02-24 07:42:04 -05:00
|
|
|
"if"
|
|
|
|
|
"else"
|
|
|
|
|
"switch"
|
|
|
|
|
"case"
|
|
|
|
|
"default"
|
feat!: align standard captures with upstream
Problem: Sharing highlight queries with upstream tree-sitter and
Helix is difficult.
Solution: Where reasonable, use capture names in tree-sitter's standard
list or Helix's Atom-style hierarchy.
Specifically:
* tree-sitter "standard capture names"
(https://github.com/tree-sitter/tree-sitter/blob/3f44b896852eb7daaa6df4fb778c9bb52c70c815/highlight/src/lib.rs#L20-L72):
- `@parameter` -> `@variable.parameter`
- `@field` -> `@variable.member`
- `@namespace` -> `@module`
- `@float` -> `@number.float`
- `@symbol` -> `@string.special.symbol`
- `@string.regex` -> `@string.regexp`
- `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below)
- `@text.title` -> `@markup.heading`
- `@text.literal` -> `@markup.raw`
- `@text.reference` -> `@markup.link`
- `@text.uri` -> `@markup.link.url` (in markup links)
- `@string.special` -> `@markup.link.label` (non-url links)
- `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`)
* Helix captures
(https://docs.helix-editor.com/master/themes.html#syntax-highlighting):
- `@method` -> `@function.method`
- `@method.call` -> `@function.method.call`
- `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}`
- `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}`
- `@text.uri` -> `@string.special.url` (outside markup)
- `@preproc` -> `@keyword.directive`
- `@define` -> `@keyword.directive`(`.define`?)
- `@storageclass` -> `@keyword.storage`
- `@conditional` -> `@keyword.conditional`
- `@debug` -> `@keyword.debug`
- `@exception` -> `@keyword.exception`
- `@include` -> `@keyword.import`
- `@repeat` -> `@keyword.repeat`
* cleanup
- remove some redundant `@conceal` (but still allow it for conceal-only patterns)
- remove obsolete `@error` (syntax linting is out of scope for this repo)
- sort, cleanup capture list in `CONTRIBUTING.md`
2023-12-24 10:00:20 +01:00
|
|
|
] @keyword.conditional
|
2022-03-12 01:11:17 +08:00
|
|
|
|
2023-02-24 07:42:04 -05:00
|
|
|
(ternary_expression
|
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.ternary
|
|
|
|
|
":" @keyword.conditional.ternary)
|
2023-02-24 07:42:04 -05:00
|
|
|
|
2022-03-12 01:11:17 +08:00
|
|
|
[
|
2023-02-24 07:42:04 -05:00
|
|
|
"try"
|
|
|
|
|
"catch"
|
|
|
|
|
"revert"
|
feat!: align standard captures with upstream
Problem: Sharing highlight queries with upstream tree-sitter and
Helix is difficult.
Solution: Where reasonable, use capture names in tree-sitter's standard
list or Helix's Atom-style hierarchy.
Specifically:
* tree-sitter "standard capture names"
(https://github.com/tree-sitter/tree-sitter/blob/3f44b896852eb7daaa6df4fb778c9bb52c70c815/highlight/src/lib.rs#L20-L72):
- `@parameter` -> `@variable.parameter`
- `@field` -> `@variable.member`
- `@namespace` -> `@module`
- `@float` -> `@number.float`
- `@symbol` -> `@string.special.symbol`
- `@string.regex` -> `@string.regexp`
- `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below)
- `@text.title` -> `@markup.heading`
- `@text.literal` -> `@markup.raw`
- `@text.reference` -> `@markup.link`
- `@text.uri` -> `@markup.link.url` (in markup links)
- `@string.special` -> `@markup.link.label` (non-url links)
- `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`)
* Helix captures
(https://docs.helix-editor.com/master/themes.html#syntax-highlighting):
- `@method` -> `@function.method`
- `@method.call` -> `@function.method.call`
- `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}`
- `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}`
- `@text.uri` -> `@string.special.url` (outside markup)
- `@preproc` -> `@keyword.directive`
- `@define` -> `@keyword.directive`(`.define`?)
- `@storageclass` -> `@keyword.storage`
- `@conditional` -> `@keyword.conditional`
- `@debug` -> `@keyword.debug`
- `@exception` -> `@keyword.exception`
- `@include` -> `@keyword.import`
- `@repeat` -> `@keyword.repeat`
* cleanup
- remove some redundant `@conceal` (but still allow it for conceal-only patterns)
- remove obsolete `@error` (syntax linting is out of scope for this repo)
- sort, cleanup capture list in `CONTRIBUTING.md`
2023-12-24 10:00:20 +01:00
|
|
|
] @keyword.exception
|
2022-03-12 01:11:17 +08:00
|
|
|
|
|
|
|
|
[
|
2023-02-24 07:42:04 -05:00
|
|
|
"return"
|
|
|
|
|
"returns"
|
|
|
|
|
(yul_leave)
|
2022-03-12 01:11:17 +08:00
|
|
|
] @keyword.return
|
|
|
|
|
|
|
|
|
|
"function" @keyword.function
|
|
|
|
|
|
2023-02-24 07:42:04 -05:00
|
|
|
[
|
2024-01-06 15:05:50 +09:00
|
|
|
"import"
|
2023-02-24 07:42:04 -05:00
|
|
|
"using"
|
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
|
2024-01-06 15:05:50 +09:00
|
|
|
|
|
|
|
|
(import_directive
|
|
|
|
|
"as" @keyword.import)
|
|
|
|
|
|
|
|
|
|
(import_directive
|
|
|
|
|
"from" @keyword.import)
|
|
|
|
|
|
|
|
|
|
((import_directive
|
|
|
|
|
source: (string) @string.special.path)
|
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
|
|
|
(#offset! @string.special.path 0 1 0 -1))
|
2022-03-10 19:14:49 +08:00
|
|
|
|
|
|
|
|
; Punctuation
|
2024-01-06 15:05:50 +09:00
|
|
|
[
|
|
|
|
|
"{"
|
|
|
|
|
"}"
|
|
|
|
|
] @punctuation.bracket
|
2022-03-10 19:14:49 +08:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
[
|
|
|
|
|
"["
|
|
|
|
|
"]"
|
|
|
|
|
] @punctuation.bracket
|
2022-03-10 19:14:49 +08:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
[
|
|
|
|
|
"("
|
|
|
|
|
")"
|
|
|
|
|
] @punctuation.bracket
|
2022-03-10 19:14:49 +08:00
|
|
|
|
|
|
|
|
[
|
|
|
|
|
"."
|
|
|
|
|
","
|
2023-04-25 13:09:18 -04:00
|
|
|
":"
|
2023-02-24 07:42:04 -05:00
|
|
|
; FIXME: update grammar
|
|
|
|
|
; (semicolon)
|
|
|
|
|
"->"
|
|
|
|
|
"=>"
|
2022-03-10 19:14:49 +08:00
|
|
|
] @punctuation.delimiter
|
|
|
|
|
|
2024-05-26 11:29:35 +02:00
|
|
|
; Operators
|
|
|
|
|
[
|
|
|
|
|
"&&"
|
|
|
|
|
"||"
|
|
|
|
|
">>"
|
|
|
|
|
"<<"
|
|
|
|
|
"&"
|
|
|
|
|
"^"
|
|
|
|
|
"|"
|
|
|
|
|
"+"
|
|
|
|
|
"-"
|
|
|
|
|
"*"
|
|
|
|
|
"/"
|
|
|
|
|
"%"
|
|
|
|
|
"**"
|
|
|
|
|
"="
|
|
|
|
|
"<"
|
|
|
|
|
"<="
|
|
|
|
|
"=="
|
|
|
|
|
"!="
|
|
|
|
|
">="
|
|
|
|
|
">"
|
|
|
|
|
"!"
|
|
|
|
|
"~"
|
|
|
|
|
"++"
|
|
|
|
|
"--"
|
|
|
|
|
":="
|
|
|
|
|
] @operator
|
|
|
|
|
|
2022-03-11 05:07:26 +08:00
|
|
|
[
|
|
|
|
|
"delete"
|
|
|
|
|
"new"
|
|
|
|
|
] @keyword.operator
|
|
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
(import_directive
|
|
|
|
|
"*" @character.special)
|
2023-02-24 07:42:04 -05:00
|
|
|
|
|
|
|
|
; Comments
|
|
|
|
|
(comment) @comment @spell
|
|
|
|
|
|
2023-03-02 08:06:35 -05:00
|
|
|
((comment) @comment.documentation
|
|
|
|
|
(#lua-match? @comment.documentation "^///[^/]"))
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2023-03-02 08:06:35 -05:00
|
|
|
((comment) @comment.documentation
|
|
|
|
|
(#lua-match? @comment.documentation "^///$"))
|
|
|
|
|
|
|
|
|
|
((comment) @comment.documentation
|
|
|
|
|
(#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$"))
|