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

304 lines
4.6 KiB
Scheme
Raw Permalink Normal View History

(identifier) @variable
(dotted_identifier_list) @string
; Methods
; --------------------
; TODO: add method/call_expression to grammar and
; distinguish method call from variable access
2024-01-06 15:05:50 +09:00
(function_expression_body
(identifier) @function.call)
2024-01-06 15:05:50 +09:00
; ((identifier)(selector (argument_part)) @function)
; NOTE: This query is a bit of a work around for the fact that the dart grammar doesn't
; specifically identify a node as a function call
(((identifier) @function.call
(#lua-match? @function.call "^_?[%l]"))
2024-01-06 15:05:50 +09:00
.
(selector
.
(argument_part))) @function.call
; Annotations
; --------------------
(annotation
"@" @attribute
2020-09-18 16:57:38 +01:00
name: (identifier) @attribute)
2020-08-07 12:29:06 +01:00
; Operators and Tokens
; --------------------
(template_substitution
"$" @punctuation.special
"{" @punctuation.special
2024-01-06 15:05:50 +09:00
"}" @punctuation.special) @none
(template_substitution
"$" @punctuation.special
2024-01-06 15:05:50 +09:00
(identifier_dollar_escaped) @variable) @none
2020-11-15 01:20:07 +01:00
(escape_sequence) @string.escape
[
2024-01-06 15:05:50 +09:00
"=>"
".."
"??"
"=="
"!"
2024-01-06 15:05:50 +09:00
"?"
"&&"
"%"
"<"
">"
"="
">="
"<="
"||"
">>>="
">>="
"<<="
"&="
"|="
"??="
"%="
"+="
"-="
"*="
"/="
"^="
"~/="
(shift_operator)
2024-01-06 15:05:50 +09:00
(multiplicative_operator)
(increment_operator)
(is_operator)
(prefix_operator)
(equality_operator)
(additive_operator)
] @operator
2020-08-07 12:29:06 +01:00
[
"("
")"
"["
"]"
"{"
"}"
2024-01-06 15:05:50 +09:00
] @punctuation.bracket
2020-08-07 12:29:06 +01:00
; Delimiters
; --------------------
2020-08-07 12:29:06 +01:00
[
";"
"."
","
":"
"?."
"?"
2020-08-07 12:29:06 +01:00
] @punctuation.delimiter
; Types
; --------------------
(class_definition
name: (identifier) @type)
2024-01-06 15:05:50 +09:00
(constructor_signature
name: (identifier) @type)
2024-01-06 15:05:50 +09:00
(scoped_identifier
scope: (identifier) @type)
2024-01-06 15:05:50 +09:00
(function_signature
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)
2024-01-06 15:05:50 +09:00
(getter_signature
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) @function.method)
2024-01-06 15:05:50 +09:00
(setter_signature
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)
2024-01-06 15:05:50 +09:00
(enum_declaration
name: (identifier) @type)
2024-01-06 15:05:50 +09:00
(enum_constant
name: (identifier) @type)
2024-01-06 15:05:50 +09:00
(void_type) @type
((scoped_identifier
scope: (identifier) @type
name: (identifier) @type)
2024-01-06 15:05:50 +09:00
(#lua-match? @type "^[%u%l]"))
(type_identifier) @type
(type_alias
(type_identifier) @type.definition)
(type_arguments
[
"<"
">"
] @punctuation.bracket)
; Variables
; --------------------
2020-08-07 12:29:06 +01:00
; var keyword
(inferred_type) @keyword
((identifier) @type
2024-01-06 15:05:50 +09:00
(#lua-match? @type "^_?[%u].*[%l]")) ; catch Classes or IClasses not CLASSES
2024-01-21 22:05:44 +09:00
"Function" @type
; properties
(unconditional_assignable_selector
(identifier) @property)
(conditional_assignable_selector
(identifier) @property)
(this) @variable.builtin
2020-08-07 12:29:06 +01:00
; Parameters
; --------------------
(formal_parameter
(identifier) @variable.parameter)
(named_argument
2024-01-06 15:05:50 +09:00
(label
(identifier) @variable.parameter))
2020-08-07 12:29:06 +01:00
; Literals
; --------------------
2020-08-07 12:29:06 +01:00
[
2024-01-06 15:05:50 +09:00
(hex_integer_literal)
(decimal_integer_literal)
(decimal_floating_point_literal)
; TODO: inaccessible nodes
; (octal_integer_literal)
; (hex_floating_point_literal)
2020-08-07 12:29:06 +01:00
] @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
(symbol_literal) @string.special.symbol
2024-01-06 15:05:50 +09:00
(string_literal) @string
2024-01-06 15:05:50 +09:00
(true) @boolean
2024-01-06 15:05:50 +09:00
(false) @boolean
2024-01-06 15:05:50 +09:00
(null_literal) @constant.builtin
(comment) @comment @spell
2024-01-06 15:05:50 +09:00
(documentation_comment) @comment.documentation @spell
; Keywords
; --------------------
[
"import"
"library"
"export"
"as"
"show"
"hide"
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
; Reserved words (cannot be used as identifiers)
[
2024-01-06 15:05:50 +09:00
; TODO:
; "rethrow" cannot be targeted at all and seems to be an invisible node
; TODO:
; the assert keyword cannot be specifically targeted
; because the grammar selects the whole node or the content
; of the assertion not just the keyword
; assert
(case_builtin)
"late"
"required"
"on"
"extends"
"in"
"is"
"new"
"super"
"with"
2020-08-07 12:29:06 +01:00
] @keyword
2024-04-23 12:23:15 -07:00
[
"class"
"enum"
"extension"
] @keyword.type
2024-01-06 15:05:50 +09:00
"return" @keyword.return
2020-08-09 16:45:50 +01:00
; Built in identifiers:
; alone these are marked as keywords
2020-08-07 12:29:06 +01:00
[
2024-01-06 15:05:50 +09:00
"deferred"
"factory"
"get"
"implements"
"interface"
"library"
"operator"
"mixin"
"part"
"set"
"typedef"
2020-08-07 12:29:06 +01:00
] @keyword
[
"async"
"async*"
"sync*"
"await"
"yield"
] @keyword.coroutine
[
2024-01-06 15:05:50 +09:00
(const_builtin)
(final_builtin)
"abstract"
"covariant"
"external"
"static"
"final"
"base"
"sealed"
] @keyword.modifier
2020-08-09 16:45:50 +01:00
; when used as an identifier:
((identifier) @variable.builtin
(#any-of? @variable.builtin
"abstract" "as" "covariant" "deferred" "dynamic" "export" "external" "factory" "Function" "get"
"implements" "import" "interface" "library" "operator" "mixin" "part" "set" "static" "typedef"))
2024-01-06 15:05:50 +09:00
[
"if"
"else"
"switch"
"default"
] @keyword.conditional
(conditional_expression
[
"?"
":"
] @keyword.conditional.ternary)
[
"try"
"throw"
"catch"
"finally"
(break_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.exception
2024-01-06 15:05:50 +09:00
[
"do"
"while"
"continue"
"for"
] @keyword.repeat