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

180 lines
2.2 KiB
Scheme
Raw Permalink Normal View History

(identifier) @variable
2024-01-06 15:05:50 +09:00
(reference_identifier) @variable
2024-01-06 15:05:50 +09:00
(member_identifier) @variable.member
; Classes
(custom_type) @type
2024-01-06 15:05:50 +09:00
(class_field
name: (identifier) @property)
(struct_field
name: (identifier) @property)
2024-01-06 15:05:50 +09:00
(class_definition
name: (identifier) @type)
2024-01-06 15:05:50 +09:00
(struct_definition
name: (identifier) @type)
(interface_definition
name: (identifier) @type)
(method_definition
feat!: align standard captures with upstream Problem: Sharing highlight queries with upstream tree-sitter and Helix is difficult. Solution: Where reasonable, use capture names in tree-sitter's standard list or Helix's Atom-style hierarchy. Specifically: * tree-sitter "standard capture names" (https://github.com/tree-sitter/tree-sitter/blob/3f44b896852eb7daaa6df4fb778c9bb52c70c815/highlight/src/lib.rs#L20-L72): - `@parameter` -> `@variable.parameter` - `@field` -> `@variable.member` - `@namespace` -> `@module` - `@float` -> `@number.float` - `@symbol` -> `@string.special.symbol` - `@string.regex` -> `@string.regexp` - `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below) - `@text.title` -> `@markup.heading` - `@text.literal` -> `@markup.raw` - `@text.reference` -> `@markup.link` - `@text.uri` -> `@markup.link.url` (in markup links) - `@string.special` -> `@markup.link.label` (non-url links) - `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`) * Helix captures (https://docs.helix-editor.com/master/themes.html#syntax-highlighting): - `@method` -> `@function.method` - `@method.call` -> `@function.method.call` - `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}` - `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}` - `@text.uri` -> `@string.special.url` (outside markup) - `@preproc` -> `@keyword.directive` - `@define` -> `@keyword.directive`(`.define`?) - `@storageclass` -> `@keyword.storage` - `@conditional` -> `@keyword.conditional` - `@debug` -> `@keyword.debug` - `@exception` -> `@keyword.exception` - `@include` -> `@keyword.import` - `@repeat` -> `@keyword.repeat` * cleanup - remove some redundant `@conceal` (but still allow it for conceal-only patterns) - remove obsolete `@error` (syntax linting is out of scope for this repo) - sort, cleanup capture list in `CONTRIBUTING.md`
2023-12-24 10:00:20 +01:00
name: (identifier) @function.method)
(json_literal_member
(identifier) @property)
; Functions
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_argument_key) @variable.parameter
(parameter_definition
name: (identifier) @variable.parameter)
(variadic) @variable.parameter.builtin
2024-01-06 15:05:50 +09:00
(call
caller: (reference
(nested_identifier
property: (member_identifier) @function.method.call)))
2024-01-06 15:05:50 +09:00
(call
caller: (reference
(reference_identifier) @function.method.call))
2024-01-06 15:05:50 +09:00
; Primitives
(number) @number
2024-01-06 15:05:50 +09:00
(duration) @constant
2024-01-06 15:05:50 +09:00
(string) @string
2024-01-06 15:05:50 +09:00
(bool) @boolean
2024-01-06 15:05:50 +09:00
[
(builtin_type)
"MutSet"
"MutMap"
"MutArray"
"Json"
"Set"
"Map"
"Array"
"MutJson"
] @type.builtin
2024-01-06 15:05:50 +09:00
(json_container_type) @type.builtin
; Special
2023-09-13 00:25:01 +09:00
(comment) @comment @spell
[
"-"
"-="
"+"
"+="
"*"
"**"
"/"
"%"
"<"
"<="
"="
"=="
"!"
"!="
">"
">="
"&&"
"??"
"||"
"?"
] @operator
[
"("
")"
"{"
"}"
"["
"]"
] @punctuation.bracket
(mutable_container_type
[
"<"
">"
] @punctuation.bracket)
(immutable_container_type
[
"<"
">"
] @punctuation.bracket)
[
";"
"."
","
":"
"=>"
] @punctuation.delimiter
[
"as"
"let"
"new"
(phase_specifier)
"impl"
"test"
] @keyword
2024-01-09 11:50:31 +02:00
"bring" @keyword.import
[
"class"
"struct"
"interface"
] @keyword.type
2024-04-23 12:23:15 -07:00
2024-01-09 11:50:31 +02:00
[
"for"
"in"
] @keyword.repeat
[
"if"
"else"
] @keyword.conditional
2024-04-14 11:53:37 -04:00
[
"pub"
"protected"
"internal"
"extern"
(static)
2024-04-14 11:53:37 -04:00
] @keyword.modifier
2024-01-09 11:50:31 +02:00
"return" @keyword.return
(import_statement
module_name: (identifier) @module)
(import_statement
alias: (identifier) @module)
(call
(reference
(nested_identifier
object: (reference) @_ref
property: (member_identifier) @_ident))
(argument_list
(positional_argument
(string) @string.regexp))
(#eq? @_ref "regex")
(#eq? @_ident "compile")
(#offset! @string.regexp 0 1 0 -1))