nvim-treesitter/runtime/queries/odin/highlights.scm

351 lines
4.5 KiB
Scheme
Raw Normal View History

2023-05-11 03:56:12 -04:00
; Preprocs
[
(calling_convention)
(tag)
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-05-11 03:56:12 -04:00
; Includes
[
"import"
"package"
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-11 03:56:12 -04:00
; Keywords
[
"foreign"
"using"
"defer"
"cast"
"transmute"
"auto_cast"
"map"
"bit_set"
"matrix"
] @keyword
2024-04-23 12:23:15 -07:00
[
"struct"
"enum"
"union"
"bit_field"
] @keyword.type
2024-01-06 15:05:50 +09:00
"proc" @keyword.function
2023-05-11 03:56:12 -04:00
[
"return"
"or_return"
] @keyword.return
[
"distinct"
"dynamic"
] @keyword.modifier
2023-05-11 03:56:12 -04:00
; Conditionals
[
"if"
"else"
"when"
"switch"
"case"
"where"
"break"
2024-01-26 12:36:56 -05:00
"or_break"
"or_continue"
2023-05-11 03:56:12 -04:00
(fallthrough_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.conditional
2023-05-11 03:56:12 -04:00
((ternary_expression
[
"?"
":"
"if"
"else"
"when"
feat!: align standard captures with upstream Problem: Sharing highlight queries with upstream tree-sitter and Helix is difficult. Solution: Where reasonable, use capture names in tree-sitter's standard list or Helix's Atom-style hierarchy. Specifically: * tree-sitter "standard capture names" (https://github.com/tree-sitter/tree-sitter/blob/3f44b896852eb7daaa6df4fb778c9bb52c70c815/highlight/src/lib.rs#L20-L72): - `@parameter` -> `@variable.parameter` - `@field` -> `@variable.member` - `@namespace` -> `@module` - `@float` -> `@number.float` - `@symbol` -> `@string.special.symbol` - `@string.regex` -> `@string.regexp` - `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below) - `@text.title` -> `@markup.heading` - `@text.literal` -> `@markup.raw` - `@text.reference` -> `@markup.link` - `@text.uri` -> `@markup.link.url` (in markup links) - `@string.special` -> `@markup.link.label` (non-url links) - `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`) * Helix captures (https://docs.helix-editor.com/master/themes.html#syntax-highlighting): - `@method` -> `@function.method` - `@method.call` -> `@function.method.call` - `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}` - `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}` - `@text.uri` -> `@string.special.url` (outside markup) - `@preproc` -> `@keyword.directive` - `@define` -> `@keyword.directive`(`.define`?) - `@storageclass` -> `@keyword.storage` - `@conditional` -> `@keyword.conditional` - `@debug` -> `@keyword.debug` - `@exception` -> `@keyword.exception` - `@include` -> `@keyword.import` - `@repeat` -> `@keyword.repeat` * cleanup - remove some redundant `@conceal` (but still allow it for conceal-only patterns) - remove obsolete `@error` (syntax linting is out of scope for this repo) - sort, cleanup capture list in `CONTRIBUTING.md`
2023-12-24 10:00:20 +01:00
] @keyword.conditional.ternary)
(#set! priority 105))
2023-05-11 03:56:12 -04:00
; Repeats
[
"for"
"do"
"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
2023-05-11 03:56:12 -04:00
; Variables
(identifier) @variable
; Namespaces
2024-01-06 15:05:50 +09:00
(package_declaration
(identifier) @module)
2023-05-11 03:56:12 -04:00
2024-01-06 15:05:50 +09:00
(import_declaration
alias: (identifier) @module)
2023-05-11 03:56:12 -04:00
2024-01-06 15:05:50 +09:00
(foreign_block
(identifier) @module)
2023-05-11 03:56:12 -04:00
2024-01-06 15:05:50 +09:00
(using_statement
(identifier) @module)
2023-05-11 03:56:12 -04:00
; Parameters
2024-01-06 15:05:50 +09:00
(parameter
(identifier) @variable.parameter
":"
"="?
(identifier)? @constant)
2023-05-11 03:56:12 -04:00
2024-01-06 15:05:50 +09:00
(default_parameter
(identifier) @variable.parameter
":=")
2023-05-11 03:56:12 -04:00
2024-01-06 15:05:50 +09:00
(named_type
(identifier) @variable.parameter)
2023-05-11 03:56:12 -04:00
2024-01-06 15:05:50 +09:00
(call_expression
argument: (identifier) @variable.parameter
"=")
2023-05-11 03:56:12 -04:00
; Functions
2024-01-06 15:05:50 +09:00
(procedure_declaration
(identifier) @type)
2023-05-11 03:56:12 -04:00
2024-01-06 15:05:50 +09:00
(procedure_declaration
(identifier) @function
(procedure
(block)))
2023-05-11 03:56:12 -04:00
2024-01-06 15:05:50 +09:00
(procedure_declaration
(identifier) @function
(procedure
(uninitialized)))
2023-05-11 03:56:12 -04:00
2024-01-06 15:05:50 +09:00
(overloaded_procedure_declaration
(identifier) @function)
2023-05-11 03:56:12 -04:00
2024-01-06 15:05:50 +09:00
(call_expression
function: (identifier) @function.call)
2023-05-11 03:56:12 -04:00
; Types
2024-01-06 15:05:50 +09:00
(type
(identifier) @type)
2023-05-11 03:56:12 -04:00
2024-01-06 15:05:50 +09:00
((type
(identifier) @type.builtin)
(#any-of? @type.builtin
"bool" "byte" "b8" "b16" "b32" "b64" "int" "i8" "i16" "i32" "i64" "i128" "uint" "u8" "u16" "u32"
"u64" "u128" "uintptr" "i16le" "i32le" "i64le" "i128le" "u16le" "u32le" "u64le" "u128le" "i16be"
"i32be" "i64be" "i128be" "u16be" "u32be" "u64be" "u128be" "float" "double" "f16" "f32" "f64"
"f16le" "f32le" "f64le" "f16be" "f32be" "f64be" "complex32" "complex64" "complex128"
"complex_float" "complex_double" "quaternion64" "quaternion128" "quaternion256" "rune" "string"
"cstring" "rawptr" "typeid" "any"))
2023-05-11 03:56:12 -04:00
"..." @type.builtin
2024-01-06 15:05:50 +09:00
(struct_declaration
(identifier) @type
"::")
2023-05-11 03:56:12 -04:00
2024-01-06 15:05:50 +09:00
(enum_declaration
(identifier) @type
"::")
2023-05-11 03:56:12 -04:00
2024-01-06 15:05:50 +09:00
(union_declaration
(identifier) @type
"::")
2023-05-11 03:56:12 -04:00
(bit_field_declaration
(identifier) @type
"::")
2024-01-06 15:05:50 +09:00
(const_declaration
(identifier) @type
"::"
[
(array_type)
(distinct_type)
(bit_set_type)
(pointer_type)
])
(struct
.
(identifier) @type)
(field_type
.
(identifier) @module
"."
(identifier) @type)
2023-05-11 03:56:12 -04:00
2024-01-06 15:05:50 +09:00
(bit_set_type
(identifier) @type
";")
2023-05-11 03:56:12 -04:00
2024-01-06 15:05:50 +09:00
(procedure_type
(parameters
(parameter
(identifier) @type)))
2023-05-11 03:56:12 -04:00
2024-01-06 15:05:50 +09:00
(polymorphic_parameters
(identifier) @type)
2023-05-11 03:56:12 -04:00
((identifier) @type
(#lua-match? @type "^[_A-Z][_a-zA-Z0-9]*$")
(#not-has-parent? @type parameter procedure_declaration call_expression))
2023-05-11 03:56:12 -04:00
; Fields
2024-01-06 15:05:50 +09:00
(member_expression
"."
(identifier) @variable.member)
2023-05-11 03:56:12 -04:00
2024-01-06 15:05:50 +09:00
(struct_type
"{"
(identifier) @variable.member)
2023-05-11 03:56:12 -04:00
2024-01-06 15:05:50 +09:00
(struct_field
(identifier) @variable.member
"="?)
2023-05-11 03:56:12 -04:00
2024-01-06 15:05:50 +09:00
(field
(identifier) @variable.member)
2023-05-11 03:56:12 -04:00
; Constants
((identifier) @constant
(#lua-match? @constant "^_*[A-Z][A-Z0-9_]*$")
(#not-has-parent? @constant type parameter))
2024-01-06 15:05:50 +09:00
(member_expression
.
"."
(identifier) @constant)
2023-05-11 03:56:12 -04:00
2024-01-06 15:05:50 +09:00
(enum_declaration
"{"
(identifier) @constant)
2023-05-11 03:56:12 -04:00
; Macros
2024-01-06 15:05:50 +09:00
((call_expression
function: (identifier) @function.macro)
2023-05-11 03:56:12 -04:00
(#lua-match? @function.macro "^_*[A-Z][A-Z0-9_]*$"))
; Attributes
2024-01-06 15:05:50 +09:00
(attribute
(identifier) @attribute
"="?)
2023-05-11 03:56:12 -04:00
; Labels
2024-01-06 15:05:50 +09:00
(label_statement
(identifier) @label
":")
2023-05-11 03:56:12 -04:00
; Literals
(number) @number
feat!: align standard captures with upstream Problem: Sharing highlight queries with upstream tree-sitter and Helix is difficult. Solution: Where reasonable, use capture names in tree-sitter's standard list or Helix's Atom-style hierarchy. Specifically: * tree-sitter "standard capture names" (https://github.com/tree-sitter/tree-sitter/blob/3f44b896852eb7daaa6df4fb778c9bb52c70c815/highlight/src/lib.rs#L20-L72): - `@parameter` -> `@variable.parameter` - `@field` -> `@variable.member` - `@namespace` -> `@module` - `@float` -> `@number.float` - `@symbol` -> `@string.special.symbol` - `@string.regex` -> `@string.regexp` - `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below) - `@text.title` -> `@markup.heading` - `@text.literal` -> `@markup.raw` - `@text.reference` -> `@markup.link` - `@text.uri` -> `@markup.link.url` (in markup links) - `@string.special` -> `@markup.link.label` (non-url links) - `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`) * Helix captures (https://docs.helix-editor.com/master/themes.html#syntax-highlighting): - `@method` -> `@function.method` - `@method.call` -> `@function.method.call` - `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}` - `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}` - `@text.uri` -> `@string.special.url` (outside markup) - `@preproc` -> `@keyword.directive` - `@define` -> `@keyword.directive`(`.define`?) - `@storageclass` -> `@keyword.storage` - `@conditional` -> `@keyword.conditional` - `@debug` -> `@keyword.debug` - `@exception` -> `@keyword.exception` - `@include` -> `@keyword.import` - `@repeat` -> `@keyword.repeat` * cleanup - remove some redundant `@conceal` (but still allow it for conceal-only patterns) - remove obsolete `@error` (syntax linting is out of scope for this repo) - sort, cleanup capture list in `CONTRIBUTING.md`
2023-12-24 10:00:20 +01:00
(float) @number.float
2023-05-11 03:56:12 -04:00
(string) @string
(character) @character
(escape_sequence) @string.escape
(boolean) @boolean
[
(uninitialized)
(nil)
] @constant.builtin
((identifier) @variable.builtin
(#any-of? @variable.builtin "context" "self"))
; Operators
[
":="
"="
"+"
"-"
"*"
"/"
"%"
"%%"
">"
">="
"<"
"<="
"=="
"!="
"~="
"|"
"~"
"&"
"&~"
"<<"
">>"
"||"
"&&"
"!"
"^"
".."
"+="
"-="
"*="
"/="
"%="
"&="
"|="
"^="
"<<="
">>="
"||="
"&&="
"&~="
"..="
"..<"
"?"
] @operator
[
"or_else"
"in"
"not_in"
] @keyword.operator
; Punctuation
2024-01-06 15:05:50 +09:00
[
"{"
"}"
] @punctuation.bracket
2023-05-11 03:56:12 -04:00
2024-01-06 15:05:50 +09:00
[
"("
")"
] @punctuation.bracket
2023-05-11 03:56:12 -04:00
2024-01-06 15:05:50 +09:00
[
"["
"]"
] @punctuation.bracket
2023-05-11 03:56:12 -04:00
[
"::"
"->"
"."
","
":"
";"
2023-05-11 03:56:12 -04:00
] @punctuation.delimiter
[
"@"
"$"
] @punctuation.special
; Comments
[
(comment)
(block_comment)
] @comment @spell