2024-01-06 15:05:50 +09:00
|
|
|
; Identifiers
|
2022-10-09 23:58:05 -05:00
|
|
|
(identifier) @variable
|
2022-05-24 13:12:29 -05:00
|
|
|
|
2024-11-11 08:39:00 +01:00
|
|
|
(field_expression
|
|
|
|
|
(identifier) @variable.member .)
|
|
|
|
|
|
|
|
|
|
; Symbols
|
2023-07-24 13:51:05 -05:00
|
|
|
(quote_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
|
|
|
":" @string.special.symbol
|
2024-01-06 15:05:50 +09:00
|
|
|
[
|
|
|
|
|
(identifier)
|
|
|
|
|
(operator)
|
|
|
|
|
] @string.special.symbol)
|
2022-10-09 23:58:05 -05:00
|
|
|
|
2024-11-11 08:39:00 +01:00
|
|
|
; Function calls
|
2020-11-09 20:05:34 +01:00
|
|
|
(call_expression
|
2022-07-24 19:34:06 -03:00
|
|
|
(identifier) @function.call)
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2020-11-09 20:05:34 +01:00
|
|
|
(call_expression
|
2024-01-06 15:05:50 +09:00
|
|
|
(field_expression
|
|
|
|
|
(identifier) @function.call .))
|
2022-10-09 23:58:05 -05:00
|
|
|
|
2020-11-09 20:05:34 +01:00
|
|
|
(broadcast_call_expression
|
2022-07-24 19:34:06 -03:00
|
|
|
(identifier) @function.call)
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2020-11-09 20:05:34 +01:00
|
|
|
(broadcast_call_expression
|
2024-01-06 15:05:50 +09:00
|
|
|
(field_expression
|
|
|
|
|
(identifier) @function.call .))
|
2022-10-09 23:58:05 -05:00
|
|
|
|
2023-12-22 21:24:04 +11:00
|
|
|
(binary_expression
|
|
|
|
|
(_)
|
|
|
|
|
(operator) @_pipe
|
|
|
|
|
(identifier) @function.call
|
2024-03-20 17:37:03 +11:00
|
|
|
(#any-of? @_pipe "|>" ".|>"))
|
2023-12-22 21:24:04 +11:00
|
|
|
|
2024-11-11 08:39:00 +01:00
|
|
|
; Macros
|
2024-11-22 23:34:33 +01:00
|
|
|
(macro_identifier
|
|
|
|
|
"@" @function.macro
|
|
|
|
|
(identifier) @function.macro)
|
2024-04-14 07:23:46 -05:00
|
|
|
|
|
|
|
|
(macro_definition
|
|
|
|
|
(signature
|
|
|
|
|
(call_expression
|
|
|
|
|
.
|
|
|
|
|
(identifier) @function.macro)))
|
|
|
|
|
|
2024-11-11 08:39:00 +01:00
|
|
|
; Built-in functions
|
2025-10-17 15:54:28 +02:00
|
|
|
; print.("\"", filter(name -> getglobal(Core, name) isa Core.Builtin, names(Core)), "\" ")
|
2023-03-09 19:53:18 -05:00
|
|
|
((identifier) @function.builtin
|
2024-02-23 17:42:01 +09:00
|
|
|
(#any-of? @function.builtin
|
2025-10-17 15:54:28 +02:00
|
|
|
"applicable" "fieldtype" "getfield" "getglobal" "invoke" "isa" "isdefined" "isdefinedglobal"
|
|
|
|
|
"modifyfield!" "modifyglobal!" "nfields" "replacefield!" "replaceglobal!" "setfield!"
|
|
|
|
|
"setfieldonce!" "setglobal!" "setglobalonce!" "swapfield!" "swapglobal!" "throw" "tuple"
|
|
|
|
|
"typeassert" "typeof"))
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2024-11-11 08:39:00 +01:00
|
|
|
; Type definitions
|
|
|
|
|
(type_head
|
|
|
|
|
(_) @type.definition)
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2024-11-11 08:39:00 +01:00
|
|
|
; Type annotations
|
|
|
|
|
(parametrized_type_expression
|
2024-01-06 15:05:50 +09:00
|
|
|
[
|
|
|
|
|
(identifier) @type
|
|
|
|
|
(field_expression
|
|
|
|
|
(identifier) @type .)
|
2024-11-11 08:39:00 +01:00
|
|
|
]
|
2024-01-06 15:05:50 +09:00
|
|
|
(curly_expression
|
|
|
|
|
(_) @type))
|
2020-11-09 20:05:34 +01:00
|
|
|
|
2022-10-09 23:58:05 -05:00
|
|
|
(typed_expression
|
|
|
|
|
(identifier) @type .)
|
|
|
|
|
|
2024-04-14 07:23:46 -05:00
|
|
|
(unary_typed_expression
|
|
|
|
|
(identifier) @type .)
|
2022-10-09 23:58:05 -05:00
|
|
|
|
2024-11-11 08:39:00 +01:00
|
|
|
(where_expression
|
2024-11-22 16:51:33 +01:00
|
|
|
[
|
|
|
|
|
(curly_expression
|
|
|
|
|
(_) @type)
|
|
|
|
|
(_) @type
|
|
|
|
|
] .)
|
|
|
|
|
|
|
|
|
|
(unary_expression
|
|
|
|
|
(operator) @operator
|
|
|
|
|
(_) @type
|
|
|
|
|
(#any-of? @operator "<:" ">:"))
|
2023-03-09 19:53:08 -05:00
|
|
|
|
2024-11-11 08:39:00 +01:00
|
|
|
(binary_expression
|
|
|
|
|
(_) @type
|
|
|
|
|
(operator) @operator
|
|
|
|
|
(_) @type
|
|
|
|
|
(#any-of? @operator "<:" ">:"))
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2024-11-11 08:39:00 +01:00
|
|
|
; Built-in types
|
2025-10-17 15:54:28 +02:00
|
|
|
; print.("\"", filter(name -> typeof(Base.eval(Core, name)) in [DataType, UnionAll], names(Core)), "\" ")
|
2023-03-09 19:53:18 -05:00
|
|
|
((identifier) @type.builtin
|
2024-01-05 03:19:54 +09:00
|
|
|
(#any-of? @type.builtin
|
2024-11-11 08:39:00 +01:00
|
|
|
"AbstractArray" "AbstractChar" "AbstractFloat" "AbstractString" "Any" "ArgumentError" "Array"
|
2025-10-17 15:54:28 +02:00
|
|
|
"AssertionError" "AtomicMemory" "AtomicMemoryRef" "Bool" "BoundsError" "Char"
|
|
|
|
|
"ConcurrencyViolationError" "Cvoid" "DataType" "DenseArray" "DivideError" "DomainError"
|
|
|
|
|
"ErrorException" "Exception" "Expr" "FieldError" "Float16" "Float32" "Float64" "Function"
|
|
|
|
|
"GenericMemory" "GenericMemoryRef" "GlobalRef" "IO" "InexactError" "InitError" "Int" "Int128"
|
|
|
|
|
"Int16" "Int32" "Int64" "Int8" "Integer" "InterruptException" "LineNumberNode" "LoadError"
|
|
|
|
|
"Memory" "MemoryRef" "Method" "MethodError" "Module" "NTuple" "NamedTuple" "Nothing" "Number"
|
|
|
|
|
"OutOfMemoryError" "OverflowError" "Pair" "Ptr" "QuoteNode" "ReadOnlyMemoryError" "Real" "Ref"
|
|
|
|
|
"SegmentationFault" "Signed" "StackOverflowError" "String" "Symbol" "Task" "Tuple" "Type"
|
|
|
|
|
"TypeError" "TypeVar" "UInt" "UInt128" "UInt16" "UInt32" "UInt64" "UInt8" "UndefInitializer"
|
|
|
|
|
"UndefKeywordError" "UndefRefError" "UndefVarError" "Union" "UnionAll" "Unsigned" "VecElement"
|
|
|
|
|
"WeakRef"))
|
2022-10-09 23:58:05 -05:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
; Keywords
|
2020-11-09 20:05:34 +01:00
|
|
|
[
|
2022-12-14 03:06:08 -05:00
|
|
|
"global"
|
|
|
|
|
"local"
|
2020-11-09 20:05:34 +01:00
|
|
|
] @keyword
|
|
|
|
|
|
2022-11-06 11:03:23 +01:00
|
|
|
(compound_statement
|
2024-01-06 15:05:50 +09:00
|
|
|
[
|
|
|
|
|
"begin"
|
|
|
|
|
"end"
|
|
|
|
|
] @keyword)
|
|
|
|
|
|
2022-10-09 23:58:05 -05:00
|
|
|
(quote_statement
|
2024-01-06 15:05:50 +09:00
|
|
|
[
|
|
|
|
|
"quote"
|
|
|
|
|
"end"
|
|
|
|
|
] @keyword)
|
|
|
|
|
|
2022-10-09 23:58:05 -05:00
|
|
|
(let_statement
|
2024-01-06 15:05:50 +09:00
|
|
|
[
|
|
|
|
|
"let"
|
|
|
|
|
"end"
|
|
|
|
|
] @keyword)
|
2022-10-09 23:58:05 -05:00
|
|
|
|
|
|
|
|
(if_statement
|
2024-01-06 15:05:50 +09:00
|
|
|
[
|
|
|
|
|
"if"
|
|
|
|
|
"end"
|
|
|
|
|
] @keyword.conditional)
|
|
|
|
|
|
2022-10-09 23:58:05 -05:00
|
|
|
(elseif_clause
|
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
|
|
|
"elseif" @keyword.conditional)
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2022-10-09 23:58:05 -05:00
|
|
|
(else_clause
|
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
|
|
|
"else" @keyword.conditional)
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2022-10-09 23:58:05 -05:00
|
|
|
(ternary_expression
|
2024-01-06 15:05:50 +09:00
|
|
|
[
|
|
|
|
|
"?"
|
|
|
|
|
":"
|
|
|
|
|
] @keyword.conditional.ternary)
|
2022-10-09 23:58:05 -05:00
|
|
|
|
2020-11-09 20:05:34 +01:00
|
|
|
(try_statement
|
2024-01-06 15:05:50 +09:00
|
|
|
[
|
|
|
|
|
"try"
|
|
|
|
|
"end"
|
|
|
|
|
] @keyword.exception)
|
|
|
|
|
|
2020-11-09 20:05:34 +01:00
|
|
|
(catch_clause
|
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
|
|
|
"catch" @keyword.exception)
|
2022-10-09 23:58:05 -05:00
|
|
|
|
2024-11-11 08:39:00 +01:00
|
|
|
(finally_clause
|
|
|
|
|
"finally" @keyword.exception)
|
|
|
|
|
|
2020-11-09 20:05:34 +01:00
|
|
|
(for_statement
|
2024-01-06 15:05:50 +09:00
|
|
|
[
|
|
|
|
|
"for"
|
|
|
|
|
"end"
|
|
|
|
|
] @keyword.repeat)
|
|
|
|
|
|
2024-11-11 08:39:00 +01:00
|
|
|
(for_binding
|
|
|
|
|
"outer" @keyword.repeat)
|
|
|
|
|
|
|
|
|
|
; comprehensions
|
|
|
|
|
(for_clause
|
|
|
|
|
"for" @keyword.repeat)
|
|
|
|
|
|
|
|
|
|
(if_clause
|
|
|
|
|
"if" @keyword.conditional)
|
|
|
|
|
|
2020-11-09 20:05:34 +01:00
|
|
|
(while_statement
|
2024-01-06 15:05:50 +09:00
|
|
|
[
|
|
|
|
|
"while"
|
|
|
|
|
"end"
|
|
|
|
|
] @keyword.repeat)
|
|
|
|
|
|
2022-10-09 23:58:05 -05:00
|
|
|
[
|
|
|
|
|
(break_statement)
|
|
|
|
|
(continue_statement)
|
feat!: align standard captures with upstream
Problem: Sharing highlight queries with upstream tree-sitter and
Helix is difficult.
Solution: Where reasonable, use capture names in tree-sitter's standard
list or Helix's Atom-style hierarchy.
Specifically:
* tree-sitter "standard capture names"
(https://github.com/tree-sitter/tree-sitter/blob/3f44b896852eb7daaa6df4fb778c9bb52c70c815/highlight/src/lib.rs#L20-L72):
- `@parameter` -> `@variable.parameter`
- `@field` -> `@variable.member`
- `@namespace` -> `@module`
- `@float` -> `@number.float`
- `@symbol` -> `@string.special.symbol`
- `@string.regex` -> `@string.regexp`
- `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below)
- `@text.title` -> `@markup.heading`
- `@text.literal` -> `@markup.raw`
- `@text.reference` -> `@markup.link`
- `@text.uri` -> `@markup.link.url` (in markup links)
- `@string.special` -> `@markup.link.label` (non-url links)
- `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`)
* Helix captures
(https://docs.helix-editor.com/master/themes.html#syntax-highlighting):
- `@method` -> `@function.method`
- `@method.call` -> `@function.method.call`
- `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}`
- `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}`
- `@text.uri` -> `@string.special.url` (outside markup)
- `@preproc` -> `@keyword.directive`
- `@define` -> `@keyword.directive`(`.define`?)
- `@storageclass` -> `@keyword.storage`
- `@conditional` -> `@keyword.conditional`
- `@debug` -> `@keyword.debug`
- `@exception` -> `@keyword.exception`
- `@include` -> `@keyword.import`
- `@repeat` -> `@keyword.repeat`
* cleanup
- remove some redundant `@conceal` (but still allow it for conceal-only patterns)
- remove obsolete `@error` (syntax linting is out of scope for this repo)
- sort, cleanup capture list in `CONTRIBUTING.md`
2023-12-24 10:00:20 +01:00
|
|
|
] @keyword.repeat
|
2022-10-09 23:58:05 -05:00
|
|
|
|
2024-11-11 08:39:00 +01:00
|
|
|
[
|
|
|
|
|
"const"
|
|
|
|
|
"mutable"
|
|
|
|
|
] @keyword.modifier
|
|
|
|
|
|
|
|
|
|
(function_definition
|
|
|
|
|
[
|
|
|
|
|
"function"
|
|
|
|
|
"end"
|
|
|
|
|
] @keyword.function)
|
|
|
|
|
|
|
|
|
|
(do_clause
|
|
|
|
|
[
|
|
|
|
|
"do"
|
|
|
|
|
"end"
|
|
|
|
|
] @keyword.function)
|
|
|
|
|
|
|
|
|
|
(macro_definition
|
|
|
|
|
[
|
|
|
|
|
"macro"
|
|
|
|
|
"end"
|
|
|
|
|
] @keyword)
|
|
|
|
|
|
|
|
|
|
(return_statement
|
|
|
|
|
"return" @keyword.return)
|
|
|
|
|
|
2022-10-09 23:58:05 -05:00
|
|
|
(module_definition
|
2024-01-06 15:05:50 +09:00
|
|
|
[
|
|
|
|
|
"module"
|
|
|
|
|
"baremodule"
|
|
|
|
|
"end"
|
|
|
|
|
] @keyword.import)
|
|
|
|
|
|
2024-11-11 08:39:00 +01:00
|
|
|
(export_statement
|
|
|
|
|
"export" @keyword.import)
|
|
|
|
|
|
|
|
|
|
(public_statement
|
|
|
|
|
"public" @keyword.import)
|
|
|
|
|
|
2022-10-09 23:58:05 -05:00
|
|
|
(import_statement
|
2024-11-11 08:39:00 +01:00
|
|
|
"import" @keyword.import)
|
|
|
|
|
|
|
|
|
|
(using_statement
|
|
|
|
|
"using" @keyword.import)
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2023-02-02 23:12:23 -05:00
|
|
|
(import_alias
|
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
|
|
|
"as" @keyword.import)
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2023-12-28 17:57:49 +11:00
|
|
|
(selected_import
|
|
|
|
|
":" @punctuation.delimiter)
|
2022-10-09 23:58:05 -05:00
|
|
|
|
2023-09-09 01:01:10 +08:00
|
|
|
(struct_definition
|
2024-01-06 15:05:50 +09:00
|
|
|
[
|
2024-11-11 08:39:00 +01:00
|
|
|
"mutable"
|
2024-01-06 15:05:50 +09:00
|
|
|
"struct"
|
|
|
|
|
"end"
|
2024-04-23 12:23:15 -07:00
|
|
|
] @keyword.type)
|
2023-09-09 01:01:10 +08:00
|
|
|
|
2024-11-11 08:39:00 +01:00
|
|
|
(abstract_definition
|
2024-01-06 15:05:50 +09:00
|
|
|
[
|
2024-11-11 08:39:00 +01:00
|
|
|
"abstract"
|
|
|
|
|
"type"
|
2024-01-06 15:05:50 +09:00
|
|
|
"end"
|
2024-11-11 08:39:00 +01:00
|
|
|
] @keyword.type)
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2024-11-11 08:39:00 +01:00
|
|
|
(primitive_definition
|
2024-01-06 15:05:50 +09:00
|
|
|
[
|
2024-11-11 08:39:00 +01:00
|
|
|
"primitive"
|
|
|
|
|
"type"
|
2024-01-06 15:05:50 +09:00
|
|
|
"end"
|
2024-11-11 08:39:00 +01:00
|
|
|
] @keyword.type)
|
2022-11-20 14:41:51 +02:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
; Operators & Punctuation
|
2024-11-11 08:39:00 +01:00
|
|
|
(operator) @operator
|
2022-02-07 16:16:58 -05:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
(adjoint_expression
|
|
|
|
|
"'" @operator)
|
|
|
|
|
|
|
|
|
|
(range_expression
|
|
|
|
|
":" @operator)
|
2020-11-09 20:05:34 +01:00
|
|
|
|
2024-11-11 08:39:00 +01:00
|
|
|
(arrow_function_expression
|
|
|
|
|
"->" @operator)
|
2022-12-27 04:27:22 -05:00
|
|
|
|
2024-11-11 08:39:00 +01:00
|
|
|
[
|
|
|
|
|
"."
|
|
|
|
|
"..."
|
|
|
|
|
] @punctuation.special
|
2022-12-27 04:27:22 -05:00
|
|
|
|
2023-03-09 19:52:39 -05:00
|
|
|
[
|
|
|
|
|
","
|
|
|
|
|
";"
|
|
|
|
|
"::"
|
|
|
|
|
] @punctuation.delimiter
|
|
|
|
|
|
2024-11-22 16:51:33 +01:00
|
|
|
; Treat `::` as operator in type contexts, see
|
|
|
|
|
; https://github.com/nvim-treesitter/nvim-treesitter/pull/7392
|
|
|
|
|
(typed_expression
|
|
|
|
|
"::" @operator)
|
|
|
|
|
|
|
|
|
|
(unary_typed_expression
|
|
|
|
|
"::" @operator)
|
|
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
[
|
|
|
|
|
"("
|
|
|
|
|
")"
|
|
|
|
|
"["
|
|
|
|
|
"]"
|
|
|
|
|
"{"
|
|
|
|
|
"}"
|
|
|
|
|
] @punctuation.bracket
|
|
|
|
|
|
2024-11-28 21:24:32 +01:00
|
|
|
; Interpolation
|
|
|
|
|
(string_interpolation
|
|
|
|
|
.
|
|
|
|
|
"$" @punctuation.special)
|
|
|
|
|
|
|
|
|
|
(interpolation_expression
|
|
|
|
|
.
|
|
|
|
|
"$" @punctuation.special)
|
|
|
|
|
|
2024-11-11 08:39:00 +01:00
|
|
|
; Keyword operators
|
|
|
|
|
((operator) @keyword.operator
|
|
|
|
|
(#any-of? @keyword.operator "in" "isa"))
|
|
|
|
|
|
|
|
|
|
(where_expression
|
|
|
|
|
"where" @keyword.operator)
|
|
|
|
|
|
|
|
|
|
; Built-in constants
|
|
|
|
|
((identifier) @constant.builtin
|
|
|
|
|
(#any-of? @constant.builtin "nothing" "missing"))
|
|
|
|
|
|
|
|
|
|
((identifier) @variable.builtin
|
|
|
|
|
(#any-of? @variable.builtin "begin" "end")
|
|
|
|
|
(#has-ancestor? @variable.builtin index_expression))
|
|
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
; Literals
|
2022-12-23 04:34:24 -05:00
|
|
|
(boolean_literal) @boolean
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2022-04-15 17:15:51 -05:00
|
|
|
(integer_literal) @number
|
2024-01-06 15:05:50 +09: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
|
2022-04-15 17:15:51 -05: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
|
|
|
((identifier) @number.float
|
2024-01-06 15:05:50 +09:00
|
|
|
(#any-of? @number.float "NaN" "NaN16" "NaN32" "Inf" "Inf16" "Inf32"))
|
2022-04-15 17:15:51 -05:00
|
|
|
|
|
|
|
|
(character_literal) @character
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2022-04-15 17:15:51 -05:00
|
|
|
(escape_sequence) @string.escape
|
|
|
|
|
|
|
|
|
|
(string_literal) @string
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2022-04-15 17:15:51 -05:00
|
|
|
(prefixed_string_literal
|
|
|
|
|
prefix: (identifier) @function.macro) @string
|
|
|
|
|
|
|
|
|
|
(command_literal) @string.special
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2022-04-15 17:15:51 -05:00
|
|
|
(prefixed_command_literal
|
|
|
|
|
prefix: (identifier) @function.macro) @string.special
|
|
|
|
|
|
2024-11-11 08:39:00 +01:00
|
|
|
((string_literal) @string.documentation
|
2024-01-06 15:05:50 +09:00
|
|
|
.
|
|
|
|
|
[
|
|
|
|
|
(abstract_definition)
|
|
|
|
|
(assignment)
|
|
|
|
|
(const_statement)
|
2024-11-11 08:39:00 +01:00
|
|
|
(function_definition)
|
|
|
|
|
(macro_definition)
|
|
|
|
|
(module_definition)
|
|
|
|
|
(struct_definition)
|
2024-01-06 15:05:50 +09:00
|
|
|
])
|
2023-03-01 12:26:26 -05:00
|
|
|
|
2024-12-04 11:50:49 +01:00
|
|
|
(source_file
|
|
|
|
|
(string_literal) @string.documentation
|
|
|
|
|
.
|
2024-12-05 14:47:34 +01:00
|
|
|
[
|
|
|
|
|
(identifier)
|
|
|
|
|
(call_expression)
|
|
|
|
|
])
|
2024-12-04 11:50:49 +01:00
|
|
|
|
2022-04-15 17:15:51 -05:00
|
|
|
[
|
|
|
|
|
(line_comment)
|
|
|
|
|
(block_comment)
|
2023-03-01 12:26:26 -05:00
|
|
|
] @comment @spell
|