nvim-treesitter/queries/dart/highlights.scm

224 lines
3.7 KiB
Scheme
Raw Normal View History

(dotted_identifier_list) @string
; Methods
; --------------------
2021-03-07 19:17:01 +01:00
;; TODO: does not work
;(function_type
;name: (identifier) @method)
(super) @function
; Annotations
; --------------------
(annotation
2020-09-18 16:57:38 +01:00
name: (identifier) @attribute)
(marker_annotation
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
"}" @punctuation.special
) @none
(template_substitution
"$" @punctuation.special
(identifier_dollar_escaped) @variable
) @none
2020-11-15 01:20:07 +01:00
(escape_sequence) @string.escape
[
"@"
"=>"
".."
"??"
"=="
"?"
":"
"&&"
"%"
"<"
">"
2020-08-07 12:29:06 +01:00
"="
">="
"<="
"||"
(increment_operator)
(is_operator)
(prefix_operator)
(equality_operator)
(additive_operator)
] @operator
2020-08-07 12:29:06 +01:00
[
"("
")"
"["
"]"
"{"
"}"
] @punctuation.bracket
2020-08-07 12:29:06 +01:00
; Delimiters
; --------------------
2020-08-07 12:29:06 +01:00
[
";"
"."
","
] @punctuation.delimiter
; Types
; --------------------
(class_definition
name: (identifier) @type)
(constructor_signature
name: (identifier) @type)
2021-03-07 19:10:15 +01:00
;; TODO: does not work
;(type_identifier
;(identifier) @type)
(scoped_identifier
scope: (identifier) @type)
(function_signature
name: (identifier) @method)
(getter_signature
(identifier) @method)
(setter_signature
name: (identifier) @method)
(enum_declaration
name: (identifier) @type)
(enum_constant
name: (identifier) @type)
(type_identifier) @type
(void_type) @type
((scoped_identifier
scope: (identifier) @type
name: (identifier) @type)
(#match? @type "^[a-zA-Z]"))
(type_identifier) @type
; Variables
; --------------------
2020-08-07 12:29:06 +01:00
; var keyword
(inferred_type) @keyword
(const_builtin) @constant.builtin
(final_builtin) @constant.builtin
((identifier) @type
(#match? @type "^_?[A-Z]"))
("Function" @type)
; properties
; TODO: add method/call_expression to grammar and
; distinguish method call from variable access
(unconditional_assignable_selector
(identifier) @property)
(assignable_selector
(identifier) @property)
; assignments
2020-08-07 12:29:06 +01:00
(assignment_expression
left: (assignable_expression) @variable)
(this) @variable.builtin
2020-08-07 12:29:06 +01:00
; Parameters
; --------------------
(formal_parameter
name: (identifier) @parameter)
(named_argument
2020-09-07 18:14:54 +02:00
(label (identifier) @parameter))
2020-08-07 12:29:06 +01:00
; Literals
; --------------------
2020-08-07 12:29:06 +01:00
[
(hex_integer_literal)
(decimal_integer_literal)
(decimal_floating_point_literal)
; TODO: inaccessbile nodes
; (octal_integer_literal)
; (hex_floating_point_literal)
] @number
(symbol_literal) @symbol
(string_literal) @string
(true) @boolean
(false) @boolean
(null_literal) @constant.builtin
(documentation_comment) @comment
(comment) @comment
; Keywords
; --------------------
["import" "library" "export"] @include
; Reserved words (cannot be used as identifiers)
2020-08-07 12:29:06 +01:00
; TODO: "rethrow" @keyword
[
2020-08-07 12:29:06 +01:00
; "assert"
(case_builtin)
2020-09-26 22:42:06 +01:00
"extension"
"on"
2020-08-07 12:29:06 +01:00
"class"
"enum"
"extends"
"in"
"is"
"new"
"return"
"super"
"with"
] @keyword
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
[
"abstract"
"as"
"async"
"await"
"covariant"
"deferred"
"dynamic"
"external"
"factory"
"get"
"implements"
"interface"
"library"
"operator"
"mixin"
"part"
"set"
"show"
2020-08-07 12:29:06 +01:00
"static"
"typedef"
] @keyword
2020-08-09 16:45:50 +01:00
; when used as an identifier:
((identifier) @variable.builtin
(#vim-match? @variable.builtin "^(abstract|as|covariant|deferred|dynamic|export|external|factory|Function|get|implements|import|interface|library|operator|mixin|part|set|static|typedef)$"))
2020-08-09 16:45:50 +01:00
["if" "else" "switch" "default"] @conditional
[
"try"
"throw"
"catch"
"finally"
(break_statement)
] @exception
["do" "while" "continue" "for"] @repeat
2020-08-07 12:29:06 +01:00
; Error
(ERROR) @error