mirror of
https://github.com/helix-editor/helix.git
synced 2025-04-03 19:07:44 +03:00
Reverse highlight precedence ordering (#9458)
Co-authored-by: postsolar <120750161+postsolar@users.noreply.github.com> Co-authored-by: Iorvethe <58810330+Iorvethe@users.noreply.github.com> Co-authored-by: Blaž Hrastnik <blaz@mxxn.io> Co-authored-by: gabydd <gabydinnerdavid@gmail.com>
This commit is contained in:
parent
382401020c
commit
5952d564d1
99 changed files with 2304 additions and 1946 deletions
|
@ -38,12 +38,6 @@ below.
|
|||
for more information on writing queries.
|
||||
4. A list of highlight captures can be found [on the themes page](https://docs.helix-editor.com/themes.html#scopes).
|
||||
|
||||
> 💡 In Helix, the first matching query takes precedence when evaluating
|
||||
> queries, which is different from other editors such as Neovim where the last
|
||||
> matching query supersedes the ones before it. See
|
||||
> [this issue](https://github.com/helix-editor/helix/pull/1170#issuecomment-997294090)
|
||||
> for an example.
|
||||
|
||||
## Common issues
|
||||
|
||||
- If you encounter errors when running Helix after switching branches, you may
|
||||
|
|
|
@ -2502,15 +2502,17 @@ impl Iterator for HighlightIter<'_> {
|
|||
}
|
||||
}
|
||||
|
||||
// Once a highlighting pattern is found for the current node, skip over
|
||||
// any later highlighting patterns that also match this node. Captures
|
||||
// Use the last capture found for the current node, skipping over any
|
||||
// highlight patterns that also match this node. Captures
|
||||
// for a given node are ordered by pattern index, so these subsequent
|
||||
// captures are guaranteed to be for highlighting, not injections or
|
||||
// local variables.
|
||||
while let Some((next_match, next_capture_index)) = captures.peek() {
|
||||
let next_capture = next_match.captures[*next_capture_index];
|
||||
if next_capture.node == capture.node {
|
||||
captures.next();
|
||||
match_.remove();
|
||||
capture = next_capture;
|
||||
match_ = captures.next().unwrap().0;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1198,7 +1198,7 @@ indent = { tab-width = 4, unit = " " }
|
|||
|
||||
[[grammar]]
|
||||
name = "julia"
|
||||
source = { git = "https://github.com/tree-sitter/tree-sitter-julia", rev = "8fb38abff74652c4faddbf04d2d5bbbc6b4bae25" }
|
||||
source = { git = "https://github.com/tree-sitter/tree-sitter-julia", rev = "e84f10db8eeb8b9807786bfc658808edaa1b4fa2" }
|
||||
|
||||
[[language]]
|
||||
name = "java"
|
||||
|
@ -2008,7 +2008,7 @@ indent = { tab-width = 4, unit = " " }
|
|||
|
||||
[[grammar]]
|
||||
name = "ron"
|
||||
source = { git = "https://github.com/zee-editor/tree-sitter-ron", rev = "7762d709a0f7c1f9e269d0125a2e8a7a69006146" }
|
||||
source = { git = "https://github.com/tree-sitter-grammars/tree-sitter-ron", rev = "78938553b93075e638035f624973083451b29055" }
|
||||
|
||||
[[language]]
|
||||
name = "robot"
|
||||
|
@ -2499,7 +2499,7 @@ formatter = { command = "cue", args = ["fmt", "-"] }
|
|||
|
||||
[[grammar]]
|
||||
name = "cue"
|
||||
source = { git = "https://github.com/eonpatapon/tree-sitter-cue", rev = "61843e3beebf19417e4fede4e8be4df1084317ad" }
|
||||
source = { git = "https://github.com/eonpatapon/tree-sitter-cue", rev = "8a5f273bfa281c66354da562f2307c2d394b6c81" }
|
||||
|
||||
[[language]]
|
||||
name = "slint"
|
||||
|
|
|
@ -1,32 +1,3 @@
|
|||
; Opening elements
|
||||
; ----------------
|
||||
|
||||
(jsx_opening_element ((identifier) @constructor
|
||||
(#match? @constructor "^[A-Z]")))
|
||||
|
||||
(jsx_opening_element (identifier) @tag)
|
||||
|
||||
; Closing elements
|
||||
; ----------------
|
||||
|
||||
(jsx_closing_element ((identifier) @constructor
|
||||
(#match? @constructor "^[A-Z]")))
|
||||
|
||||
(jsx_closing_element (identifier) @tag)
|
||||
|
||||
; Self-closing elements
|
||||
; ---------------------
|
||||
|
||||
(jsx_self_closing_element ((identifier) @constructor
|
||||
(#match? @constructor "^[A-Z]")))
|
||||
|
||||
(jsx_self_closing_element (identifier) @tag)
|
||||
|
||||
; Attributes
|
||||
; ----------
|
||||
|
||||
(jsx_attribute (property_identifier) @attribute)
|
||||
|
||||
; Punctuation
|
||||
; -----------
|
||||
|
||||
|
@ -41,3 +12,32 @@
|
|||
|
||||
; <Component />
|
||||
(jsx_self_closing_element ["<" "/>"] @punctuation.bracket)
|
||||
|
||||
; Attributes
|
||||
; ----------
|
||||
|
||||
(jsx_attribute (property_identifier) @attribute)
|
||||
|
||||
; Opening elements
|
||||
; ----------------
|
||||
|
||||
(jsx_opening_element (identifier) @tag)
|
||||
|
||||
(jsx_opening_element ((identifier) @constructor
|
||||
(#match? @constructor "^[A-Z]")))
|
||||
|
||||
; Closing elements
|
||||
; ----------------
|
||||
|
||||
(jsx_closing_element (identifier) @tag)
|
||||
|
||||
(jsx_closing_element ((identifier) @constructor
|
||||
(#match? @constructor "^[A-Z]")))
|
||||
|
||||
; Self-closing elements
|
||||
; ---------------------
|
||||
|
||||
(jsx_self_closing_element (identifier) @tag)
|
||||
|
||||
(jsx_self_closing_element ((identifier) @constructor
|
||||
(#match? @constructor "^[A-Z]")))
|
||||
|
|
|
@ -107,9 +107,9 @@
|
|||
; Types
|
||||
; -----
|
||||
|
||||
(type_identifier) @type
|
||||
(type_parameter
|
||||
name: (type_identifier) @type.parameter)
|
||||
(type_identifier) @type
|
||||
(predefined_type) @type.builtin
|
||||
|
||||
; Type arguments and parameters
|
||||
|
@ -133,10 +133,3 @@
|
|||
[
|
||||
(template_literal_type)
|
||||
] @string
|
||||
|
||||
; Tokens
|
||||
; ------
|
||||
|
||||
(template_type
|
||||
"${" @punctuation.special
|
||||
"}" @punctuation.special) @embedded
|
||||
|
|
|
@ -107,14 +107,15 @@
|
|||
(number) @constant.numeric
|
||||
(string) @string
|
||||
|
||||
(func_call name: (identifier) @function)
|
||||
(func_def name: (identifier) @function)
|
||||
|
||||
(field_ref (_) @variable)
|
||||
[
|
||||
(identifier)
|
||||
(field_ref)
|
||||
] @variable
|
||||
|
||||
(func_call name: (identifier) @function)
|
||||
(func_def name: (identifier) @function)
|
||||
|
||||
(field_ref (_) @variable)
|
||||
|
||||
(ns_qualified_name "::" @operator)
|
||||
(ns_qualified_name (namespace) @namespace)
|
||||
|
|
|
@ -48,6 +48,9 @@
|
|||
|
||||
(comment) @comment
|
||||
|
||||
((word) @constant.builtin.boolean
|
||||
(#any-of? @constant.builtin.boolean "true" "false"))
|
||||
|
||||
(function_definition name: (word) @function)
|
||||
|
||||
(file_descriptor) @constant.numeric.integer
|
||||
|
@ -56,7 +59,7 @@
|
|||
(command_substitution)
|
||||
(process_substitution)
|
||||
(expansion)
|
||||
]@embedded
|
||||
] @embedded
|
||||
|
||||
[
|
||||
"$"
|
||||
|
|
|
@ -38,6 +38,17 @@
|
|||
(subpath (slash) @function)
|
||||
|
||||
|
||||
;;; generic highlighting for all forms
|
||||
|
||||
; first symbol in a list form is a combiner call
|
||||
(list . (symbol) @function)
|
||||
|
||||
; highlight symbols as vars only when they're clearly vars
|
||||
(cons (symbol) @variable)
|
||||
(scope (symbol) @variable)
|
||||
(path form: (symbol) @variable)
|
||||
(symbind form: (symbol) @variable)
|
||||
|
||||
|
||||
;;; specific highlighting for builtins & special forms
|
||||
|
||||
|
@ -88,14 +99,3 @@
|
|||
.
|
||||
(_)
|
||||
(symbol) @function)
|
||||
|
||||
;;; generic highlighting for all forms
|
||||
|
||||
; first symbol in a list form is a combiner call
|
||||
(list . (symbol) @function)
|
||||
|
||||
; highlight symbols as vars only when they're clearly vars
|
||||
(cons (symbol) @variable)
|
||||
(scope (symbol) @variable)
|
||||
(path form: (symbol) @variable)
|
||||
(symbind form: (symbol) @variable)
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
|
||||
] @operator
|
||||
|
||||
(variable_expansion [ "${" "}" ] @punctuation.special)
|
||||
[ "(" ")" "{" "}" "[" "]" ] @punctuation.bracket
|
||||
(variable_expansion [ "${" "}" ] @punctuation.special)
|
||||
|
||||
[
|
||||
"noexec"
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
|
||||
(identifier) @variable
|
||||
|
||||
((identifier) @constant
|
||||
(#match? @constant "^[A-Z][A-Z\\d_]*$"))
|
||||
|
||||
"sizeof" @keyword
|
||||
|
||||
[
|
||||
|
@ -109,6 +115,12 @@
|
|||
(char_literal) @constant.character
|
||||
(escape_sequence) @constant.character.escape
|
||||
|
||||
(field_identifier) @variable.other.member
|
||||
(statement_identifier) @label
|
||||
(type_identifier) @type
|
||||
(primitive_type) @type.builtin
|
||||
(sized_type_specifier) @type.builtin
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @function)
|
||||
(call_expression
|
||||
|
@ -128,15 +140,4 @@
|
|||
(attribute
|
||||
name: (identifier) @attribute)
|
||||
|
||||
(field_identifier) @variable.other.member
|
||||
(statement_identifier) @label
|
||||
(type_identifier) @type
|
||||
(primitive_type) @type.builtin
|
||||
(sized_type_specifier) @type.builtin
|
||||
|
||||
((identifier) @constant
|
||||
(#match? @constant "^[A-Z][A-Z\\d_]*$"))
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
(comment) @comment
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
; Preproc
|
||||
|
||||
(unique_id) @keyword.directive
|
||||
(top_level_annotation_body) @keyword.directive
|
||||
[
|
||||
(unique_id)
|
||||
(top_level_annotation_body)
|
||||
] @keyword.directive
|
||||
|
||||
; Includes
|
||||
|
||||
|
@ -9,6 +11,7 @@
|
|||
"import"
|
||||
"$import"
|
||||
"embed"
|
||||
"using"
|
||||
] @keyword.control.import
|
||||
|
||||
(import_path) @string
|
||||
|
@ -84,10 +87,10 @@
|
|||
"union"
|
||||
] @keyword.storage.type
|
||||
|
||||
"extends" @keyword
|
||||
|
||||
[
|
||||
"extends"
|
||||
"namespace"
|
||||
"using"
|
||||
(annotation_target)
|
||||
] @special
|
||||
|
||||
|
|
|
@ -22,16 +22,10 @@
|
|||
"in"
|
||||
] @keyword
|
||||
|
||||
; Function calls
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @function)
|
||||
|
||||
(member_call_expression
|
||||
function: (identifier) @function)
|
||||
|
||||
; Identifiers
|
||||
|
||||
(identifier) @variable.other.member
|
||||
|
||||
(select_expression
|
||||
operand: (identifier) @type)
|
||||
|
||||
|
@ -39,7 +33,13 @@
|
|||
operand: (select_expression
|
||||
member: (identifier) @type))
|
||||
|
||||
(identifier) @variable.other.member
|
||||
; Function calls
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @function)
|
||||
|
||||
(member_call_expression
|
||||
function: (identifier) @function)
|
||||
|
||||
; Literals
|
||||
|
||||
|
|
|
@ -10,6 +10,14 @@
|
|||
|
||||
(comment) @comment
|
||||
|
||||
;; other symbols
|
||||
(sym_lit) @variable
|
||||
|
||||
;; other calls
|
||||
(list_lit
|
||||
.
|
||||
(sym_lit) @function)
|
||||
|
||||
;; metadata experiment
|
||||
(meta_lit
|
||||
marker: "^" @punctuation)
|
||||
|
@ -61,20 +69,12 @@
|
|||
((sym_lit) @operator
|
||||
(#match? @operator "^%"))
|
||||
|
||||
;; other calls
|
||||
(list_lit
|
||||
.
|
||||
(sym_lit) @function)
|
||||
|
||||
;; interop-ish
|
||||
(list_lit
|
||||
.
|
||||
(sym_lit) @function.method
|
||||
(#match? @function.method "^\\."))
|
||||
|
||||
;; other symbols
|
||||
(sym_lit) @variable
|
||||
|
||||
;; quote
|
||||
(quoting_lit) @constant.character.escape
|
||||
|
||||
|
|
|
@ -1,35 +1,35 @@
|
|||
; Hint level tags
|
||||
((tag (name) @hint)
|
||||
(#match? @hint "^(HINT|MARK|PASSED|STUB|MOCK)$"))
|
||||
|
||||
("text" @hint
|
||||
(#match? @hint "^(HINT|MARK|PASSED|STUB|MOCK)$"))
|
||||
|
||||
; Info level tags
|
||||
((tag (name) @info)
|
||||
(#match? @info "^(INFO|NOTE|TODO|PERF|OPTIMIZE|PERFORMANCE|QUESTION|ASK)$"))
|
||||
|
||||
("text" @info
|
||||
(#match? @info "^(INFO|NOTE|TODO|PERF|OPTIMIZE|PERFORMANCE|QUESTION|ASK)$"))
|
||||
|
||||
; Warning level tags
|
||||
((tag (name) @warning)
|
||||
(#match? @warning "^(HACK|WARN|WARNING|TEST|TEMP)$"))
|
||||
|
||||
("text" @warning
|
||||
(#match? @warning "^(HACK|WARN|WARNING|TEST|TEMP)$"))
|
||||
|
||||
; Error level tags
|
||||
((tag (name) @error)
|
||||
(#match? @error "^(BUG|FIXME|ISSUE|XXX|FIX|SAFETY|FIXIT|FAILED|DEBUG|INVARIANT|COMPLIANCE)$"))
|
||||
|
||||
("text" @error
|
||||
(#match? @error "^(BUG|FIXME|ISSUE|XXX|FIX|SAFETY|FIXIT|FAILED|DEBUG|INVARIANT|COMPLIANCE)$"))
|
||||
|
||||
(tag
|
||||
(name) @ui.text
|
||||
(user)? @constant)
|
||||
|
||||
; Hint level tags
|
||||
((tag (name) @hint)
|
||||
(#any-of? @hint "HINT" "MARK" "PASSED" "STUB" "MOCK"))
|
||||
|
||||
("text" @hint
|
||||
(#any-of? @hint "HINT" "MARK" "PASSED" "STUB" "MOCK"))
|
||||
|
||||
; Info level tags
|
||||
((tag (name) @info)
|
||||
(#any-of? @info "INFO" "NOTE" "TODO" "PERF" "OPTIMIZE" "PERFORMANCE" "QUESTION" "ASK"))
|
||||
|
||||
("text" @info
|
||||
(#any-of? @info "INFO" "NOTE" "TODO" "PERF" "OPTIMIZE" "PERFORMANCE" "QUESTION" "ASK"))
|
||||
|
||||
; Warning level tags
|
||||
((tag (name) @warning)
|
||||
(#any-of? @warning "HACK" "WARN" "WARNING" "TEST" "TEMP"))
|
||||
|
||||
("text" @warning
|
||||
(#any-of? @warning "HACK" "WARN" "WARNING" "TEST" "TEMP"))
|
||||
|
||||
; Error level tags
|
||||
((tag (name) @error)
|
||||
(#any-of? @error "BUG" "FIXME" "ISSUE" "XXX" "FIX" "SAFETY" "FIXIT" "FAILED" "DEBUG" "INVARIANT" "COMPLIANCE"))
|
||||
|
||||
("text" @error
|
||||
(#any-of? @error "BUG" "FIXME" "ISSUE" "XXX" "FIX" "SAFETY" "FIXIT" "FAILED" "DEBUG" "INVARIANT" "COMPLIANCE"))
|
||||
|
||||
; Issue number (#123)
|
||||
("text" @constant.numeric
|
||||
(#match? @constant.numeric "^#[0-9]+$"))
|
||||
|
|
|
@ -1,3 +1,26 @@
|
|||
; inherits: c
|
||||
|
||||
; Constants
|
||||
|
||||
(this) @variable.builtin
|
||||
(nullptr) @constant.builtin
|
||||
|
||||
; Types
|
||||
|
||||
(using_declaration ("using" "namespace" (identifier) @namespace))
|
||||
(using_declaration ("using" "namespace" (qualified_identifier name: (identifier) @namespace)))
|
||||
(namespace_definition name: (namespace_identifier) @namespace)
|
||||
(namespace_identifier) @namespace
|
||||
|
||||
(qualified_identifier name: (identifier) @type.enum.variant)
|
||||
|
||||
(auto) @type
|
||||
"decltype" @type
|
||||
|
||||
(ref_qualifier ["&" "&&"] @type.builtin)
|
||||
(reference_declarator ["&" "&&"] @type.builtin)
|
||||
(abstract_reference_declarator ["&" "&&"] @type.builtin)
|
||||
|
||||
; Functions
|
||||
|
||||
; These casts are parsed as function calls, but are not.
|
||||
|
@ -28,27 +51,6 @@
|
|||
(function_declarator
|
||||
declarator: (field_identifier) @function)
|
||||
|
||||
; Types
|
||||
|
||||
(using_declaration ("using" "namespace" (identifier) @namespace))
|
||||
(using_declaration ("using" "namespace" (qualified_identifier name: (identifier) @namespace)))
|
||||
(namespace_definition name: (namespace_identifier) @namespace)
|
||||
(namespace_identifier) @namespace
|
||||
|
||||
(qualified_identifier name: (identifier) @type.enum.variant)
|
||||
|
||||
(auto) @type
|
||||
"decltype" @type
|
||||
|
||||
(ref_qualifier ["&" "&&"] @type.builtin)
|
||||
(reference_declarator ["&" "&&"] @type.builtin)
|
||||
(abstract_reference_declarator ["&" "&&"] @type.builtin)
|
||||
|
||||
; Constants
|
||||
|
||||
(this) @variable.builtin
|
||||
(nullptr) @constant.builtin
|
||||
|
||||
; Parameters
|
||||
|
||||
(parameter_declaration
|
||||
|
@ -132,5 +134,3 @@
|
|||
; Strings
|
||||
|
||||
(raw_string_literal) @string
|
||||
|
||||
; inherits: c
|
||||
|
|
|
@ -28,6 +28,9 @@
|
|||
"or"
|
||||
] @keyword.operator
|
||||
|
||||
(property_name) @variable.other.member
|
||||
(plain_value) @constant
|
||||
|
||||
((property_name) @variable
|
||||
(#match? @variable "^--"))
|
||||
((plain_value) @variable
|
||||
|
@ -39,7 +42,6 @@
|
|||
(function_name) @function
|
||||
(id_name) @label
|
||||
(namespace_name) @namespace
|
||||
(property_name) @variable.other.member
|
||||
|
||||
[
|
||||
"@charset"
|
||||
|
@ -81,5 +83,3 @@
|
|||
":"
|
||||
"::"
|
||||
] @punctuation.delimiter
|
||||
|
||||
(plain_value) @constant
|
||||
|
|
|
@ -1,12 +1,46 @@
|
|||
(package_clause "package" @keyword.control.import)
|
||||
; Includes
|
||||
[
|
||||
"package"
|
||||
"import"
|
||||
] @keyword.control.import
|
||||
|
||||
(package_identifier) @variable
|
||||
; Namespaces
|
||||
(package_identifier) @namespace
|
||||
|
||||
(import_declaration "import" @keyword.control.import)
|
||||
(import_spec
|
||||
[
|
||||
"."
|
||||
"_"
|
||||
] @punctuation.special)
|
||||
|
||||
[
|
||||
"!"
|
||||
(attr_path)
|
||||
(package_path)
|
||||
] @string.special.url ; In attributes
|
||||
|
||||
; Attributes
|
||||
(attribute) @attribute
|
||||
|
||||
; Conditionals
|
||||
"if" @keyword.control.conditional
|
||||
|
||||
; Repeats
|
||||
"for" @keyword.control.repeat
|
||||
|
||||
(for_clause
|
||||
"_" @punctuation.special)
|
||||
|
||||
; Keywords
|
||||
"let" @keyword
|
||||
|
||||
"in" @keyword.operator
|
||||
|
||||
; Operators
|
||||
[
|
||||
"+"
|
||||
"-"
|
||||
"*"
|
||||
"/"
|
||||
"|"
|
||||
"&"
|
||||
"||"
|
||||
|
@ -19,92 +53,103 @@
|
|||
">="
|
||||
"=~"
|
||||
"!~"
|
||||
"+"
|
||||
"-"
|
||||
"*"
|
||||
"/"
|
||||
"!"
|
||||
"="
|
||||
] @operator
|
||||
|
||||
(unary_expression "*" @operator.default)
|
||||
; Fields & Properties
|
||||
(field
|
||||
(label
|
||||
(identifier) @variable.other.member))
|
||||
|
||||
(unary_expression "=~" @operator.regexp)
|
||||
(selector_expression
|
||||
(_)
|
||||
(identifier) @variable.other.member)
|
||||
|
||||
(unary_expression "!~" @operator.regexp)
|
||||
; Functions
|
||||
(call_expression
|
||||
function: (identifier) @function)
|
||||
|
||||
(binary_expression _ "&" @operator.unify _)
|
||||
(call_expression
|
||||
function: (selector_expression
|
||||
(_)
|
||||
(identifier) @function))
|
||||
|
||||
(binary_expression _ "|" @operator.disjunct _)
|
||||
(call_expression
|
||||
function: (builtin_function) @function)
|
||||
|
||||
(builtin) @function.builtin
|
||||
(builtin_function) @function.builtin
|
||||
|
||||
(qualified_identifier) @function.builtin
|
||||
; Variables
|
||||
(identifier) @variable
|
||||
|
||||
(let_clause "let" @keyword.storage.type)
|
||||
; Types
|
||||
(primitive_type) @type.builtin
|
||||
|
||||
(for_clause "for" @keyword.control.repeat)
|
||||
(for_clause "in" @keyword.control.repeat)
|
||||
|
||||
(guard_clause "if" @keyword.control.conditional)
|
||||
|
||||
(comment) @comment
|
||||
((identifier) @type
|
||||
(#match? @type "^_?#"))
|
||||
|
||||
[
|
||||
(string_type)
|
||||
(simple_string_lit)
|
||||
(multiline_string_lit)
|
||||
(bytes_type)
|
||||
(simple_bytes_lit)
|
||||
(multiline_bytes_lit)
|
||||
] @string
|
||||
|
||||
[
|
||||
(number_type)
|
||||
(int_lit)
|
||||
(int_type)
|
||||
(uint_type)
|
||||
] @constant.numeric.integer
|
||||
|
||||
[
|
||||
(float_lit)
|
||||
(float_type)
|
||||
] @constant.numeric.float
|
||||
|
||||
[
|
||||
(bool_type)
|
||||
(true)
|
||||
(false)
|
||||
] @constant.builtin.boolean
|
||||
|
||||
(null) @constant.builtin
|
||||
|
||||
(ellipsis) @punctuation.bracket
|
||||
(slice_type)
|
||||
(pointer_type)
|
||||
] @type ; In attributes
|
||||
|
||||
; Punctuation
|
||||
[
|
||||
","
|
||||
":"
|
||||
] @punctuation.delimiter
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
"["
|
||||
"]"
|
||||
"("
|
||||
")"
|
||||
"<"
|
||||
">"
|
||||
] @punctuation.bracket
|
||||
|
||||
(interpolation "\\(" @punctuation.bracket (_) ")" @punctuation.bracket) @variable.other.member
|
||||
[
|
||||
(ellipsis)
|
||||
"?"
|
||||
] @punctuation.special
|
||||
|
||||
(field (label (identifier) @variable.other.member))
|
||||
; Literals
|
||||
(string) @string
|
||||
|
||||
(
|
||||
(identifier) @keyword.storage.type
|
||||
(#match? @keyword.storage.type "^#")
|
||||
)
|
||||
[
|
||||
(escape_char)
|
||||
(escape_unicode)
|
||||
] @constant.character.escape
|
||||
|
||||
(field (label alias: (identifier) @label))
|
||||
(number) @constant.numeric
|
||||
|
||||
(let_clause left: (identifier) @label)
|
||||
(float) @constant.numeric.float
|
||||
|
||||
(si_unit
|
||||
(float)
|
||||
(_) @string.special.symbol)
|
||||
|
||||
(attribute (identifier) @tag)
|
||||
(boolean) @constant.builtin.boolean
|
||||
|
||||
[
|
||||
(null)
|
||||
(top)
|
||||
(bottom)
|
||||
] @constant.builtin
|
||||
|
||||
; Interpolations
|
||||
(interpolation
|
||||
"\\(" @punctuation.special
|
||||
(_)
|
||||
")" @punctuation.special)
|
||||
|
||||
(interpolation
|
||||
"\\("
|
||||
(identifier) @variable
|
||||
")")
|
||||
|
||||
; Comments
|
||||
(comment) @comment
|
||||
|
|
|
@ -217,6 +217,8 @@
|
|||
(cfloat)
|
||||
] @warning ; these types are deprecated
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
(label (identifier) @label)
|
||||
(goto_statement (goto) @keyword (identifier) @label)
|
||||
|
||||
|
@ -224,7 +226,6 @@
|
|||
(int_literal) @constant.numeric.integer
|
||||
(float_literal) @constant.numeric.float
|
||||
(char_literal) @constant.character
|
||||
(identifier) @variable
|
||||
(at_attribute) @attribute
|
||||
|
||||
; everything after __EOF_ is plain text
|
||||
|
|
|
@ -51,14 +51,14 @@
|
|||
|
||||
(integer_literal) @constant.numeric.integer
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @function)
|
||||
|
||||
(labeled_item
|
||||
label: (identifier) @label)
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
(unit_address) @tag
|
||||
|
||||
(reference) @constant
|
||||
|
|
|
@ -44,6 +44,15 @@
|
|||
(heredoc_line)
|
||||
] @string
|
||||
|
||||
[
|
||||
(heredoc_marker)
|
||||
(heredoc_end)
|
||||
] @label
|
||||
|
||||
((heredoc_block
|
||||
(heredoc_line) @string)
|
||||
(#set! "priority" 90))
|
||||
|
||||
(expansion
|
||||
[
|
||||
"$"
|
||||
|
@ -59,3 +68,6 @@
|
|||
(param)
|
||||
(mount_param)
|
||||
] @constant
|
||||
|
||||
(expose_instruction
|
||||
(expose_port) @constant.numeric.integer)
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
(identifier) @variable
|
||||
|
||||
(keyword) @keyword
|
||||
(string_literal) @string
|
||||
(number_literal) @constant.numeric
|
||||
|
@ -33,11 +35,9 @@
|
|||
(identifier) @constant)
|
||||
)
|
||||
|
||||
[
|
||||
(comment)
|
||||
(preproc)
|
||||
] @comment
|
||||
(comment) @comment
|
||||
|
||||
(preproc) @keyword.directive
|
||||
|
||||
(ERROR) @error
|
||||
|
||||
(identifier) @variable
|
||||
|
|
|
@ -1,148 +1,6 @@
|
|||
; Special identifiers
|
||||
;--------------------
|
||||
|
||||
([
|
||||
(identifier)
|
||||
(shorthand_property_identifier)
|
||||
(shorthand_property_identifier_pattern)
|
||||
] @constant
|
||||
(#match? @constant "^[A-Z_][A-Z\\d_]+$"))
|
||||
|
||||
|
||||
((identifier) @constructor
|
||||
(#match? @constructor "^[A-Z]"))
|
||||
|
||||
((identifier) @variable.builtin
|
||||
(#match? @variable.builtin "^(arguments|module|console|window|document)$")
|
||||
(#is-not? local))
|
||||
|
||||
(call_expression
|
||||
(identifier) @function.builtin
|
||||
(#any-of? @function.builtin
|
||||
"eval"
|
||||
"fetch"
|
||||
"isFinite"
|
||||
"isNaN"
|
||||
"parseFloat"
|
||||
"parseInt"
|
||||
"decodeURI"
|
||||
"decodeURIComponent"
|
||||
"encodeURI"
|
||||
"encodeURIComponent"
|
||||
"require"
|
||||
"alert"
|
||||
"prompt"
|
||||
"btoa"
|
||||
"atob"
|
||||
"confirm"
|
||||
"structuredClone"
|
||||
"setTimeout"
|
||||
"clearTimeout"
|
||||
"setInterval"
|
||||
"clearInterval"
|
||||
"queueMicrotask")
|
||||
(#is-not? local))
|
||||
|
||||
; Function and method definitions
|
||||
;--------------------------------
|
||||
|
||||
(function
|
||||
name: (identifier) @function)
|
||||
(function_declaration
|
||||
name: (identifier) @function)
|
||||
(method_definition
|
||||
name: (property_identifier) @function.method)
|
||||
(method_definition
|
||||
name: (private_property_identifier) @function.method.private)
|
||||
|
||||
(pair
|
||||
key: (property_identifier) @function.method
|
||||
value: [(function) (arrow_function)])
|
||||
(pair
|
||||
key: (private_property_identifier) @function.method.private
|
||||
value: [(function) (arrow_function)])
|
||||
|
||||
(assignment_expression
|
||||
left: (member_expression
|
||||
property: (property_identifier) @function.method)
|
||||
right: [(function) (arrow_function)])
|
||||
(assignment_expression
|
||||
left: (member_expression
|
||||
property: (private_property_identifier) @function.method.private)
|
||||
right: [(function) (arrow_function)])
|
||||
|
||||
(variable_declarator
|
||||
name: (identifier) @function
|
||||
value: [(function) (arrow_function)])
|
||||
|
||||
(assignment_expression
|
||||
left: (identifier) @function
|
||||
right: [(function) (arrow_function)])
|
||||
|
||||
; Function and method parameters
|
||||
;-------------------------------
|
||||
|
||||
; Arrow function parameters in the form `p => ...` are supported by both
|
||||
; javascript and typescript grammars without conflicts.
|
||||
(arrow_function
|
||||
parameter: (identifier) @variable.parameter)
|
||||
|
||||
; Function and method calls
|
||||
;--------------------------
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @function)
|
||||
|
||||
(call_expression
|
||||
function: (member_expression
|
||||
property: (property_identifier) @function.method))
|
||||
(call_expression
|
||||
function: (member_expression
|
||||
property: (private_property_identifier) @function.method.private))
|
||||
|
||||
; Variables
|
||||
;----------
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
; Properties
|
||||
;-----------
|
||||
|
||||
(property_identifier) @variable.other.member
|
||||
(private_property_identifier) @variable.other.member.private
|
||||
(shorthand_property_identifier) @variable.other.member
|
||||
(shorthand_property_identifier_pattern) @variable.other.member
|
||||
|
||||
; Literals
|
||||
;---------
|
||||
|
||||
(this) @variable.builtin
|
||||
(super) @variable.builtin
|
||||
|
||||
[
|
||||
(true)
|
||||
(false)
|
||||
(null)
|
||||
(undefined)
|
||||
] @constant.builtin
|
||||
|
||||
(comment) @comment
|
||||
|
||||
[
|
||||
(string)
|
||||
(template_string)
|
||||
] @string
|
||||
|
||||
(regex) @string.regexp
|
||||
(number) @constant.numeric.integer
|
||||
|
||||
; Tokens
|
||||
;-------
|
||||
|
||||
(template_substitution
|
||||
"${" @punctuation.special
|
||||
"}" @punctuation.special) @embedded
|
||||
|
||||
[
|
||||
";"
|
||||
(optional_chain) ; ?.
|
||||
|
@ -209,6 +67,10 @@
|
|||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
(template_substitution
|
||||
"${" @punctuation.special
|
||||
"}" @punctuation.special) @embedded
|
||||
|
||||
[
|
||||
"async"
|
||||
"debugger"
|
||||
|
@ -283,3 +145,139 @@
|
|||
"catch"
|
||||
] @keyword.control.exception
|
||||
|
||||
; Variables
|
||||
;----------
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
; Properties
|
||||
;-----------
|
||||
|
||||
(property_identifier) @variable.other.member
|
||||
(private_property_identifier) @variable.other.member.private
|
||||
(shorthand_property_identifier) @variable.other.member
|
||||
(shorthand_property_identifier_pattern) @variable.other.member
|
||||
|
||||
; Function and method definitions
|
||||
;--------------------------------
|
||||
|
||||
(function
|
||||
name: (identifier) @function)
|
||||
(function_declaration
|
||||
name: (identifier) @function)
|
||||
(method_definition
|
||||
name: (property_identifier) @function.method)
|
||||
(method_definition
|
||||
name: (private_property_identifier) @function.method.private)
|
||||
|
||||
(pair
|
||||
key: (property_identifier) @function.method
|
||||
value: [(function) (arrow_function)])
|
||||
(pair
|
||||
key: (private_property_identifier) @function.method.private
|
||||
value: [(function) (arrow_function)])
|
||||
|
||||
(assignment_expression
|
||||
left: (member_expression
|
||||
property: (property_identifier) @function.method)
|
||||
right: [(function) (arrow_function)])
|
||||
(assignment_expression
|
||||
left: (member_expression
|
||||
property: (private_property_identifier) @function.method.private)
|
||||
right: [(function) (arrow_function)])
|
||||
|
||||
(variable_declarator
|
||||
name: (identifier) @function
|
||||
value: [(function) (arrow_function)])
|
||||
|
||||
(assignment_expression
|
||||
left: (identifier) @function
|
||||
right: [(function) (arrow_function)])
|
||||
|
||||
; Function and method parameters
|
||||
;-------------------------------
|
||||
|
||||
; Arrow function parameters in the form `p => ...` are supported by both
|
||||
; javascript and typescript grammars without conflicts.
|
||||
(arrow_function
|
||||
parameter: (identifier) @variable.parameter)
|
||||
|
||||
; Function and method calls
|
||||
;--------------------------
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @function)
|
||||
|
||||
(call_expression
|
||||
function: (member_expression
|
||||
property: (property_identifier) @function.method))
|
||||
(call_expression
|
||||
function: (member_expression
|
||||
property: (private_property_identifier) @function.method.private))
|
||||
|
||||
; Literals
|
||||
;---------
|
||||
|
||||
(this) @variable.builtin
|
||||
(super) @variable.builtin
|
||||
|
||||
[
|
||||
(true)
|
||||
(false)
|
||||
(null)
|
||||
(undefined)
|
||||
] @constant.builtin
|
||||
|
||||
(comment) @comment
|
||||
|
||||
[
|
||||
(string)
|
||||
(template_string)
|
||||
] @string
|
||||
|
||||
(regex) @string.regexp
|
||||
(number) @constant.numeric.integer
|
||||
|
||||
; Special identifiers
|
||||
;--------------------
|
||||
|
||||
((identifier) @constructor
|
||||
(#match? @constructor "^[A-Z]"))
|
||||
|
||||
([
|
||||
(identifier)
|
||||
(shorthand_property_identifier)
|
||||
(shorthand_property_identifier_pattern)
|
||||
] @constant
|
||||
(#match? @constant "^[A-Z_][A-Z\\d_]+$"))
|
||||
|
||||
((identifier) @variable.builtin
|
||||
(#match? @variable.builtin "^(arguments|module|console|window|document)$")
|
||||
(#is-not? local))
|
||||
|
||||
(call_expression
|
||||
(identifier) @function.builtin
|
||||
(#any-of? @function.builtin
|
||||
"eval"
|
||||
"fetch"
|
||||
"isFinite"
|
||||
"isNaN"
|
||||
"parseFloat"
|
||||
"parseInt"
|
||||
"decodeURI"
|
||||
"decodeURIComponent"
|
||||
"encodeURI"
|
||||
"encodeURIComponent"
|
||||
"require"
|
||||
"alert"
|
||||
"prompt"
|
||||
"btoa"
|
||||
"atob"
|
||||
"confirm"
|
||||
"structuredClone"
|
||||
"setTimeout"
|
||||
"clearTimeout"
|
||||
"setInterval"
|
||||
"clearInterval"
|
||||
"queueMicrotask")
|
||||
(#is-not? local))
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
(section_marker) @markup.heading.marker)
|
||||
(#eq? @markup.heading.marker "===="))
|
||||
|
||||
(macro (tag) @function.macro)
|
||||
(tag) @keyword
|
||||
(macro (tag) @function.macro)
|
||||
(macro_escape) @constant.character.escape
|
||||
(inline_quote) @markup.raw.inline
|
||||
(email_address) @markup.link.url
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
"while"
|
||||
] @keyword
|
||||
|
||||
(string) @string
|
||||
|
||||
;; Function definitions
|
||||
[
|
||||
"defun"
|
||||
|
@ -47,8 +49,6 @@
|
|||
(float) @constant.numeric.float
|
||||
(char) @constant.character
|
||||
|
||||
(string) @string
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
|
|
|
@ -15,40 +15,167 @@
|
|||
; See the License for the specific language governing permissions and
|
||||
; limitations under the License.
|
||||
|
||||
; Reserved keywords
|
||||
; Punctuation
|
||||
|
||||
["when" "and" "or" "not" "in" "not in" "fn" "do" "end" "catch" "rescue" "after" "else"] @keyword
|
||||
[
|
||||
"%"
|
||||
] @punctuation
|
||||
|
||||
[
|
||||
","
|
||||
";"
|
||||
] @punctuation.delimiter
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
"<<"
|
||||
">>"
|
||||
] @punctuation.bracket
|
||||
|
||||
; Literals
|
||||
|
||||
(boolean) @constant.builtin.boolean
|
||||
(nil) @constant.builtin
|
||||
(integer) @constant.numeric.integer
|
||||
(float) @constant.numeric.float
|
||||
(char) @constant.character
|
||||
|
||||
; Identifiers
|
||||
|
||||
; * regular
|
||||
(identifier) @variable
|
||||
|
||||
; * unused
|
||||
(
|
||||
(identifier) @comment.unused
|
||||
(#match? @comment.unused "^_")
|
||||
)
|
||||
|
||||
; * special
|
||||
(
|
||||
(identifier) @constant.builtin
|
||||
(#any-of? @constant.builtin "__MODULE__" "__DIR__" "__ENV__" "__CALLER__" "__STACKTRACE__")
|
||||
)
|
||||
|
||||
; Comment
|
||||
|
||||
(comment) @comment
|
||||
|
||||
; Quoted content
|
||||
|
||||
(interpolation "#{" @punctuation.special "}" @punctuation.special) @embedded
|
||||
|
||||
(escape_sequence) @constant.character.escape
|
||||
|
||||
[
|
||||
(string)
|
||||
(charlist)
|
||||
] @string
|
||||
|
||||
[
|
||||
(atom)
|
||||
(quoted_atom)
|
||||
(keyword)
|
||||
(quoted_keyword)
|
||||
] @string.special.symbol
|
||||
|
||||
; Note that we explicitly target sigil quoted start/end, so they are not overridden by delimiters
|
||||
|
||||
(sigil
|
||||
(sigil_name) @__name__
|
||||
quoted_start: _ @string.special
|
||||
quoted_end: _ @string.special) @string.special
|
||||
|
||||
(sigil
|
||||
(sigil_name) @__name__
|
||||
quoted_start: _ @string
|
||||
quoted_end: _ @string
|
||||
(#match? @__name__ "^[sS]$")) @string
|
||||
|
||||
(sigil
|
||||
(sigil_name) @__name__
|
||||
quoted_start: _ @string.regex
|
||||
quoted_end: _ @string.regex
|
||||
(#match? @__name__ "^[rR]$")) @string.regex
|
||||
|
||||
; Calls
|
||||
|
||||
; * local function call
|
||||
(call
|
||||
target: (identifier) @function)
|
||||
|
||||
; * remote function call
|
||||
(call
|
||||
target: (dot
|
||||
right: (identifier) @function))
|
||||
|
||||
; * field without parentheses or block
|
||||
(call
|
||||
target: (dot
|
||||
right: (identifier) @variable.other.member)
|
||||
.)
|
||||
|
||||
; * remote call without parentheses or block (overrides above)
|
||||
(call
|
||||
target: (dot
|
||||
left: [
|
||||
(alias)
|
||||
(atom)
|
||||
]
|
||||
right: (identifier) @function)
|
||||
.)
|
||||
|
||||
; * definition keyword
|
||||
(call
|
||||
target: (identifier) @keyword
|
||||
(#any-of? @keyword "def" "defdelegate" "defexception" "defguard" "defguardp" "defimpl" "defmacro" "defmacrop" "defmodule" "defn" "defnp" "defoverridable" "defp" "defprotocol" "defstruct"))
|
||||
|
||||
; * kernel or special forms keyword
|
||||
(call
|
||||
target: (identifier) @keyword
|
||||
(#any-of? @keyword "alias" "case" "cond" "for" "if" "import" "quote" "raise" "receive" "require" "reraise" "super" "throw" "try" "unless" "unquote" "unquote_splicing" "use" "with"))
|
||||
|
||||
; * just identifier in function definition
|
||||
(call
|
||||
target: (identifier) @keyword
|
||||
(arguments
|
||||
[
|
||||
(identifier) @function
|
||||
(binary_operator
|
||||
left: (identifier) @function
|
||||
operator: "when")
|
||||
])
|
||||
(#any-of? @keyword "def" "defdelegate" "defguard" "defguardp" "defmacro" "defmacrop" "defn" "defnp" "defp"))
|
||||
|
||||
; * pipe into identifier (function call)
|
||||
(binary_operator
|
||||
operator: "|>"
|
||||
right: (identifier) @function)
|
||||
|
||||
; * pipe into identifier (definition)
|
||||
(call
|
||||
target: (identifier) @keyword
|
||||
(arguments
|
||||
(binary_operator
|
||||
operator: "|>"
|
||||
right: (identifier) @variable))
|
||||
(#any-of? @keyword "def" "defdelegate" "defguard" "defguardp" "defmacro" "defmacrop" "defn" "defnp" "defp"))
|
||||
|
||||
; * pipe into field without parentheses (function call)
|
||||
(binary_operator
|
||||
operator: "|>"
|
||||
right: (call
|
||||
target: (dot
|
||||
right: (identifier) @function)))
|
||||
|
||||
; Operators
|
||||
|
||||
; * doc string
|
||||
(unary_operator
|
||||
operator: "@" @comment.block.documentation
|
||||
operand: (call
|
||||
target: (identifier) @comment.block.documentation.__attribute__
|
||||
(arguments
|
||||
[
|
||||
(string) @comment.block.documentation
|
||||
(charlist) @comment.block.documentation
|
||||
(sigil
|
||||
quoted_start: _ @comment.block.documentation
|
||||
quoted_end: _ @comment.block.documentation) @comment.block.documentation
|
||||
(boolean) @comment.block.documentation
|
||||
]))
|
||||
(#any-of? @comment.block.documentation.__attribute__ "moduledoc" "typedoc" "doc"))
|
||||
|
||||
; * module attribute
|
||||
(unary_operator
|
||||
operator: "@" @variable.other.member
|
||||
operand: [
|
||||
(identifier) @variable.other.member
|
||||
(call
|
||||
target: (identifier) @variable.other.member)
|
||||
(boolean) @variable.other.member
|
||||
(nil) @variable.other.member
|
||||
])
|
||||
|
||||
; * capture operator
|
||||
; * capture operand
|
||||
(unary_operator
|
||||
operator: "&"
|
||||
operand: [
|
||||
|
@ -74,13 +201,34 @@
|
|||
(stab_clause
|
||||
operator: _ @operator)
|
||||
|
||||
; Literals
|
||||
; * module attribute
|
||||
(unary_operator
|
||||
operator: "@" @variable.other.member
|
||||
operand: [
|
||||
(identifier) @variable.other.member
|
||||
(call
|
||||
target: (identifier) @variable.other.member)
|
||||
(boolean) @variable.other.member
|
||||
(nil) @variable.other.member
|
||||
])
|
||||
|
||||
(nil) @constant.builtin
|
||||
; * doc string
|
||||
(unary_operator
|
||||
operator: "@" @comment.block.documentation
|
||||
operand: (call
|
||||
target: (identifier) @comment.block.documentation.__attribute__
|
||||
(arguments
|
||||
[
|
||||
(string) @comment.block.documentation
|
||||
(charlist) @comment.block.documentation
|
||||
(sigil
|
||||
quoted_start: _ @comment.block.documentation
|
||||
quoted_end: _ @comment.block.documentation) @comment.block.documentation
|
||||
(boolean) @comment.block.documentation
|
||||
]))
|
||||
(#any-of? @comment.block.documentation.__attribute__ "moduledoc" "typedoc" "doc"))
|
||||
|
||||
(boolean) @constant.builtin.boolean
|
||||
(integer) @constant.numeric.integer
|
||||
(float) @constant.numeric.float
|
||||
; Module
|
||||
|
||||
(alias) @namespace
|
||||
|
||||
|
@ -88,132 +236,6 @@
|
|||
target: (dot
|
||||
left: (atom) @namespace))
|
||||
|
||||
(char) @constant.character
|
||||
; Reserved keywords
|
||||
|
||||
; Quoted content
|
||||
|
||||
(interpolation "#{" @punctuation.special "}" @punctuation.special) @embedded
|
||||
|
||||
(escape_sequence) @constant.character.escape
|
||||
|
||||
[
|
||||
(atom)
|
||||
(quoted_atom)
|
||||
(keyword)
|
||||
(quoted_keyword)
|
||||
] @string.special.symbol
|
||||
|
||||
[
|
||||
(string)
|
||||
(charlist)
|
||||
] @string
|
||||
|
||||
; Note that we explicitly target sigil quoted start/end, so they are not overridden by delimiters
|
||||
|
||||
(sigil
|
||||
(sigil_name) @__name__
|
||||
quoted_start: _ @string
|
||||
quoted_end: _ @string
|
||||
(#any-of? @__name__ "s" "S")) @string
|
||||
|
||||
(sigil
|
||||
(sigil_name) @__name__
|
||||
quoted_start: _ @string.regexp
|
||||
quoted_end: _ @string.regexp
|
||||
(#any-of? @__name__ "r" "R")) @string.regexp
|
||||
|
||||
(sigil
|
||||
(sigil_name) @__name__
|
||||
quoted_start: _ @string.special
|
||||
quoted_end: _ @string.special) @string.special
|
||||
|
||||
; Calls
|
||||
|
||||
; * definition keyword
|
||||
(call
|
||||
target: (identifier) @keyword
|
||||
(#any-of? @keyword "def" "defdelegate" "defexception" "defguard" "defguardp" "defimpl" "defmacro" "defmacrop" "defmodule" "defn" "defnp" "defoverridable" "defp" "defprotocol" "defstruct"))
|
||||
|
||||
; * kernel or special forms keyword
|
||||
(call
|
||||
target: (identifier) @keyword
|
||||
(#any-of? @keyword "alias" "case" "cond" "else" "for" "if" "import" "quote" "raise" "receive" "require" "reraise" "super" "throw" "try" "unless" "unquote" "unquote_splicing" "use" "with"))
|
||||
|
||||
; * function call
|
||||
(call
|
||||
target: [
|
||||
; local
|
||||
(identifier) @function
|
||||
; remote
|
||||
(dot
|
||||
right: (identifier) @function)
|
||||
])
|
||||
|
||||
; * just identifier in function definition
|
||||
(call
|
||||
target: (identifier) @keyword
|
||||
(arguments
|
||||
[
|
||||
(identifier) @function
|
||||
(binary_operator
|
||||
left: (identifier) @function
|
||||
operator: "when")
|
||||
])
|
||||
(#any-of? @keyword "def" "defdelegate" "defguard" "defguardp" "defmacro" "defmacrop" "defn" "defnp" "defp"))
|
||||
|
||||
; * pipe into identifier (definition)
|
||||
(call
|
||||
target: (identifier) @keyword
|
||||
(arguments
|
||||
(binary_operator
|
||||
operator: "|>"
|
||||
right: (identifier) @variable))
|
||||
(#any-of? @keyword "def" "defdelegate" "defguard" "defguardp" "defmacro" "defmacrop" "defn" "defnp" "defp"))
|
||||
|
||||
; * pipe into identifier (function call)
|
||||
(binary_operator
|
||||
operator: "|>"
|
||||
right: (identifier) @function)
|
||||
|
||||
; Identifiers
|
||||
|
||||
; * special
|
||||
(
|
||||
(identifier) @constant.builtin
|
||||
(#any-of? @constant.builtin "__MODULE__" "__DIR__" "__ENV__" "__CALLER__" "__STACKTRACE__")
|
||||
)
|
||||
|
||||
; * unused
|
||||
(
|
||||
(identifier) @comment
|
||||
(#match? @comment "^_")
|
||||
)
|
||||
|
||||
; * regular
|
||||
(identifier) @variable
|
||||
|
||||
; Comment
|
||||
|
||||
(comment) @comment
|
||||
|
||||
; Punctuation
|
||||
|
||||
[
|
||||
"%"
|
||||
] @punctuation
|
||||
|
||||
[
|
||||
","
|
||||
";"
|
||||
] @punctuation.delimiter
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
"<<"
|
||||
">>"
|
||||
] @punctuation.bracket
|
||||
["when" "and" "or" "not" "in" "not in" "fn" "do" "end" "catch" "rescue" "after" "else"] @keyword
|
||||
|
|
|
@ -63,13 +63,13 @@
|
|||
(number) @constant.numeric
|
||||
(string) @string
|
||||
|
||||
(variable (identifier) @variable)
|
||||
((variable (identifier) @function)
|
||||
(#match? @function ".+\\~$"))
|
||||
((variable (identifier) @constant.builtin.boolean)
|
||||
(#match? @constant.builtin.boolean "(true|false)"))
|
||||
((variable (identifier) @constant.builtin)
|
||||
(#match? @constant.builtin "(_|after-chdir|args|before-chdir|buildinfo|nil|notify-bg-job-success|num-bg-jobs|ok|paths|pid|pwd|value-out-indicator|version)"))
|
||||
(variable (identifier) @variable)
|
||||
|
||||
["$" "@"] @punctuation.special
|
||||
["(" ")" "[" "]" "{" "}"] @punctuation.bracket
|
||||
|
|
|
@ -1,3 +1,45 @@
|
|||
; Comments
|
||||
(tripledot) @comment.discard
|
||||
|
||||
[(comment) (line_comment) (shebang)] @comment
|
||||
|
||||
; Basic types
|
||||
(variable) @variable
|
||||
((atom) @constant.builtin.boolean
|
||||
(#match? @constant.builtin.boolean "^(true|false)$"))
|
||||
(atom) @string.special.symbol
|
||||
[(string) (sigil)] @string
|
||||
(character) @constant.character
|
||||
(escape_sequence) @constant.character.escape
|
||||
|
||||
(integer) @constant.numeric.integer
|
||||
(float) @constant.numeric.float
|
||||
|
||||
; Punctuation
|
||||
["," "." "-" ";"] @punctuation.delimiter
|
||||
["(" ")" "#" "{" "}" "[" "]" "<<" ">>"] @punctuation.bracket
|
||||
|
||||
; Operators
|
||||
(binary_operator
|
||||
left: (atom) @function
|
||||
operator: "/"
|
||||
right: (integer) @constant.numeric.integer)
|
||||
|
||||
((binary_operator operator: _ @keyword.operator)
|
||||
(#match? @keyword.operator "^\\w+$"))
|
||||
((unary_operator operator: _ @keyword.operator)
|
||||
(#match? @keyword.operator "^\\w+$"))
|
||||
|
||||
(binary_operator operator: _ @operator)
|
||||
(unary_operator operator: _ @operator)
|
||||
["/" ":" "->"] @operator
|
||||
|
||||
|
||||
; Keywords
|
||||
(attribute name: (atom) @keyword)
|
||||
|
||||
["case" "fun" "if" "of" "when" "end" "receive" "try" "catch" "after" "begin" "maybe"] @keyword
|
||||
|
||||
; Attributes
|
||||
; module declaration
|
||||
(attribute
|
||||
|
@ -122,46 +164,3 @@
|
|||
|
||||
(record field: (atom) @variable.other.member)
|
||||
(record name: (atom) @type)
|
||||
|
||||
; Keywords
|
||||
(attribute name: (atom) @keyword)
|
||||
|
||||
["case" "fun" "if" "of" "when" "end" "receive" "try" "catch" "after" "begin" "maybe"] @keyword
|
||||
|
||||
; Operators
|
||||
(binary_operator
|
||||
left: (atom) @function
|
||||
operator: "/"
|
||||
right: (integer) @constant.numeric.integer)
|
||||
|
||||
((binary_operator operator: _ @keyword.operator)
|
||||
(#match? @keyword.operator "^\\w+$"))
|
||||
((unary_operator operator: _ @keyword.operator)
|
||||
(#match? @keyword.operator "^\\w+$"))
|
||||
|
||||
(binary_operator operator: _ @operator)
|
||||
(unary_operator operator: _ @operator)
|
||||
["/" ":" "->"] @operator
|
||||
|
||||
; Comments
|
||||
(tripledot) @comment.discard
|
||||
|
||||
[(comment) (line_comment) (shebang)] @comment
|
||||
|
||||
; Basic types
|
||||
(variable) @variable
|
||||
((atom) @constant.builtin.boolean
|
||||
(#match? @constant.builtin.boolean "^(true|false)$"))
|
||||
(atom) @string.special.symbol
|
||||
[(string) (sigil)] @string
|
||||
(character) @constant.character
|
||||
(escape_sequence) @constant.character.escape
|
||||
|
||||
(integer) @constant.numeric.integer
|
||||
(float) @constant.numeric.float
|
||||
|
||||
; Punctuation
|
||||
["," "." "-" ";"] @punctuation.delimiter
|
||||
["(" ")" "#" "{" "}" "[" "]" "<<" ">>"] @punctuation.bracket
|
||||
|
||||
; (ERROR) @error
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
"function"
|
||||
] @keyword
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
(modifier) @keyword
|
||||
(extending) @keyword
|
||||
|
||||
|
@ -31,7 +33,6 @@
|
|||
(link) @variable.other.member
|
||||
(annotation) @variable.other.member
|
||||
|
||||
(identifier) @variable
|
||||
(string) @string
|
||||
(edgeql_fragment) @string
|
||||
; Builtins
|
||||
|
@ -56,8 +57,8 @@
|
|||
"anytype"
|
||||
] @type.builtin
|
||||
|
||||
(true) @constant.builtin
|
||||
(false) @constant.builtin
|
||||
(true) @constant.builtin.boolean
|
||||
(false) @constant.builtin.boolean
|
||||
(null) @constant.builtin
|
||||
|
||||
; Delimiters
|
||||
|
|
|
@ -94,6 +94,8 @@
|
|||
|
||||
;; Commands
|
||||
|
||||
(command name: (word) @function)
|
||||
|
||||
(command
|
||||
name: (word) @function.builtin (#match? @function.builtin "^test$")
|
||||
argument: (word) @operator (#match? @operator "^(!?=|-[a-zA-Z]+)$"))
|
||||
|
@ -116,9 +118,6 @@
|
|||
]
|
||||
)
|
||||
|
||||
; non-builtin command names
|
||||
(command name: (word) @function)
|
||||
|
||||
;; Functions
|
||||
|
||||
(function_definition ["function" "end"] @keyword.function)
|
||||
|
|
|
@ -112,6 +112,8 @@
|
|||
"\\.neqv\\."
|
||||
] @keyword.operator
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
;; Brackets
|
||||
[
|
||||
"("
|
||||
|
@ -163,7 +165,6 @@
|
|||
(derived_type_member_expression
|
||||
(type_member) @variable.other.member)
|
||||
|
||||
(identifier) @variable
|
||||
(string_literal) @string
|
||||
(number_literal) @constant.numeric
|
||||
(boolean_literal) @constant.builtin.boolean
|
||||
|
|
|
@ -22,6 +22,11 @@
|
|||
|
||||
(":") @punctuation.delimiter
|
||||
|
||||
[
|
||||
(string)
|
||||
(color)
|
||||
] @string
|
||||
|
||||
; (color) are hex values
|
||||
(color "#" @punctuation.special
|
||||
(#eq? @punctuation.special "#"))
|
||||
|
@ -44,18 +49,13 @@
|
|||
(tuple "," @punctuation.delimiter.special
|
||||
(#eq? @punctuation.delimiter.special ","))
|
||||
|
||||
[
|
||||
(string)
|
||||
(color)
|
||||
] @string
|
||||
; `keybind`
|
||||
(keybind_value) @string.special
|
||||
|
||||
; clear is a special keyword that clear all existing keybind up to that point
|
||||
((keybind_value) @keyword
|
||||
(#eq? @keyword "clear"))
|
||||
|
||||
; `keybind`
|
||||
(keybind_value) @string.special
|
||||
|
||||
; NOTE: The order here matters!
|
||||
[
|
||||
(key_qualifier)
|
||||
|
|
|
@ -1 +1 @@
|
|||
; inherits: _gjs,_javascript,ecma
|
||||
; inherits: ecma,_javascript,_gjs
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
; Variables
|
||||
(identifier) @variable
|
||||
(discard) @comment.unused
|
||||
|
||||
; Comments
|
||||
(module_comment) @comment
|
||||
(statement_comment) @comment
|
||||
|
@ -72,10 +76,6 @@
|
|||
((identifier) @error
|
||||
(#any-of? @error "auto" "delegate" "derive" "else" "implement" "macro" "test" "echo"))
|
||||
|
||||
; Variables
|
||||
(identifier) @variable
|
||||
(discard) @comment.unused
|
||||
|
||||
; Keywords
|
||||
[
|
||||
(visibility_modifier) ; "pub"
|
||||
|
|
|
@ -1,8 +1,34 @@
|
|||
; Function calls
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @function.builtin
|
||||
(#match? @function.builtin "^(append|cap|close|complex|copy|delete|imag|len|make|new|panic|print|println|real|recover)$"))
|
||||
; Identifiers
|
||||
|
||||
(field_identifier) @variable.other.member
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
(package_identifier) @namespace
|
||||
|
||||
(parameter_declaration (identifier) @variable.parameter)
|
||||
(variadic_parameter_declaration (identifier) @variable.parameter)
|
||||
|
||||
(const_spec
|
||||
name: (identifier) @constant)
|
||||
|
||||
(type_spec
|
||||
name: (type_identifier) @constructor)
|
||||
|
||||
(keyed_element (literal_element (identifier) @variable.other.member))
|
||||
(field_declaration
|
||||
name: (field_identifier) @variable.other.member)
|
||||
|
||||
(parameter_declaration (identifier) @variable.parameter)
|
||||
(variadic_parameter_declaration (identifier) @variable.parameter)
|
||||
|
||||
(label_name) @label
|
||||
|
||||
(const_spec
|
||||
name: (identifier) @constant)
|
||||
|
||||
; Function calls
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @function)
|
||||
|
@ -11,9 +37,14 @@
|
|||
function: (selector_expression
|
||||
field: (field_identifier) @function.method))
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @function.builtin
|
||||
(#match? @function.builtin "^(append|cap|close|complex|copy|delete|imag|len|make|new|panic|print|println|real|recover)$"))
|
||||
|
||||
; Types
|
||||
|
||||
(type_identifier) @type
|
||||
|
||||
(type_parameter_list
|
||||
(parameter_declaration
|
||||
name: (identifier) @type.parameter))
|
||||
|
@ -21,8 +52,6 @@
|
|||
((type_identifier) @type.builtin
|
||||
(#match? @type.builtin "^(any|bool|byte|comparable|complex128|complex64|error|float32|float64|int|int16|int32|int64|int8|rune|string|uint|uint16|uint32|uint64|uint8|uintptr)$"))
|
||||
|
||||
(type_identifier) @type
|
||||
|
||||
; Function definitions
|
||||
|
||||
(function_declaration
|
||||
|
@ -34,28 +63,6 @@
|
|||
(method_spec
|
||||
name: (field_identifier) @function.method)
|
||||
|
||||
; Identifiers
|
||||
|
||||
(const_spec
|
||||
name: (identifier) @constant)
|
||||
|
||||
(parameter_declaration (identifier) @variable.parameter)
|
||||
(variadic_parameter_declaration (identifier) @variable.parameter)
|
||||
|
||||
(type_spec
|
||||
name: (type_identifier) @constructor)
|
||||
(field_identifier) @variable.other.member
|
||||
(keyed_element (literal_element (identifier) @variable.other.member))
|
||||
(identifier) @variable
|
||||
(package_identifier) @namespace
|
||||
|
||||
(parameter_declaration (identifier) @variable.parameter)
|
||||
(variadic_parameter_declaration (identifier) @variable.parameter)
|
||||
|
||||
(label_name) @label
|
||||
|
||||
(const_spec
|
||||
name: (identifier) @constant)
|
||||
|
||||
; Operators
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
; inherits: _gjs,_typescript,ecma
|
||||
; inherits: ecma,_typescript,_gjs
|
||||
|
|
|
@ -118,6 +118,8 @@
|
|||
] @constant.builtin
|
||||
(literal "void") @constant.builtin
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
(string_literal) @string
|
||||
(escape_sequence) @constant.character.escape
|
||||
(rune_literal) @string
|
||||
|
@ -138,5 +140,4 @@
|
|||
(decl_attr) @special
|
||||
(fndec_attrs) @special
|
||||
|
||||
(identifier) @variable
|
||||
(struct_union_field (name)) @variable
|
||||
|
|
|
@ -279,6 +279,20 @@
|
|||
] @punctuation.delimiter
|
||||
|
||||
|
||||
;; ----------------------------------------------------------------------------
|
||||
;; Literals and comments
|
||||
|
||||
(integer) @constant.numeric.integer
|
||||
(exp_negation) @constant.numeric.integer
|
||||
(exp_literal (float)) @constant.numeric.float
|
||||
(char) @constant.character
|
||||
(string) @string
|
||||
|
||||
(comment) @comment
|
||||
|
||||
(con_unit [ "(" ")" ] @constant.builtin) ; unit, as in ()
|
||||
|
||||
|
||||
;; ----------------------------------------------------------------------------
|
||||
;; Keywords, operators, includes
|
||||
|
||||
|
@ -352,6 +366,8 @@
|
|||
;; ----------------------------------------------------------------------------
|
||||
;; Functions and variables
|
||||
|
||||
(variable) @variable
|
||||
|
||||
(signature name: (variable) @type)
|
||||
(function
|
||||
name: (variable) @function
|
||||
|
@ -366,7 +382,6 @@
|
|||
(exp_apply . (exp_name (variable) @function))
|
||||
(exp_apply . (exp_name (qualified_variable (variable) @function)))
|
||||
|
||||
(variable) @variable
|
||||
(pat_wildcard) @variable
|
||||
|
||||
;; ----------------------------------------------------------------------------
|
||||
|
|
|
@ -1,48 +1,5 @@
|
|||
(ERROR) @error
|
||||
|
||||
; { key: val }
|
||||
|
||||
(object_elem val: (expression
|
||||
(variable_expr
|
||||
(identifier) @type.builtin (#match? @type.builtin "^(bool|string|number|object|tuple|list|map|set|any)$"))))
|
||||
|
||||
(get_attr (identifier) @variable.builtin (#match? @variable.builtin "^(root|cwd|module)$"))
|
||||
(variable_expr (identifier) @variable.builtin (#match? @variable.builtin "^(var|local|path)$"))
|
||||
((identifier) @type.builtin (#match? @type.builtin "^(bool|string|number|object|tuple|list|map|set|any)$"))
|
||||
((identifier) @keyword (#match? @keyword "^(module|root|cwd|resource|variable|data|locals|terraform|provider|output)$"))
|
||||
|
||||
; highlight identifier keys as though they were block attributes
|
||||
(object_elem key: (expression (variable_expr (identifier) @variable.other.member)))
|
||||
|
||||
(attribute (identifier) @variable.other.member)
|
||||
(function_call (identifier) @function.method)
|
||||
(block (identifier) @type.builtin)
|
||||
|
||||
(identifier) @variable
|
||||
(comment) @comment
|
||||
(null_lit) @constant.builtin
|
||||
(numeric_lit) @constant.numeric
|
||||
(bool_lit) @constant.builtin.boolean
|
||||
|
||||
[
|
||||
(template_interpolation_start) ; ${
|
||||
(template_interpolation_end) ; }
|
||||
(template_directive_start) ; %{
|
||||
(template_directive_end) ; }
|
||||
(strip_marker) ; ~
|
||||
] @punctuation.special
|
||||
|
||||
[
|
||||
(heredoc_identifier) ; <<END
|
||||
(heredoc_start) ; END
|
||||
] @punctuation.delimiter
|
||||
|
||||
[
|
||||
(quoted_template_start) ; "
|
||||
(quoted_template_end); "
|
||||
(template_literal) ; non-interpolation/directive content
|
||||
] @string
|
||||
|
||||
[
|
||||
"if"
|
||||
"else"
|
||||
|
@ -98,3 +55,47 @@
|
|||
"&&"
|
||||
"||"
|
||||
] @operator
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
; { key: val }
|
||||
|
||||
(object_elem val: (expression
|
||||
(variable_expr
|
||||
(identifier) @type.builtin (#match? @type.builtin "^(bool|string|number|object|tuple|list|map|set|any)$"))))
|
||||
|
||||
(get_attr (identifier) @variable.builtin (#match? @variable.builtin "^(root|cwd|module)$"))
|
||||
(variable_expr (identifier) @variable.builtin (#match? @variable.builtin "^(var|local|path)$"))
|
||||
((identifier) @type.builtin (#match? @type.builtin "^(bool|string|number|object|tuple|list|map|set|any)$"))
|
||||
((identifier) @keyword (#match? @keyword "^(module|root|cwd|resource|variable|data|locals|terraform|provider|output)$"))
|
||||
|
||||
; highlight identifier keys as though they were block attributes
|
||||
(object_elem key: (expression (variable_expr (identifier) @variable.other.member)))
|
||||
|
||||
(attribute (identifier) @variable.other.member)
|
||||
(function_call (identifier) @function.method)
|
||||
(block (identifier) @type.builtin)
|
||||
|
||||
(comment) @comment
|
||||
(null_lit) @constant.builtin
|
||||
(numeric_lit) @constant.numeric
|
||||
(bool_lit) @constant.builtin.boolean
|
||||
|
||||
[
|
||||
(template_interpolation_start) ; ${
|
||||
(template_interpolation_end) ; }
|
||||
(template_directive_start) ; %{
|
||||
(template_directive_end) ; }
|
||||
(strip_marker) ; ~
|
||||
] @punctuation.special
|
||||
|
||||
[
|
||||
(heredoc_identifier) ; <<END
|
||||
(heredoc_start) ; END
|
||||
] @punctuation.delimiter
|
||||
|
||||
[
|
||||
(quoted_template_start) ; "
|
||||
(quoted_template_end); "
|
||||
(template_literal) ; non-interpolation/directive content
|
||||
] @string
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
(value [":" "=" "+=" ] @operator)
|
||||
|
||||
[ "(" ")" "[" "]" "{" "}" ] @punctuation.bracket
|
||||
|
||||
(substitution (_) @string)
|
||||
(substitution ["${" "${?" "}"] @punctuation.special)
|
||||
|
||||
|
@ -22,8 +24,6 @@
|
|||
|
||||
(include) @keyword.directive
|
||||
|
||||
[ "(" ")" "[" "]" "{" "}" ] @punctuation.bracket
|
||||
|
||||
(unit) @keyword
|
||||
(path (_) @keyword)
|
||||
(unquoted_path "." @punctuation.delimiter)
|
||||
|
|
|
@ -49,6 +49,12 @@
|
|||
"|="
|
||||
] @operator
|
||||
|
||||
; Identifiers/variable references
|
||||
(identifier) @variable
|
||||
|
||||
((identifier) @function
|
||||
(#is-not? local))
|
||||
|
||||
; Keywords
|
||||
[
|
||||
"as"
|
||||
|
@ -185,9 +191,3 @@
|
|||
name: _ @function)
|
||||
|
||||
(field) @variable.other.member
|
||||
|
||||
; Identifiers/variable references
|
||||
((identifier) @function
|
||||
(#is-not? local))
|
||||
|
||||
(identifier) @variable
|
||||
|
|
|
@ -10,12 +10,15 @@
|
|||
|
||||
(num_lit) @constant.numeric
|
||||
|
||||
[(bool_lit) (nil_lit)] @constant.builtin
|
||||
(bool_lit) @constant.builtin.boolean
|
||||
(nil_lit) @constant.builtin
|
||||
|
||||
(comment) @comment
|
||||
|
||||
((sym_lit) @variable
|
||||
(#match? @variable "^\\*.+\\*$"))
|
||||
(sym_lit) @variable
|
||||
|
||||
((sym_lit) @variable.builtin
|
||||
(#match? @variable.builtin "^\\*.+\\*$"))
|
||||
|
||||
(short_fn_lit
|
||||
.
|
||||
|
@ -57,8 +60,6 @@
|
|||
.
|
||||
(sym_lit) @function)
|
||||
|
||||
(sym_lit) @variable
|
||||
|
||||
["{" "@{" "}"
|
||||
"[" "@[" "]"
|
||||
"(" "@(" ")"] @punctuation.bracket
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
(identifier) @variable
|
||||
|
||||
; Methods
|
||||
|
||||
(method_declaration
|
||||
|
@ -54,8 +56,6 @@
|
|||
((identifier) @constant
|
||||
(#match? @constant "^_*[A-Z][A-Z\\d_]+$"))
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
(this) @variable.builtin
|
||||
|
||||
; Literals
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
; See runtime/queries/ecma/README.md for more info.
|
||||
|
||||
; inherits: _javascript,ecma
|
||||
; inherits: ecma,_javascript
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
(binaryop) @operator
|
||||
(unaryop) @operator
|
||||
|
||||
(id) @variable
|
||||
(param identifier: (id) @variable.parameter)
|
||||
(bind function: (id) @function)
|
||||
(fieldname (id) @variable.other.member)
|
||||
|
@ -35,4 +36,3 @@
|
|||
";"
|
||||
"="
|
||||
] @punctuation.delimiter
|
||||
(id) @variable
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
; See runtime/queries/ecma/README.md for more info.
|
||||
|
||||
; inherits: _jsx,_javascript,ecma
|
||||
; inherits: ecma,_javascript,_jsx
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
[
|
||||
(module_definition)
|
||||
(struct_definition)
|
||||
(macro_definition)
|
||||
(function_definition)
|
||||
(compound_expression) ; begin blocks
|
||||
(let_statement)
|
||||
(if_statement)
|
||||
(for_statement)
|
||||
(while_statement)
|
||||
(module_definition)
|
||||
(struct_definition)
|
||||
(macro_definition)
|
||||
(function_definition)
|
||||
(if_statement)
|
||||
(try_statement)
|
||||
(for_statement)
|
||||
(while_statement)
|
||||
(let_statement)
|
||||
(quote_statement)
|
||||
(do_clause)
|
||||
(compound_statement) ; begin block
|
||||
] @fold
|
||||
|
|
|
@ -1,39 +1,48 @@
|
|||
; ----------
|
||||
; Primitives
|
||||
; ----------
|
||||
; ------------
|
||||
; Variables identifiers
|
||||
; ------------
|
||||
|
||||
[
|
||||
(line_comment)
|
||||
(block_comment)
|
||||
] @comment
|
||||
(identifier) @variable
|
||||
|
||||
; Remaining identifiers that start with capital letters should be types (PascalCase)
|
||||
(
|
||||
((identifier) @constant.builtin)
|
||||
(#match? @constant.builtin "^(nothing|missing|undef)$"))
|
||||
|
||||
[
|
||||
(true)
|
||||
(false)
|
||||
] @constant.builtin.boolean
|
||||
|
||||
(integer_literal) @constant.numeric.integer
|
||||
(float_literal) @constant.numeric.float
|
||||
(identifier) @type
|
||||
(#match? @type "^[A-Z]"))
|
||||
|
||||
; SCREAMING_SNAKE_CASE
|
||||
(
|
||||
((identifier) @constant.numeric.float)
|
||||
(#match? @constant.numeric.float "^((Inf|NaN)(16|32|64)?)$"))
|
||||
(identifier) @constant
|
||||
(#match? @constant "^[A-Z][A-Z0-9_]*$"))
|
||||
|
||||
(character_literal) @constant.character
|
||||
(escape_sequence) @constant.character.escape
|
||||
(const_statement
|
||||
(assignment
|
||||
. (identifier) @constant))
|
||||
|
||||
(string_literal) @string
|
||||
|
||||
(prefixed_string_literal
|
||||
prefix: (identifier) @function.macro) @string
|
||||
; Field expressions are either module content or struct fields.
|
||||
; Module types and constants should already be captured, so this
|
||||
; assumes the remaining identifiers to be struct fields.
|
||||
(field_expression
|
||||
(_)
|
||||
(identifier) @variable.other.member)
|
||||
|
||||
(quote_expression
|
||||
(identifier) @string.special.symbol)
|
||||
|
||||
":" @string.special.symbol
|
||||
[
|
||||
(identifier)
|
||||
(operator)
|
||||
] @string.special.symbol)
|
||||
|
||||
; ------
|
||||
; Macros
|
||||
; ------
|
||||
|
||||
(macro_definition
|
||||
name: (identifier) @function.macro)
|
||||
|
||||
(macro_identifier
|
||||
"@" @function.macro
|
||||
(identifier) @function.macro)
|
||||
|
||||
; -------------------
|
||||
; Modules and Imports
|
||||
; -------------------
|
||||
|
@ -50,49 +59,6 @@
|
|||
(scoped_identifier
|
||||
(identifier) @namespace)
|
||||
|
||||
; -----
|
||||
; Types
|
||||
; -----
|
||||
|
||||
(abstract_definition
|
||||
name: (identifier) @type)
|
||||
|
||||
(primitive_definition
|
||||
name: (identifier) @type)
|
||||
|
||||
(struct_definition
|
||||
name: (identifier) @type)
|
||||
|
||||
(struct_definition
|
||||
. (_)
|
||||
(identifier) @variable.other.member)
|
||||
|
||||
(struct_definition
|
||||
. (_)
|
||||
(typed_expression
|
||||
. (identifier) @variable.other.member))
|
||||
|
||||
(type_parameter_list
|
||||
(identifier) @type)
|
||||
|
||||
(constrained_type_parameter
|
||||
(identifier) @type)
|
||||
|
||||
(subtype_clause
|
||||
(identifier) @type)
|
||||
|
||||
(typed_expression
|
||||
(identifier) @type . )
|
||||
|
||||
(parameterized_identifier
|
||||
(identifier) @type)
|
||||
|
||||
(type_argument_list
|
||||
(identifier) @type)
|
||||
|
||||
(where_clause
|
||||
(identifier) @type)
|
||||
|
||||
; -------------------
|
||||
; Function definition
|
||||
; -------------------
|
||||
|
@ -119,22 +85,6 @@
|
|||
; prevent constructors (PascalCase) to be highlighted as functions
|
||||
(#match? @function "^[^A-Z]"))
|
||||
|
||||
(parameter_list
|
||||
(identifier) @variable.parameter)
|
||||
|
||||
(typed_parameter
|
||||
(identifier) @variable.parameter
|
||||
(identifier)? @type)
|
||||
|
||||
(optional_parameter
|
||||
. (identifier) @variable.parameter)
|
||||
|
||||
(slurp_parameter
|
||||
(identifier) @variable.parameter)
|
||||
|
||||
(function_expression
|
||||
. (identifier) @variable.parameter)
|
||||
|
||||
; ---------------
|
||||
; Functions calls
|
||||
; ---------------
|
||||
|
@ -145,93 +95,294 @@
|
|||
; prevent constructors (PascalCase) to be highlighted as functions
|
||||
(#match? @function "^[^A-Z]"))
|
||||
|
||||
(
|
||||
(broadcast_call_expression
|
||||
(identifier) @function)
|
||||
(#match? @function "^[^A-Z]"))
|
||||
|
||||
(
|
||||
(call_expression
|
||||
(field_expression (identifier) @function .))
|
||||
(#match? @function "^[^A-Z]"))
|
||||
|
||||
(
|
||||
(broadcast_call_expression
|
||||
(identifier) @function)
|
||||
(#match? @function "^[^A-Z]"))
|
||||
|
||||
(
|
||||
(broadcast_call_expression
|
||||
(field_expression (identifier) @function .))
|
||||
(#match? @function "^[^A-Z]"))
|
||||
|
||||
; ------
|
||||
; Macros
|
||||
; ------
|
||||
|
||||
(macro_definition
|
||||
name: (identifier) @function.macro)
|
||||
; -------------------
|
||||
; Functions builtins
|
||||
; -------------------
|
||||
|
||||
((identifier) @function.builtin
|
||||
(#any-of? @function.builtin
|
||||
"_abstracttype" "_apply_iterate" "_apply_pure" "_call_in_world" "_call_in_world_total"
|
||||
"_call_latest" "_equiv_typedef" "_expr" "_primitivetype" "_setsuper!" "_structtype" "_typebody!"
|
||||
"_typevar" "applicable" "apply_type" "arrayref" "arrayset" "arraysize" "const_arrayref"
|
||||
"donotdelete" "fieldtype" "get_binding_type" "getfield" "ifelse" "invoke" "isa" "isdefined"
|
||||
"modifyfield!" "nfields" "replacefield!" "set_binding_type!" "setfield!" "sizeof" "svec"
|
||||
"swapfield!" "throw" "tuple" "typeassert" "typeof"))
|
||||
|
||||
; -----------
|
||||
; Parameters
|
||||
; -----------
|
||||
|
||||
(parameter_list
|
||||
(identifier) @variable.parameter)
|
||||
|
||||
(optional_parameter
|
||||
. (identifier) @variable.parameter)
|
||||
|
||||
(slurp_parameter
|
||||
(identifier) @variable.parameter)
|
||||
|
||||
(typed_parameter
|
||||
parameter: (identifier)? @variable.parameter
|
||||
type: (_) @type)
|
||||
|
||||
(function_expression
|
||||
. (identifier) @variable.parameter) ; Single parameter arrow functions
|
||||
|
||||
; -----
|
||||
; Types
|
||||
; -----
|
||||
|
||||
; Definitions
|
||||
(abstract_definition
|
||||
name: (identifier) @type.definition) @keyword
|
||||
|
||||
(primitive_definition
|
||||
name: (identifier) @type.definition) @keyword
|
||||
|
||||
(struct_definition
|
||||
name: (identifier) @type)
|
||||
|
||||
(struct_definition
|
||||
. (_)
|
||||
(identifier) @variable.other.member)
|
||||
|
||||
(struct_definition
|
||||
. (_)
|
||||
(typed_expression
|
||||
. (identifier) @variable.other.member))
|
||||
|
||||
(type_clause
|
||||
[
|
||||
(identifier) @type
|
||||
(field_expression
|
||||
(identifier) @type .)
|
||||
])
|
||||
|
||||
; Annotations
|
||||
(parametrized_type_expression
|
||||
(_) @type
|
||||
(curly_expression
|
||||
(_) @type))
|
||||
|
||||
(type_parameter_list
|
||||
(identifier) @type)
|
||||
|
||||
(typed_expression
|
||||
(identifier) @type . )
|
||||
|
||||
(function_definition
|
||||
return_type: (identifier) @type)
|
||||
|
||||
(short_function_definition
|
||||
return_type: (identifier) @type)
|
||||
|
||||
(where_clause
|
||||
(identifier) @type)
|
||||
|
||||
(where_clause
|
||||
(curly_expression
|
||||
(_) @type))
|
||||
|
||||
; ---------
|
||||
; Builtins
|
||||
; ---------
|
||||
|
||||
; This list was generated with:
|
||||
;
|
||||
; istype(x) = typeof(x) === DataType || typeof(x) === UnionAll
|
||||
; get_types(m) = filter(x -> istype(Base.eval(m, x)), names(m))
|
||||
; type_names = sort(union(get_types(Core), get_types(Base)))
|
||||
;
|
||||
((identifier) @type.builtin
|
||||
(#any-of? @type.builtin
|
||||
"AbstractArray" "AbstractChannel" "AbstractChar" "AbstractDict" "AbstractDisplay"
|
||||
"AbstractFloat" "AbstractIrrational" "AbstractLock" "AbstractMatch" "AbstractMatrix"
|
||||
"AbstractPattern" "AbstractRange" "AbstractSet" "AbstractSlices" "AbstractString"
|
||||
"AbstractUnitRange" "AbstractVecOrMat" "AbstractVector" "Any" "ArgumentError" "Array"
|
||||
"AssertionError" "Atomic" "BigFloat" "BigInt" "BitArray" "BitMatrix" "BitSet" "BitVector" "Bool"
|
||||
"BoundsError" "By" "CanonicalIndexError" "CapturedException" "CartesianIndex" "CartesianIndices"
|
||||
"Cchar" "Cdouble" "Cfloat" "Channel" "Char" "Cint" "Cintmax_t" "Clong" "Clonglong" "Cmd" "Colon"
|
||||
"ColumnSlices" "Complex" "ComplexF16" "ComplexF32" "ComplexF64" "ComposedFunction"
|
||||
"CompositeException" "ConcurrencyViolationError" "Condition" "Cptrdiff_t" "Cshort" "Csize_t"
|
||||
"Cssize_t" "Cstring" "Cuchar" "Cuint" "Cuintmax_t" "Culong" "Culonglong" "Cushort" "Cvoid"
|
||||
"Cwchar_t" "Cwstring" "DataType" "DenseArray" "DenseMatrix" "DenseVecOrMat" "DenseVector" "Dict"
|
||||
"DimensionMismatch" "Dims" "DivideError" "DomainError" "EOFError" "Enum" "ErrorException"
|
||||
"Exception" "ExponentialBackOff" "Expr" "Float16" "Float32" "Float64" "Function" "GlobalRef"
|
||||
"HTML" "IO" "IOBuffer" "IOContext" "IOStream" "IdDict" "IndexCartesian" "IndexLinear"
|
||||
"IndexStyle" "InexactError" "InitError" "Int" "Int128" "Int16" "Int32" "Int64" "Int8" "Integer"
|
||||
"InterruptException" "InvalidStateException" "Irrational" "KeyError" "LazyString" "LinRange"
|
||||
"LineNumberNode" "LinearIndices" "LoadError" "Lt" "MIME" "Matrix" "Method" "MethodError"
|
||||
"Missing" "MissingException" "Module" "NTuple" "NamedTuple" "Nothing" "Number" "Ordering"
|
||||
"OrdinalRange" "OutOfMemoryError" "OverflowError" "Pair" "ParseError" "PartialQuickSort" "Perm"
|
||||
"PermutedDimsArray" "Pipe" "ProcessFailedException" "Ptr" "QuoteNode" "Rational" "RawFD"
|
||||
"ReadOnlyMemoryError" "Real" "ReentrantLock" "Ref" "Regex" "RegexMatch" "Returns"
|
||||
"ReverseOrdering" "RoundingMode" "RowSlices" "SegmentationFault" "Set" "Signed" "Slices" "Some"
|
||||
"SpinLock" "StackFrame" "StackOverflowError" "StackTrace" "Stateful" "StepRange" "StepRangeLen"
|
||||
"StridedArray" "StridedMatrix" "StridedVecOrMat" "StridedVector" "String" "StringIndexError"
|
||||
"SubArray" "SubString" "SubstitutionString" "Symbol" "SystemError" "Task" "TaskFailedException"
|
||||
"Text" "TextDisplay" "Timer" "Tmstruct" "Tuple" "Type" "TypeError" "TypeVar" "UInt" "UInt128"
|
||||
"UInt16" "UInt32" "UInt64" "UInt8" "UndefInitializer" "UndefKeywordError" "UndefRefError"
|
||||
"UndefVarError" "Union" "UnionAll" "UnitRange" "Unsigned" "Val" "VecElement" "VecOrMat" "Vector"
|
||||
"VersionNumber" "WeakKeyDict" "WeakRef"))
|
||||
|
||||
((identifier) @variable.builtin
|
||||
(#any-of? @variable.builtin "begin" "end")
|
||||
(#has-ancestor? @variable.builtin index_expression))
|
||||
|
||||
((identifier) @variable.builtin
|
||||
(#any-of? @variable.builtin "begin" "end")
|
||||
(#has-ancestor? @variable.builtin range_expression))
|
||||
|
||||
(macro_identifier
|
||||
"@" @function.macro
|
||||
(identifier) @function.macro)
|
||||
|
||||
; --------
|
||||
; Keywords
|
||||
; --------
|
||||
|
||||
(function_definition
|
||||
["function" "end"] @keyword.function)
|
||||
[
|
||||
"global"
|
||||
"local"
|
||||
] @keyword
|
||||
|
||||
(compound_statement
|
||||
[
|
||||
"begin"
|
||||
"end"
|
||||
] @keyword)
|
||||
|
||||
(quote_statement
|
||||
[
|
||||
"quote"
|
||||
"end"
|
||||
] @keyword)
|
||||
|
||||
(let_statement
|
||||
[
|
||||
"let"
|
||||
"end"
|
||||
] @keyword)
|
||||
|
||||
(if_statement
|
||||
["if" "end"] @keyword.control.conditional)
|
||||
(elseif_clause
|
||||
["elseif"] @keyword.control.conditional)
|
||||
(else_clause
|
||||
["else"] @keyword.control.conditional)
|
||||
(ternary_expression
|
||||
["?" ":"] @keyword.control.conditional)
|
||||
[
|
||||
"if"
|
||||
"end"
|
||||
] @keyword.control.conditional)
|
||||
|
||||
(for_statement
|
||||
["for" "end"] @keyword.control.repeat)
|
||||
(while_statement
|
||||
["while" "end"] @keyword.control.repeat)
|
||||
(break_statement) @keyword.control.repeat
|
||||
(continue_statement) @keyword.control.repeat
|
||||
(for_binding
|
||||
"in" @keyword.control.repeat)
|
||||
(for_clause
|
||||
"for" @keyword.control.repeat)
|
||||
(elseif_clause
|
||||
"elseif" @keyword.control.conditional)
|
||||
|
||||
(else_clause
|
||||
"else" @keyword.control.conditional)
|
||||
|
||||
(if_clause
|
||||
"if" @keyword.control.conditional) ; `if` clause in comprehensions
|
||||
|
||||
(ternary_expression
|
||||
[
|
||||
"?"
|
||||
":"
|
||||
] @keyword.control.conditional)
|
||||
|
||||
(try_statement
|
||||
["try" "end" ] @keyword.control.exception)
|
||||
[
|
||||
"try"
|
||||
"end"
|
||||
] @keyword.control.exception)
|
||||
|
||||
(finally_clause
|
||||
"finally" @keyword.control.exception)
|
||||
|
||||
(catch_clause
|
||||
"catch" @keyword.control.exception)
|
||||
|
||||
[
|
||||
"export"
|
||||
"import"
|
||||
"using"
|
||||
] @keyword.control.import
|
||||
(for_statement
|
||||
[
|
||||
"for"
|
||||
"end"
|
||||
] @keyword.control.repeat)
|
||||
|
||||
(while_statement
|
||||
[
|
||||
"while"
|
||||
"end"
|
||||
] @keyword.control.repeat)
|
||||
|
||||
(for_clause
|
||||
"for" @keyword.control.repeat)
|
||||
|
||||
[
|
||||
(break_statement)
|
||||
(continue_statement)
|
||||
] @keyword.control.repeat
|
||||
|
||||
(module_definition
|
||||
[
|
||||
"module"
|
||||
"baremodule"
|
||||
"end"
|
||||
] @keyword.control.import)
|
||||
|
||||
(import_statement
|
||||
[
|
||||
"import"
|
||||
"using"
|
||||
] @keyword.control.import)
|
||||
|
||||
(import_alias
|
||||
"as" @keyword.control.import)
|
||||
|
||||
(export_statement
|
||||
"export" @keyword.control.import)
|
||||
|
||||
(selected_import
|
||||
":" @punctuation.delimiter)
|
||||
|
||||
(struct_definition
|
||||
[
|
||||
"struct"
|
||||
"end"
|
||||
] @keyword)
|
||||
|
||||
(macro_definition
|
||||
[
|
||||
"macro"
|
||||
"end"
|
||||
] @keyword)
|
||||
|
||||
(function_definition
|
||||
[
|
||||
"function"
|
||||
"end"
|
||||
] @keyword.function)
|
||||
|
||||
(do_clause
|
||||
[
|
||||
"do"
|
||||
"end"
|
||||
] @keyword.function)
|
||||
|
||||
(return_statement
|
||||
"return" @keyword.control.return)
|
||||
|
||||
[
|
||||
"abstract"
|
||||
"baremodule"
|
||||
"begin"
|
||||
"const"
|
||||
"do"
|
||||
"end"
|
||||
"let"
|
||||
"macro"
|
||||
"module"
|
||||
"mutable"
|
||||
"primitive"
|
||||
"quote"
|
||||
"return"
|
||||
"struct"
|
||||
"type"
|
||||
"where"
|
||||
] @keyword
|
||||
|
||||
; TODO: fix this
|
||||
((identifier) @keyword (#match? @keyword "global|local"))
|
||||
] @keyword.storage.modifier
|
||||
|
||||
; ---------
|
||||
; Operators
|
||||
|
@ -239,14 +390,34 @@
|
|||
|
||||
[
|
||||
(operator)
|
||||
"::"
|
||||
"<:"
|
||||
":"
|
||||
"=>"
|
||||
"..."
|
||||
"$"
|
||||
"="
|
||||
"∈"
|
||||
] @operator
|
||||
|
||||
(adjoint_expression
|
||||
"'" @operator)
|
||||
|
||||
(range_expression
|
||||
":" @operator)
|
||||
|
||||
((operator) @keyword.operator
|
||||
(#any-of? @keyword.operator "in" "isa"))
|
||||
|
||||
(for_binding
|
||||
"in" @keyword.operator)
|
||||
|
||||
(where_clause
|
||||
"where" @keyword.operator)
|
||||
|
||||
(where_expression
|
||||
"where" @keyword.operator)
|
||||
|
||||
(binary_expression
|
||||
(_)
|
||||
(operator) @operator
|
||||
(identifier) @function
|
||||
(#any-of? @operator "|>" ".|>"))
|
||||
|
||||
; ------------
|
||||
; Punctuations
|
||||
; ------------
|
||||
|
@ -255,40 +426,58 @@
|
|||
"."
|
||||
","
|
||||
";"
|
||||
"::"
|
||||
"->"
|
||||
] @punctuation.delimiter
|
||||
|
||||
"..." @punctuation.special
|
||||
|
||||
[
|
||||
"["
|
||||
"]"
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
; ---------------------
|
||||
; Remaining identifiers
|
||||
; ---------------------
|
||||
; ---------
|
||||
; Literals
|
||||
; ---------
|
||||
|
||||
(const_statement
|
||||
(variable_declaration
|
||||
. (identifier) @constant))
|
||||
(boolean_literal) @constant.builtin.boolean
|
||||
|
||||
(integer_literal) @constant.numeric.integer
|
||||
|
||||
(float_literal) @constant.numeric.float
|
||||
|
||||
; SCREAMING_SNAKE_CASE
|
||||
(
|
||||
(identifier) @constant
|
||||
(#match? @constant "^[A-Z][A-Z0-9_]*$"))
|
||||
((identifier) @constant.numeric.float)
|
||||
(#match? @constant.numeric.float "^((Inf|NaN)(16|32|64)?)$"))
|
||||
|
||||
; remaining identifiers that start with capital letters should be types (PascalCase)
|
||||
(
|
||||
(identifier) @type
|
||||
(#match? @type "^[A-Z]"))
|
||||
((identifier) @constant.builtin)
|
||||
(#match? @constant.builtin "^(nothing|missing|undef)$"))
|
||||
|
||||
; Field expressions are either module content or struct fields.
|
||||
; Module types and constants should already be captured, so this
|
||||
; assumes the remaining identifiers to be struct fields.
|
||||
(field_expression
|
||||
(_)
|
||||
(identifier) @variable.other.member)
|
||||
(character_literal) @constant.character
|
||||
|
||||
(identifier) @variable
|
||||
(escape_sequence) @constant.character.escape
|
||||
|
||||
(string_literal) @string
|
||||
|
||||
(prefixed_string_literal
|
||||
prefix: (identifier) @function.macro) @string
|
||||
|
||||
(command_literal) @string
|
||||
|
||||
(prefixed_command_literal
|
||||
prefix: (identifier) @function.macro) @string
|
||||
|
||||
; ---------
|
||||
; Comments
|
||||
; ---------
|
||||
|
||||
[
|
||||
(line_comment)
|
||||
(block_comment)
|
||||
] @comment
|
||||
|
|
|
@ -2,15 +2,39 @@
|
|||
(struct_definition)
|
||||
(macro_definition)
|
||||
(function_definition)
|
||||
(compound_expression)
|
||||
(let_statement)
|
||||
(compound_statement)
|
||||
(if_statement)
|
||||
(try_statement)
|
||||
(for_statement)
|
||||
(while_statement)
|
||||
(let_statement)
|
||||
(quote_statement)
|
||||
(do_clause)
|
||||
(parameter_list)
|
||||
(assignment)
|
||||
(for_binding)
|
||||
(call_expression)
|
||||
(parenthesized_expression)
|
||||
(tuple_expression)
|
||||
(comprehension_expression)
|
||||
(matrix_expression)
|
||||
(vector_expression)
|
||||
] @indent
|
||||
|
||||
[
|
||||
"end"
|
||||
")"
|
||||
"]"
|
||||
"}"
|
||||
] @outdent
|
||||
|
||||
(argument_list
|
||||
. (_) @anchor
|
||||
(#set! "scope" "tail")) @align
|
||||
|
||||
(parameter_list
|
||||
. (_) @anchor
|
||||
(#set! "scope" "tail")) @align
|
||||
|
||||
(curly_expression
|
||||
. (_) @anchor
|
||||
(#set! "scope" "tail")) @align
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
(primitive_definition)
|
||||
(abstract_definition)
|
||||
(struct_definition)
|
||||
(assignment_expression)
|
||||
(short_function_definition)
|
||||
(assignment)
|
||||
(const_statement)
|
||||
])
|
||||
(#set! injection.language "markdown"))
|
||||
|
@ -21,10 +22,17 @@
|
|||
] @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
|
||||
(
|
||||
[
|
||||
(command_literal)
|
||||
(prefixed_command_literal)
|
||||
] @injection.content
|
||||
(#set! injection.language "sh"))
|
||||
|
||||
(
|
||||
(prefixed_string_literal
|
||||
prefix: (identifier) @function.macro) @injection.content
|
||||
(#eq? @function.macro "re")
|
||||
(#eq? @function.macro "r")
|
||||
(#set! injection.language "regex"))
|
||||
|
||||
(
|
||||
|
|
|
@ -2,43 +2,100 @@
|
|||
; Definitions
|
||||
; -----------
|
||||
|
||||
; Imports
|
||||
(import_statement
|
||||
; Variables
|
||||
(assignment
|
||||
(identifier) @local.definition)
|
||||
|
||||
|
||||
(assignment
|
||||
(tuple_expression
|
||||
(identifier) @local.definition))
|
||||
|
||||
; Constants
|
||||
(const_statement
|
||||
(variable_declaration
|
||||
(assignment
|
||||
. (identifier) @local.definition))
|
||||
|
||||
; let/const bindings
|
||||
(let_binding
|
||||
(identifier) @local.definition)
|
||||
|
||||
(let_binding
|
||||
(tuple_expression
|
||||
(identifier) @local.definition))
|
||||
|
||||
; For bindings
|
||||
(for_binding
|
||||
(identifier) @local.definition)
|
||||
|
||||
(for_binding
|
||||
(tuple_expression
|
||||
(identifier) @local.definition))
|
||||
|
||||
; Types
|
||||
(struct_definition
|
||||
name: (identifier) @local.definition)
|
||||
|
||||
(abstract_definition
|
||||
name: (identifier) @local.definition)
|
||||
|
||||
(abstract_definition
|
||||
name: (identifier) @local.definition)
|
||||
|
||||
(type_parameter_list
|
||||
(identifier) @local.definition)
|
||||
|
||||
; Module imports
|
||||
(import_statement
|
||||
(identifier) @local.definition)
|
||||
|
||||
; Parameters
|
||||
(parameter_list
|
||||
(identifier) @local.definition)
|
||||
|
||||
(typed_parameter
|
||||
. (identifier) @local.definition)
|
||||
|
||||
(optional_parameter .
|
||||
(optional_parameter
|
||||
.
|
||||
(identifier) @local.definition)
|
||||
|
||||
(slurp_parameter
|
||||
(identifier) @local.definition)
|
||||
|
||||
(function_expression
|
||||
. (identifier) @local.definition)
|
||||
|
||||
; ------
|
||||
; Scopes
|
||||
; ------
|
||||
(typed_parameter
|
||||
parameter: (identifier) @local.definition
|
||||
(_))
|
||||
|
||||
[
|
||||
(function_definition)
|
||||
(short_function_definition)
|
||||
(macro_definition)
|
||||
] @local.scope
|
||||
; Single parameter arrow function
|
||||
(function_expression
|
||||
.
|
||||
(identifier) @local.definition)
|
||||
|
||||
; Function/macro definitions
|
||||
(function_definition
|
||||
name: (identifier) @local.definition) @local.scope
|
||||
|
||||
(short_function_definition
|
||||
name: (identifier) @local.definition) @local.scope
|
||||
|
||||
(macro_definition
|
||||
name: (identifier) @local.definition) @local.scope
|
||||
|
||||
; ----------
|
||||
; References
|
||||
; ----------
|
||||
|
||||
(identifier) @local.reference
|
||||
|
||||
; ------
|
||||
; Scopes
|
||||
; ------
|
||||
|
||||
[
|
||||
(for_statement)
|
||||
(while_statement)
|
||||
(try_statement)
|
||||
(catch_clause)
|
||||
(finally_clause)
|
||||
(let_statement)
|
||||
(quote_statement)
|
||||
(do_clause)
|
||||
] @local.scope
|
||||
|
||||
|
|
|
@ -1,3 +1,48 @@
|
|||
; Identifiers
|
||||
|
||||
(qconid) @namespace
|
||||
|
||||
(qidop) @namespace
|
||||
|
||||
(varid) @variable
|
||||
|
||||
(conid) @constructor
|
||||
|
||||
(puredecl
|
||||
(binder
|
||||
(identifier
|
||||
[(varid) (idop)] @constant)))
|
||||
|
||||
; TODO: Highlight vars differently once helix has an appropriate highlight query
|
||||
; for that purpose.
|
||||
|
||||
(pparameter
|
||||
(pattern
|
||||
(identifier
|
||||
(varid) @variable.parameter)))
|
||||
|
||||
(paramid
|
||||
(identifier
|
||||
(varid) @variable.parameter))
|
||||
|
||||
(typedecl
|
||||
"effect"
|
||||
(varid) @type)
|
||||
|
||||
(typeid
|
||||
(varid) @type)
|
||||
|
||||
(tbinder
|
||||
(varid) @type)
|
||||
|
||||
(typecon
|
||||
(varid) @type)
|
||||
|
||||
(qvarid
|
||||
(qid) @namespace)
|
||||
|
||||
(modulepath (varid) @namespace)
|
||||
|
||||
; Function calls
|
||||
|
||||
(appexpr
|
||||
|
@ -55,51 +100,6 @@
|
|||
(identifier
|
||||
[(varid) (idop)] @function))
|
||||
|
||||
; Identifiers
|
||||
|
||||
(puredecl
|
||||
(binder
|
||||
(identifier
|
||||
[(varid) (idop)] @constant)))
|
||||
|
||||
; TODO: Highlight vars differently once helix has an appropriate highlight query
|
||||
; for that purpose.
|
||||
|
||||
(pparameter
|
||||
(pattern
|
||||
(identifier
|
||||
(varid) @variable.parameter)))
|
||||
|
||||
(paramid
|
||||
(identifier
|
||||
(varid) @variable.parameter))
|
||||
|
||||
(typedecl
|
||||
"effect"
|
||||
(varid) @type)
|
||||
|
||||
(typeid
|
||||
(varid) @type)
|
||||
|
||||
(tbinder
|
||||
(varid) @type)
|
||||
|
||||
(typecon
|
||||
(varid) @type)
|
||||
|
||||
(qvarid
|
||||
(qid) @namespace)
|
||||
|
||||
(modulepath (varid) @namespace)
|
||||
|
||||
(qconid) @namespace
|
||||
|
||||
(qidop) @namespace
|
||||
|
||||
(varid) @variable
|
||||
|
||||
(conid) @constructor
|
||||
|
||||
; Operators
|
||||
|
||||
[
|
||||
|
|
|
@ -1,22 +1,21 @@
|
|||
;;; Identifiers
|
||||
(simple_identifier) @variable
|
||||
|
||||
; `field` keyword inside property getter/setter
|
||||
; FIXME: This will highlight the keyword outside of getters and setters
|
||||
; since tree-sitter does not allow us to check for arbitrary nestation
|
||||
((simple_identifier) @variable.builtin
|
||||
(#eq? @variable.builtin "field"))
|
||||
|
||||
; `it` keyword inside lambdas
|
||||
; FIXME: This will highlight the keyword outside of lambdas since tree-sitter
|
||||
; does not allow us to check for arbitrary nestation
|
||||
((simple_identifier) @variable.builtin
|
||||
(#eq? @variable.builtin "it"))
|
||||
|
||||
|
||||
;;; Operators & Punctuation
|
||||
|
||||
(multi_line_string_literal
|
||||
"$" @punctuation
|
||||
(interpolated_identifier) @none)
|
||||
(multi_line_string_literal
|
||||
"${" @punctuation
|
||||
(interpolated_expression) @none
|
||||
"}" @punctuation.)
|
||||
|
||||
; NOTE: `interpolated_identifier`s can be highlighted in any way
|
||||
(line_string_literal
|
||||
"$" @punctuation
|
||||
(interpolated_identifier) @none)
|
||||
(line_string_literal
|
||||
"${" @punctuation
|
||||
(interpolated_expression) @none
|
||||
"}" @punctuation)
|
||||
|
||||
[
|
||||
"."
|
||||
","
|
||||
|
@ -69,6 +68,23 @@
|
|||
"->"
|
||||
] @operator
|
||||
|
||||
(multi_line_string_literal
|
||||
"$" @punctuation
|
||||
(interpolated_identifier) @none)
|
||||
(multi_line_string_literal
|
||||
"${" @punctuation
|
||||
(interpolated_expression) @none
|
||||
"}" @punctuation.)
|
||||
|
||||
; NOTE: `interpolated_identifier`s can be highlighted in any way
|
||||
(line_string_literal
|
||||
"$" @punctuation
|
||||
(interpolated_identifier) @none)
|
||||
(line_string_literal
|
||||
"${" @punctuation
|
||||
(interpolated_expression) @none
|
||||
"}" @punctuation)
|
||||
|
||||
;;; Keywords
|
||||
|
||||
(type_alias "typealias" @keyword)
|
||||
|
@ -281,18 +297,3 @@
|
|||
|
||||
; `this` this keyword inside classes
|
||||
(this_expression) @variable.builtin
|
||||
|
||||
;;; Identifiers
|
||||
; `field` keyword inside property getter/setter
|
||||
; FIXME: This will highlight the keyword outside of getters and setters
|
||||
; since tree-sitter does not allow us to check for arbitrary nestation
|
||||
((simple_identifier) @variable.builtin
|
||||
(#eq? @variable.builtin "field"))
|
||||
|
||||
; `it` keyword inside lambdas
|
||||
; FIXME: This will highlight the keyword outside of lambdas since tree-sitter
|
||||
; does not allow us to check for arbitrary nestation
|
||||
((simple_identifier) @variable.builtin
|
||||
(#eq? @variable.builtin "it"))
|
||||
|
||||
(simple_identifier) @variable
|
||||
|
|
|
@ -70,9 +70,6 @@
|
|||
"as"
|
||||
] @keyword.control.import
|
||||
|
||||
(string (interpolation ("{") @punctuation.special))
|
||||
(string (interpolation ("}") @punctuation.special))
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
|
@ -83,12 +80,16 @@
|
|||
"|"
|
||||
] @punctuation.bracket
|
||||
|
||||
(string (interpolation ["{" "}"] @punctuation.special))
|
||||
|
||||
[
|
||||
";"
|
||||
":"
|
||||
","
|
||||
] @punctuation.delimiter
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
(import_module
|
||||
(identifier) @module)
|
||||
|
||||
|
@ -148,5 +149,3 @@
|
|||
|
||||
(function
|
||||
output_type: (identifier) @type)
|
||||
|
||||
(identifier) @variable
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
; Identifiers
|
||||
|
||||
[(NAME) (SYMBOLNAME)] @variable
|
||||
|
||||
(section
|
||||
.
|
||||
(NAME) @namespace)
|
||||
|
||||
[(NAME) (SYMBOLNAME)] @variable
|
||||
|
||||
; Operators
|
||||
|
||||
[
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
(comment) @comment
|
||||
|
||||
(attributeType) @type.parameter
|
||||
|
||||
((distinguishedName
|
||||
(name
|
||||
(name_componet
|
||||
|
@ -13,7 +15,6 @@
|
|||
(changerecord) @constant
|
||||
(mod_spec) @constant
|
||||
|
||||
(attributeType) @type.parameter
|
||||
(change_modify) @string
|
||||
|
||||
(value_spec) @keyword
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
; Variables
|
||||
(identifier) @variable
|
||||
|
||||
; Namespaces
|
||||
|
||||
(open
|
||||
namespace: (identifier) @namespace)
|
||||
(namespace
|
||||
|
@ -212,6 +217,3 @@
|
|||
|
||||
;; Error
|
||||
(ERROR) @error
|
||||
|
||||
; Variables
|
||||
(identifier) @variable
|
||||
|
|
|
@ -115,6 +115,18 @@
|
|||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
;; Variables
|
||||
(identifier) @variable
|
||||
|
||||
((identifier) @variable.builtin
|
||||
(#eq? @variable.builtin "self"))
|
||||
|
||||
(variable_list
|
||||
(attribute
|
||||
"<" @punctuation.bracket
|
||||
(identifier) @attribute
|
||||
">" @punctuation.bracket))
|
||||
|
||||
; ;; Constants
|
||||
[
|
||||
(false)
|
||||
|
@ -208,17 +220,5 @@
|
|||
;; Property
|
||||
(dot_index_expression field: (identifier) @variable.other.member)
|
||||
|
||||
;; Variables
|
||||
((identifier) @variable.builtin
|
||||
(#eq? @variable.builtin "self"))
|
||||
|
||||
(variable_list
|
||||
(attribute
|
||||
"<" @punctuation.bracket
|
||||
(identifier) @attribute
|
||||
">" @punctuation.bracket))
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
;; Error
|
||||
(ERROR) @error
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
(comment) @comment
|
||||
|
||||
; these are listed first, because they override keyword queries
|
||||
(function_expression (identifier) @function)
|
||||
(identifier) @variable
|
||||
|
||||
[
|
||||
(assignment_operator)
|
||||
|
@ -59,4 +58,5 @@
|
|||
(fstring_literal)
|
||||
] @string
|
||||
|
||||
(identifier) @variable
|
||||
; these are listed last, because they override keyword queries
|
||||
(function_expression (identifier) @function)
|
||||
|
|
|
@ -1,3 +1,28 @@
|
|||
; Variables
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
(attribute attribute: (identifier) @variable.other.member)
|
||||
|
||||
((identifier) @constant
|
||||
(#match? @constant "^_*[A-Z][A-Z\\d_]*$"))
|
||||
|
||||
((identifier) @type
|
||||
(#match? @type "^[A-Z]"))
|
||||
|
||||
; Literals
|
||||
(none) @constant.builtin
|
||||
[
|
||||
(true)
|
||||
(false)
|
||||
] @constant.builtin.boolean
|
||||
|
||||
(integer) @constant.numeric.integer
|
||||
(float) @constant.numeric.float
|
||||
(comment) @comment
|
||||
(string) @string
|
||||
(escape_sequence) @constant.character.escape
|
||||
|
||||
; Docstrings
|
||||
|
||||
(expression_statement (string) @comment.block.documentation)
|
||||
|
@ -98,30 +123,6 @@
|
|||
(class_definition name: (identifier) @type)
|
||||
(class_definition superclasses: (argument_list (identifier) @type))
|
||||
|
||||
; Variables
|
||||
|
||||
((identifier) @constant
|
||||
(#match? @constant "^_*[A-Z][A-Z\\d_]*$"))
|
||||
|
||||
((identifier) @type
|
||||
(#match? @type "^[A-Z]"))
|
||||
|
||||
(attribute attribute: (identifier) @variable.other.member)
|
||||
(identifier) @variable
|
||||
|
||||
; Literals
|
||||
(none) @constant.builtin
|
||||
[
|
||||
(true)
|
||||
(false)
|
||||
] @constant.builtin.boolean
|
||||
|
||||
(integer) @constant.numeric.integer
|
||||
(float) @constant.numeric.float
|
||||
(comment) @comment
|
||||
(string) @string
|
||||
(escape_sequence) @constant.character.escape
|
||||
|
||||
["," "." ":" ";" (ellipsis)] @punctuation.delimiter
|
||||
(interpolation
|
||||
"{" @punctuation.special
|
||||
|
|
|
@ -23,12 +23,16 @@
|
|||
(borrow_expression "&" @keyword.storage.modifier.ref)
|
||||
(borrow_expression "&mut" @keyword.storage.modifier.mut)
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
(constant_identifier) @constant
|
||||
((identifier) @constant
|
||||
(#match? @constant "^[A-Z][A-Z\\d_]*$"))
|
||||
|
||||
(function_identifier) @function
|
||||
|
||||
(primitive_type) @type.builtin
|
||||
|
||||
(struct_identifier) @type
|
||||
(pack_expression
|
||||
access: (module_access
|
||||
|
@ -152,6 +156,3 @@
|
|||
"with"
|
||||
] @keyword
|
||||
|
||||
(primitive_type) @type.buildin
|
||||
|
||||
(identifier) @variable
|
||||
|
|
|
@ -4,6 +4,12 @@
|
|||
|
||||
(preproc_expression) @keyword.directive
|
||||
|
||||
(word) @variable
|
||||
((word) @constant
|
||||
(#match? @constant "^[A-Z_][?A-Z_0-9]+$"))
|
||||
((word) @constant.builtin
|
||||
(#match? @constant.builtin "^__\\?[A-Z_a-z0-9]+\\?__$"))
|
||||
|
||||
[
|
||||
(line_here_token)
|
||||
(section_here_token)
|
||||
|
@ -56,12 +62,6 @@
|
|||
(float_literal) @constant.numeric.float
|
||||
(packed_bcd_literal) @constant.numeric.integer
|
||||
|
||||
((word) @constant
|
||||
(#match? @constant "^[A-Z_][?A-Z_0-9]+$"))
|
||||
((word) @constant.builtin
|
||||
(#match? @constant.builtin "^__\\?[A-Z_a-z0-9]+\\?__$"))
|
||||
(word) @variable
|
||||
|
||||
(preproc_arg) @keyword.directive
|
||||
|
||||
[
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
(identifier) @variable
|
||||
|
||||
;; Constants, Comments, and Literals
|
||||
|
||||
(comment) @comment.line
|
||||
|
@ -329,5 +331,3 @@
|
|||
(dot_expression
|
||||
left: (identifier) @variable
|
||||
right: (identifier) @variable.other.member)
|
||||
|
||||
(identifier) @variable
|
||||
|
|
|
@ -1,5 +1,23 @@
|
|||
(comment) @comment
|
||||
|
||||
[
|
||||
";"
|
||||
"."
|
||||
","
|
||||
"="
|
||||
":"
|
||||
(ellipses)
|
||||
] @punctuation.delimiter
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
"assert" @keyword.control.exception
|
||||
"or" @keyword.operator
|
||||
"rec" @keyword.control.repeat
|
||||
|
@ -17,6 +35,18 @@
|
|||
"with"
|
||||
] @keyword
|
||||
|
||||
(variable_expression name: (identifier) @variable)
|
||||
|
||||
(select_expression
|
||||
attrpath: (attrpath attr: (identifier)) @variable.other.member)
|
||||
|
||||
(apply_expression
|
||||
function: [
|
||||
(variable_expression name: (identifier) @function)
|
||||
(select_expression
|
||||
attrpath: (attrpath
|
||||
attr: (identifier) @function .))])
|
||||
|
||||
((identifier) @variable.builtin
|
||||
(#match? @variable.builtin "^(__currentSystem|__currentTime|__nixPath|__nixVersion|__storeDir|builtins)$")
|
||||
(#is-not? local))
|
||||
|
@ -59,28 +89,16 @@
|
|||
name: (identifier) @variable.parameter
|
||||
"?"? @punctuation.delimiter)
|
||||
|
||||
(select_expression
|
||||
attrpath: (attrpath attr: (identifier)) @variable.other.member)
|
||||
|
||||
(interpolation
|
||||
"${" @punctuation.special
|
||||
"}" @punctuation.special) @embedded
|
||||
|
||||
(apply_expression
|
||||
function: [
|
||||
(variable_expression name: (identifier) @function)
|
||||
(select_expression
|
||||
attrpath: (attrpath
|
||||
attr: (identifier) @function .))])
|
||||
|
||||
(unary_expression
|
||||
operator: _ @operator)
|
||||
|
||||
(binary_expression
|
||||
operator: _ @operator)
|
||||
|
||||
(variable_expression name: (identifier) @variable)
|
||||
|
||||
(binding
|
||||
attrpath: (attrpath attr: (identifier)) @variable.other.member)
|
||||
|
||||
|
@ -92,21 +110,3 @@
|
|||
"?" @operator
|
||||
attrpath: (attrpath
|
||||
attr: (identifier) @variable.other.member))
|
||||
|
||||
[
|
||||
";"
|
||||
"."
|
||||
","
|
||||
"="
|
||||
":"
|
||||
(ellipses)
|
||||
] @punctuation.delimiter
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
|
@ -1,3 +1,25 @@
|
|||
; Punctuation
|
||||
;------------
|
||||
|
||||
"%" @punctuation.special
|
||||
|
||||
["(" ")" "[" "]" "{" "}" "[|" "|]" "[<" "[>"] @punctuation.bracket
|
||||
|
||||
[
|
||||
"," "." ";" ":" "=" "|" "~" "?" "+" "-" "!" ">" "&"
|
||||
"->" ";;" ":>" "+=" ":=" ".."
|
||||
] @punctuation.delimiter
|
||||
|
||||
(object_type ["<" ">"] @punctuation.bracket)
|
||||
|
||||
(attribute ["[@" "]"] @punctuation.special)
|
||||
(item_attribute ["[@@" "]"] @punctuation.special)
|
||||
(floating_attribute ["[@@@" "]"] @punctuation.special)
|
||||
(extension ["[%" "]"] @punctuation.special)
|
||||
(item_extension ["[%%" "]"] @punctuation.special)
|
||||
(quoted_extension ["{%" "}"] @punctuation.special)
|
||||
(quoted_item_extension ["{%%" "}"] @punctuation.special)
|
||||
|
||||
; Modules
|
||||
;--------
|
||||
|
||||
|
@ -83,9 +105,7 @@
|
|||
; Operators
|
||||
;----------
|
||||
|
||||
(match_expression (match_operator) @keyword)
|
||||
|
||||
(value_definition [(let_operator) (let_and_operator)] @keyword)
|
||||
["*" "#" "::" "<-"] @operator
|
||||
|
||||
[
|
||||
(prefix_operator)
|
||||
|
@ -105,7 +125,9 @@
|
|||
(match_operator)
|
||||
] @operator
|
||||
|
||||
["*" "#" "::" "<-"] @operator
|
||||
(match_expression (match_operator) @keyword)
|
||||
|
||||
(value_definition [(let_operator) (let_and_operator)] @keyword)
|
||||
|
||||
; Keywords
|
||||
;---------
|
||||
|
@ -118,28 +140,6 @@
|
|||
"then" "to" "try" "type" "val" "virtual" "when" "while" "with"
|
||||
] @keyword
|
||||
|
||||
; Punctuation
|
||||
;------------
|
||||
|
||||
(attribute ["[@" "]"] @punctuation.special)
|
||||
(item_attribute ["[@@" "]"] @punctuation.special)
|
||||
(floating_attribute ["[@@@" "]"] @punctuation.special)
|
||||
(extension ["[%" "]"] @punctuation.special)
|
||||
(item_extension ["[%%" "]"] @punctuation.special)
|
||||
(quoted_extension ["{%" "}"] @punctuation.special)
|
||||
(quoted_item_extension ["{%%" "}"] @punctuation.special)
|
||||
|
||||
"%" @punctuation.special
|
||||
|
||||
["(" ")" "[" "]" "{" "}" "[|" "|]" "[<" "[>"] @punctuation.bracket
|
||||
|
||||
(object_type ["<" ">"] @punctuation.bracket)
|
||||
|
||||
[
|
||||
"," "." ";" ":" "=" "|" "~" "?" "+" "-" "!" ">" "&"
|
||||
"->" ";;" ":>" "+=" ":=" ".."
|
||||
] @punctuation.delimiter
|
||||
|
||||
; Attributes
|
||||
;-----------
|
||||
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
|
||||
; Variables
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
[
|
||||
(calling_convention)
|
||||
(tag)
|
||||
|
@ -264,7 +269,3 @@
|
|||
(call_expression argument: (identifier) @variable.parameter "=")
|
||||
|
||||
(procedure_type (parameters (parameter (identifier) @variable.parameter)))
|
||||
|
||||
; Variables
|
||||
|
||||
(identifier) @variable
|
||||
|
|
|
@ -106,6 +106,11 @@
|
|||
|
||||
[(true) (false)] @constant.builtin.boolean
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
((identifier) @constant
|
||||
(#match? @constant "^[A-Z][A-Z\\d_]*$"))
|
||||
|
||||
(enumerator name: (identifier) @type.enum.variant)
|
||||
|
||||
(string_literal) @string
|
||||
|
@ -142,9 +147,4 @@
|
|||
(vector_type) @type.builtin
|
||||
(other_builtin_type) @type.builtin
|
||||
|
||||
((identifier) @constant
|
||||
(#match? @constant "^[A-Z][A-Z\\d_]*$"))
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
(comment) @comment
|
||||
|
|
|
@ -3,13 +3,14 @@
|
|||
(boolean) @constant.builtin.boolean
|
||||
(include_path) @string.special.path
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
(parameters_declaration (identifier) @variable.parameter)
|
||||
(function_declaration name: (identifier) @function)
|
||||
|
||||
(function_call function: (identifier) @function)
|
||||
(module_call name: (identifier) @function)
|
||||
|
||||
(identifier) @variable
|
||||
(special_variable) @variable.builtin
|
||||
|
||||
[
|
||||
|
@ -60,4 +61,4 @@
|
|||
"."
|
||||
] @punctuation.delimiter
|
||||
|
||||
(comment) @comment
|
||||
(comment) @comment
|
||||
|
|
|
@ -39,6 +39,8 @@
|
|||
|
||||
(comment) @comment
|
||||
|
||||
(function) @function
|
||||
|
||||
(eof_marker) @keyword.directive
|
||||
(data_section) @comment
|
||||
|
||||
|
@ -95,5 +97,3 @@
|
|||
|
||||
(func0op_call_expression function: _ @function.builtin)
|
||||
(func1op_call_expression function: _ @function.builtin)
|
||||
|
||||
(function) @function
|
||||
|
|
|
@ -1,6 +1,23 @@
|
|||
(php_tag) @tag
|
||||
"?>" @tag
|
||||
|
||||
; Variables
|
||||
|
||||
(variable_name) @variable
|
||||
|
||||
(relative_scope) @variable.builtin
|
||||
|
||||
((name) @constant
|
||||
(#match? @constant "^_?[A-Z][A-Z\\d_]+$"))
|
||||
((name) @constant.builtin
|
||||
(#match? @constant.builtin "^__[A-Z][A-Z\d_]+__$"))
|
||||
|
||||
((name) @constructor
|
||||
(#match? @constructor "^[A-Z]"))
|
||||
|
||||
((name) @variable.builtin
|
||||
(#eq? @variable.builtin "this"))
|
||||
|
||||
; Types
|
||||
|
||||
(primitive_type) @type.builtin
|
||||
|
@ -38,23 +55,6 @@
|
|||
(member_access_expression
|
||||
name: (name) @variable.other.member)
|
||||
|
||||
; Variables
|
||||
|
||||
(relative_scope) @variable.builtin
|
||||
|
||||
((name) @constant
|
||||
(#match? @constant "^_?[A-Z][A-Z\\d_]+$"))
|
||||
((name) @constant.builtin
|
||||
(#match? @constant.builtin "^__[A-Z][A-Z\d_]+__$"))
|
||||
|
||||
((name) @constructor
|
||||
(#match? @constructor "^[A-Z]"))
|
||||
|
||||
((name) @variable.builtin
|
||||
(#eq? @variable.builtin "this"))
|
||||
|
||||
(variable_name) @variable
|
||||
|
||||
; Basic tokens
|
||||
[
|
||||
(string)
|
||||
|
|
|
@ -1,6 +1,21 @@
|
|||
(php_tag) @tag
|
||||
"?>" @tag
|
||||
|
||||
; Variables
|
||||
|
||||
(relative_scope) @variable.builtin
|
||||
|
||||
(variable_name) @variable
|
||||
|
||||
((name) @constant
|
||||
(#match? @constant "^_?[A-Z][A-Z\\d_]+$"))
|
||||
|
||||
((name) @constructor
|
||||
(#match? @constructor "^[A-Z]"))
|
||||
|
||||
((name) @variable.builtin
|
||||
(#eq? @variable.builtin "this"))
|
||||
|
||||
; Types
|
||||
[
|
||||
(primitive_type)
|
||||
|
@ -110,21 +125,6 @@
|
|||
(member_access_expression
|
||||
name: (name) @variable.other.member)
|
||||
|
||||
; Variables
|
||||
|
||||
(relative_scope) @variable.builtin
|
||||
|
||||
((name) @constant
|
||||
(#match? @constant "^_?[A-Z][A-Z\\d_]+$"))
|
||||
|
||||
((name) @constructor
|
||||
(#match? @constructor "^[A-Z]"))
|
||||
|
||||
((name) @variable.builtin
|
||||
(#eq? @variable.builtin "this"))
|
||||
|
||||
(variable_name) @variable
|
||||
|
||||
; Attributes
|
||||
(attribute_list) @attribute
|
||||
|
||||
|
|
|
@ -149,14 +149,14 @@
|
|||
|
||||
; Identifiers
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
(classProperty (identifier) @variable.other.member)
|
||||
(objectProperty (identifier) @variable.other.member)
|
||||
|
||||
(parameterList (typedIdentifier (identifier) @variable.parameter))
|
||||
(objectBodyParameters (typedIdentifier (identifier) @variable.parameter))
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
; Method definitions
|
||||
|
||||
(classMethod (methodHeader (identifier)) @function.method)
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
(character) @constant.character
|
||||
|
||||
;; strings and docstring
|
||||
(string) @string
|
||||
(source_file docstring: (string) @string.special)
|
||||
(entity docstring: (string) @string.special)
|
||||
(method docstring: (string) @string.special) ; docstring for methods without body
|
||||
|
@ -18,7 +19,6 @@
|
|||
(behavior body: (block . (string) @string.special))
|
||||
(constructor body: (block . (string) @string.special))
|
||||
(field docstring: (string) @string.special)
|
||||
(string) @string
|
||||
|
||||
;; Punctuation
|
||||
[
|
||||
|
@ -137,6 +137,14 @@
|
|||
"<="
|
||||
] @operator
|
||||
|
||||
;; variables
|
||||
;; references to upper case things are considered constructors
|
||||
(identifier) @variable
|
||||
(
|
||||
(identifier) @constructor
|
||||
(#match? @constructor "^[A-Z]")
|
||||
)
|
||||
|
||||
;; Types
|
||||
(entity name: (identifier) @type)
|
||||
(nominal_type name: (identifier) @type)
|
||||
|
@ -166,11 +174,3 @@
|
|||
;; annotations
|
||||
(annotations (identifier) @attribute)
|
||||
|
||||
;; variables
|
||||
;; references to upper case things are considered constructors
|
||||
(
|
||||
(identifier) @constructor
|
||||
(#match @constructor "^[A-Z]")
|
||||
)
|
||||
(identifier) @variable
|
||||
|
||||
|
|
|
@ -1,19 +1,3 @@
|
|||
; ----------------------------------------------------------------------------
|
||||
; Record fields would need to come before literal strings in order to be captured correctly
|
||||
|
||||
(record_accessor
|
||||
field: [ (variable)
|
||||
(string)
|
||||
(triple_quote_string)
|
||||
] @variable.other.member)
|
||||
|
||||
(exp_record_access
|
||||
field: [ (variable)
|
||||
(string)
|
||||
(triple_quote_string)
|
||||
] @variable.other.member)
|
||||
|
||||
|
||||
; ----------------------------------------------------------------------------
|
||||
; Literals and comments
|
||||
|
||||
|
@ -21,6 +5,7 @@
|
|||
(exp_negation) @constant.numeric.integer
|
||||
(exp_literal (number)) @constant.numeric.float
|
||||
(char) @constant.character
|
||||
|
||||
[
|
||||
(string)
|
||||
(triple_quote_string)
|
||||
|
@ -28,7 +13,6 @@
|
|||
|
||||
(comment) @comment
|
||||
|
||||
|
||||
; ----------------------------------------------------------------------------
|
||||
; Punctuation
|
||||
|
||||
|
@ -41,18 +25,19 @@
|
|||
"]"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
(comma)
|
||||
";"
|
||||
] @punctuation.delimiter
|
||||
(comma) @punctuation.delimiter
|
||||
|
||||
; ----------------------------------------------------------------------------
|
||||
; Types
|
||||
|
||||
(type) @type
|
||||
|
||||
(constructor) @constructor
|
||||
|
||||
; ----------------------------------------------------------------------------
|
||||
; Keywords, operators, includes
|
||||
|
||||
; This needs to come before the other "else" in
|
||||
; order to be highlighted correctly
|
||||
(class_instance "else" @keyword)
|
||||
(module) @namespace
|
||||
|
||||
[
|
||||
"if"
|
||||
|
@ -95,7 +80,6 @@
|
|||
] @operator
|
||||
|
||||
(qualified_module (module) @constructor)
|
||||
(module) @namespace
|
||||
(qualified_type (module) @namespace)
|
||||
(qualified_variable (module) @namespace)
|
||||
(import (module) @namespace)
|
||||
|
@ -122,6 +106,11 @@
|
|||
"infixr"
|
||||
] @keyword
|
||||
|
||||
; NOTE
|
||||
; Needs to come after the other `else` in
|
||||
; order to be highlighted correctly
|
||||
(class_instance "else" @keyword)
|
||||
|
||||
(type_role_declaration
|
||||
"role" @keyword
|
||||
role: (type_role) @keyword)
|
||||
|
@ -131,10 +120,27 @@
|
|||
; ----------------------------------------------------------------------------
|
||||
; Functions and variables
|
||||
|
||||
(variable) @variable
|
||||
|
||||
(row_field (field_name) @variable.other.member)
|
||||
(record_field (field_name) @variable.other.member)
|
||||
(record_field (field_pun) @variable.other.member)
|
||||
|
||||
; NOTE
|
||||
; Record fields must come after literal strings and
|
||||
; plain variables in order to be highlighted correctly
|
||||
(record_accessor
|
||||
field: [ (variable)
|
||||
(string)
|
||||
(triple_quote_string)
|
||||
] @variable.other.member)
|
||||
|
||||
(exp_record_access
|
||||
field: [ (variable)
|
||||
(string)
|
||||
(triple_quote_string)
|
||||
] @variable.other.member)
|
||||
|
||||
(signature name: (variable) @type)
|
||||
(function name: (variable) @function)
|
||||
(class_instance (instance_name) @function)
|
||||
|
@ -151,14 +157,5 @@
|
|||
(exp_ticked (exp_name (variable) @operator))
|
||||
(exp_ticked (exp_name (qualified_variable (variable) @operator)))
|
||||
|
||||
(variable) @variable
|
||||
|
||||
("@" @namespace) ; "as" pattern operator, e.g. x@Constructor
|
||||
|
||||
; ----------------------------------------------------------------------------
|
||||
; Types
|
||||
|
||||
(type) @type
|
||||
|
||||
(constructor) @constructor
|
||||
(patterns (pat_as "@" @namespace))
|
||||
|
||||
|
|
|
@ -1,125 +1,8 @@
|
|||
; Imports
|
||||
|
||||
(dotted_name
|
||||
(identifier)* @namespace)
|
||||
|
||||
(aliased_import
|
||||
alias: (identifier) @namespace)
|
||||
|
||||
; Builtin functions
|
||||
|
||||
((call
|
||||
function: (identifier) @function.builtin)
|
||||
(#match?
|
||||
@function.builtin
|
||||
"^(abs|all|any|ascii|bin|bool|breakpoint|bytearray|bytes|callable|chr|classmethod|compile|complex|delattr|dict|dir|divmod|enumerate|eval|exec|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|isinstance|issubclass|iter|len|list|locals|map|max|memoryview|min|next|object|oct|open|ord|pow|print|property|range|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|vars|zip|__import__)$"))
|
||||
|
||||
; Function calls
|
||||
|
||||
[
|
||||
"def"
|
||||
"lambda"
|
||||
] @keyword.function
|
||||
|
||||
(call
|
||||
function: (attribute attribute: (identifier) @constructor)
|
||||
(#match? @constructor "^[A-Z]"))
|
||||
(call
|
||||
function: (identifier) @constructor
|
||||
(#match? @constructor "^[A-Z]"))
|
||||
|
||||
(call
|
||||
function: (attribute attribute: (identifier) @function.method))
|
||||
|
||||
(call
|
||||
function: (identifier) @function)
|
||||
|
||||
; Function definitions
|
||||
|
||||
(function_definition
|
||||
name: (identifier) @constructor
|
||||
(#match? @constructor "^(__new__|__init__)$"))
|
||||
|
||||
(function_definition
|
||||
name: (identifier) @function)
|
||||
|
||||
; Decorators
|
||||
|
||||
(decorator) @function
|
||||
(decorator (identifier) @function)
|
||||
(decorator (attribute attribute: (identifier) @function))
|
||||
(decorator (call
|
||||
function: (attribute attribute: (identifier) @function)))
|
||||
|
||||
; Parameters
|
||||
|
||||
((identifier) @variable.builtin
|
||||
(#match? @variable.builtin "^(self|cls)$"))
|
||||
|
||||
(parameters (identifier) @variable.parameter)
|
||||
(parameters (typed_parameter (identifier) @variable.parameter))
|
||||
(parameters (default_parameter name: (identifier) @variable.parameter))
|
||||
(parameters (typed_default_parameter name: (identifier) @variable.parameter))
|
||||
|
||||
(parameters
|
||||
(list_splat_pattern ; *args
|
||||
(identifier) @variable.parameter))
|
||||
(parameters
|
||||
(dictionary_splat_pattern ; **kwargs
|
||||
(identifier) @variable.parameter))
|
||||
|
||||
(lambda_parameters
|
||||
(identifier) @variable.parameter)
|
||||
|
||||
; Types
|
||||
|
||||
((identifier) @type.builtin
|
||||
(#match?
|
||||
@type.builtin
|
||||
"^(bool|bytes|dict|float|frozenset|int|list|set|str|tuple)$"))
|
||||
|
||||
; In type hints make everything types to catch non-conforming identifiers
|
||||
; (e.g., datetime.datetime) and None
|
||||
(type [(identifier) (none)] @type)
|
||||
; Handle [] . and | nesting 4 levels deep
|
||||
(type
|
||||
(_ [(identifier) (none)]? @type
|
||||
(_ [(identifier) (none)]? @type
|
||||
(_ [(identifier) (none)]? @type
|
||||
(_ [(identifier) (none)]? @type)))))
|
||||
|
||||
(class_definition name: (identifier) @type)
|
||||
(class_definition superclasses: (argument_list (identifier) @type))
|
||||
|
||||
; Variables
|
||||
|
||||
((identifier) @constant
|
||||
(#match? @constant "^_*[A-Z][A-Z\\d_]*$"))
|
||||
|
||||
((identifier) @type
|
||||
(#match? @type "^[A-Z]"))
|
||||
|
||||
(attribute attribute: (identifier) @variable.other.member)
|
||||
(identifier) @variable
|
||||
|
||||
; Literals
|
||||
(none) @constant.builtin
|
||||
[
|
||||
(true)
|
||||
(false)
|
||||
] @constant.builtin.boolean
|
||||
|
||||
(integer) @constant.numeric.integer
|
||||
(float) @constant.numeric.float
|
||||
(comment) @comment
|
||||
(string) @string
|
||||
(escape_sequence) @constant.character.escape
|
||||
|
||||
["," "." ":" ";" (ellipsis)] @punctuation.delimiter
|
||||
["(" ")" "[" "]" "{" "}"] @punctuation.bracket
|
||||
(interpolation
|
||||
"{" @punctuation.special
|
||||
"}" @punctuation.special) @embedded
|
||||
["(" ")" "[" "]" "{" "}"] @punctuation.bracket
|
||||
|
||||
[
|
||||
"-"
|
||||
|
@ -223,8 +106,128 @@
|
|||
"is"
|
||||
] @keyword.operator
|
||||
|
||||
; Literals
|
||||
(none) @constant.builtin
|
||||
[
|
||||
(true)
|
||||
(false)
|
||||
] @constant.builtin.boolean
|
||||
|
||||
(integer) @constant.numeric.integer
|
||||
(float) @constant.numeric.float
|
||||
(comment) @comment
|
||||
(string) @string
|
||||
(escape_sequence) @constant.character.escape
|
||||
|
||||
; Variables
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
(attribute attribute: (identifier) @variable.other.member)
|
||||
|
||||
; Imports
|
||||
|
||||
(dotted_name
|
||||
(identifier)* @namespace)
|
||||
|
||||
(aliased_import
|
||||
alias: (identifier) @namespace)
|
||||
|
||||
; Function calls
|
||||
|
||||
[
|
||||
"def"
|
||||
"lambda"
|
||||
] @keyword.function
|
||||
|
||||
(call
|
||||
function: (attribute attribute: (identifier) @function.method))
|
||||
|
||||
(call
|
||||
function: (identifier) @function)
|
||||
|
||||
(call
|
||||
function: (attribute attribute: (identifier) @constructor)
|
||||
(#match? @constructor "^[A-Z]"))
|
||||
(call
|
||||
function: (identifier) @constructor
|
||||
(#match? @constructor "^[A-Z]"))
|
||||
|
||||
; Builtin functions
|
||||
|
||||
((call
|
||||
function: (identifier) @function.builtin)
|
||||
(#match?
|
||||
@function.builtin
|
||||
"^(abs|all|any|ascii|bin|bool|breakpoint|bytearray|bytes|callable|chr|classmethod|compile|complex|delattr|dict|dir|divmod|enumerate|eval|exec|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|isinstance|issubclass|iter|len|list|locals|map|max|memoryview|min|next|object|oct|open|ord|pow|print|property|range|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|vars|zip|__import__)$"))
|
||||
|
||||
; Function definitions
|
||||
|
||||
(function_definition
|
||||
name: (identifier) @function)
|
||||
|
||||
(function_definition
|
||||
name: (identifier) @constructor
|
||||
(#match? @constructor "^(__new__|__init__)$"))
|
||||
|
||||
; Decorators
|
||||
|
||||
(decorator) @function
|
||||
(decorator (identifier) @function)
|
||||
(decorator (attribute attribute: (identifier) @function))
|
||||
(decorator (call
|
||||
function: (attribute attribute: (identifier) @function)))
|
||||
|
||||
; Parameters
|
||||
|
||||
(parameters (identifier) @variable.parameter)
|
||||
(parameters (typed_parameter (identifier) @variable.parameter))
|
||||
(parameters (default_parameter name: (identifier) @variable.parameter))
|
||||
(parameters (typed_default_parameter name: (identifier) @variable.parameter))
|
||||
|
||||
(parameters
|
||||
(list_splat_pattern ; *args
|
||||
(identifier) @variable.parameter))
|
||||
(parameters
|
||||
(dictionary_splat_pattern ; **kwargs
|
||||
(identifier) @variable.parameter))
|
||||
|
||||
(lambda_parameters
|
||||
(identifier) @variable.parameter)
|
||||
|
||||
; Builtins, constants, etc.
|
||||
|
||||
((identifier) @variable.builtin
|
||||
(#match? @variable.builtin "^(self|cls)$"))
|
||||
|
||||
((identifier) @type.builtin
|
||||
(#match? @type.builtin
|
||||
"^(BaseException|Exception|ArithmeticError|BufferError|LookupError|AssertionError|AttributeError|EOFError|FloatingPointError|GeneratorExit|ImportError|ModuleNotFoundError|IndexError|KeyError|KeyboardInterrupt|MemoryError|NameError|NotImplementedError|OSError|OverflowError|RecursionError|ReferenceError|RuntimeError|StopIteration|StopAsyncIteration|SyntaxError|IndentationError|TabError|SystemError|SystemExit|TypeError|UnboundLocalError|UnicodeError|UnicodeEncodeError|UnicodeDecodeError|UnicodeTranslateError|ValueError|ZeroDivisionError|EnvironmentError|IOError|WindowsError|BlockingIOError|ChildProcessError|ConnectionError|BrokenPipeError|ConnectionAbortedError|ConnectionRefusedError|ConnectionResetError|FileExistsError|FileNotFoundError|InterruptedError|IsADirectoryError|NotADirectoryError|PermissionError|ProcessLookupError|TimeoutError|Warning|UserWarning|DeprecationWarning|PendingDeprecationWarning|SyntaxWarning|RuntimeWarning|FutureWarning|ImportWarning|UnicodeWarning|BytesWarning|ResourceWarning)$"))
|
||||
|
||||
((identifier) @type
|
||||
(#match? @type "^[A-Z]"))
|
||||
|
||||
((identifier) @constant
|
||||
(#match? @constant "^_*[A-Z][A-Z\\d_]*$"))
|
||||
|
||||
; Types
|
||||
|
||||
((identifier) @type.builtin
|
||||
(#match?
|
||||
@type.builtin
|
||||
"^(bool|bytes|dict|float|frozenset|int|list|set|str|tuple)$"))
|
||||
|
||||
; In type hints make everything types to catch non-conforming identifiers
|
||||
; (e.g., datetime.datetime) and None
|
||||
(type [(identifier) (none)] @type)
|
||||
; Handle [] . and | nesting 4 levels deep
|
||||
(type
|
||||
(_ [(identifier) (none)]? @type
|
||||
(_ [(identifier) (none)]? @type
|
||||
(_ [(identifier) (none)]? @type
|
||||
(_ [(identifier) (none)]? @type)))))
|
||||
|
||||
(class_definition name: (identifier) @type)
|
||||
(class_definition superclasses: (argument_list (identifier) @type))
|
||||
|
||||
(ERROR) @error
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
; highlights.scm
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
; Literals
|
||||
|
||||
|
@ -122,7 +123,5 @@
|
|||
(namespace_get function: (identifier) @function.method)
|
||||
(namespace_get_internal function: (identifier) @function.method)
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
; Error
|
||||
(ERROR) @error
|
||||
|
|
|
@ -1,5 +1,69 @@
|
|||
(comment) @comment
|
||||
|
||||
[
|
||||
"."
|
||||
","
|
||||
"|"
|
||||
] @punctuation.delimiter
|
||||
|
||||
[
|
||||
"++"
|
||||
"+"
|
||||
"+."
|
||||
"-"
|
||||
"-."
|
||||
"*"
|
||||
"**"
|
||||
"*."
|
||||
"/."
|
||||
"<="
|
||||
"=="
|
||||
"==="
|
||||
"!"
|
||||
"!="
|
||||
"!=="
|
||||
">="
|
||||
"&&"
|
||||
"||"
|
||||
"="
|
||||
":="
|
||||
"->"
|
||||
"|>"
|
||||
":>"
|
||||
"+="
|
||||
(uncurry)
|
||||
] @operator
|
||||
|
||||
; Explicitly enclose these operators with binary_expression
|
||||
; to avoid confusion with JSX tag delimiters
|
||||
(binary_expression ["<" ">" "/"] @operator)
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"{"
|
||||
"}"
|
||||
"["
|
||||
"]"
|
||||
] @punctuation.bracket
|
||||
|
||||
(polyvar_type
|
||||
[
|
||||
"["
|
||||
"[>"
|
||||
"[<"
|
||||
"]"
|
||||
] @punctuation.bracket)
|
||||
|
||||
[
|
||||
"~"
|
||||
"?"
|
||||
"=>"
|
||||
".."
|
||||
"..."
|
||||
] @punctuation.special
|
||||
|
||||
|
||||
; Identifiers
|
||||
;------------
|
||||
|
||||
|
@ -143,69 +207,6 @@
|
|||
"while"
|
||||
] @keyword.control.conditional
|
||||
|
||||
[
|
||||
"."
|
||||
","
|
||||
"|"
|
||||
] @punctuation.delimiter
|
||||
|
||||
[
|
||||
"++"
|
||||
"+"
|
||||
"+."
|
||||
"-"
|
||||
"-."
|
||||
"*"
|
||||
"**"
|
||||
"*."
|
||||
"/."
|
||||
"<="
|
||||
"=="
|
||||
"==="
|
||||
"!"
|
||||
"!="
|
||||
"!=="
|
||||
">="
|
||||
"&&"
|
||||
"||"
|
||||
"="
|
||||
":="
|
||||
"->"
|
||||
"|>"
|
||||
":>"
|
||||
"+="
|
||||
(uncurry)
|
||||
] @operator
|
||||
|
||||
; Explicitly enclose these operators with binary_expression
|
||||
; to avoid confusion with JSX tag delimiters
|
||||
(binary_expression ["<" ">" "/"] @operator)
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"{"
|
||||
"}"
|
||||
"["
|
||||
"]"
|
||||
] @punctuation.bracket
|
||||
|
||||
(polyvar_type
|
||||
[
|
||||
"["
|
||||
"[>"
|
||||
"[<"
|
||||
"]"
|
||||
] @punctuation.bracket)
|
||||
|
||||
[
|
||||
"~"
|
||||
"?"
|
||||
"=>"
|
||||
".."
|
||||
"..."
|
||||
] @punctuation.special
|
||||
|
||||
(ternary_expression ["?" ":"] @operator)
|
||||
|
||||
; JSX
|
||||
|
|
|
@ -1,3 +1,11 @@
|
|||
; Structs
|
||||
;------------
|
||||
|
||||
(enum_variant) @type.enum.variant
|
||||
(struct_entry (_) @variable.other.member ":")
|
||||
(struct_name (identifier)) @type
|
||||
(unit_struct) @type.builtin
|
||||
|
||||
; Literals
|
||||
;------------
|
||||
|
||||
|
@ -7,16 +15,6 @@
|
|||
(float) @constant.numeric.float
|
||||
(char) @constant.character
|
||||
|
||||
; Structs
|
||||
;------------
|
||||
|
||||
(enum_variant) @type.enum.variant
|
||||
(struct_entry (_) @variable.other.member ":")
|
||||
(struct_name (identifier)) @type
|
||||
|
||||
|
||||
|
||||
|
||||
; Comments
|
||||
;------------
|
||||
|
||||
|
@ -37,6 +35,7 @@
|
|||
"{" @punctuation.bracket
|
||||
"}" @punctuation.bracket
|
||||
|
||||
"-" @operator
|
||||
|
||||
; Special
|
||||
;------------
|
||||
|
|
|
@ -1,3 +1,81 @@
|
|||
; Operators
|
||||
[
|
||||
":"
|
||||
"?"
|
||||
"~"
|
||||
"=>"
|
||||
"->"
|
||||
"!"
|
||||
] @operator
|
||||
|
||||
(assignment
|
||||
"=" @operator)
|
||||
|
||||
(operator_assignment
|
||||
operator: ["+=" "-=" "*=" "**=" "/=" "||=" "|=" "&&=" "&=" "%=" ">>=" "<<=" "^="] @operator)
|
||||
|
||||
(binary
|
||||
operator: ["/" "|" "==" "===" "||" "&&" ">>" "<<" "<" ">" "<=" ">=" "&" "^" "!~" "=~" "<=>" "**" "*" "!=" "%" "-" "+"] @operator)
|
||||
|
||||
(range
|
||||
operator: [".." "..."] @operator)
|
||||
|
||||
[
|
||||
","
|
||||
";"
|
||||
"."
|
||||
"&."
|
||||
] @punctuation.delimiter
|
||||
|
||||
[
|
||||
"|"
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
"%w("
|
||||
"%i("
|
||||
] @punctuation.bracket
|
||||
|
||||
; Identifiers
|
||||
|
||||
[
|
||||
(identifier)
|
||||
] @variable
|
||||
((identifier) @function.method
|
||||
(#is-not? local))
|
||||
|
||||
[
|
||||
(class_variable)
|
||||
(instance_variable)
|
||||
] @variable.other.member
|
||||
|
||||
((identifier) @constant.builtin
|
||||
(#match? @constant.builtin "^(__FILE__|__LINE__|__ENCODING__)$"))
|
||||
|
||||
((constant) @constant.builtin
|
||||
(#match? @constant.builtin "^(ENV|ARGV|ARGF|RUBY_PLATFORM|RUBY_RELEASE_DATE|RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING)$"))
|
||||
|
||||
((constant) @constant
|
||||
(#match? @constant "^[A-Z\\d_]+$"))
|
||||
|
||||
(constant) @constructor
|
||||
|
||||
(self) @variable.builtin
|
||||
(super) @function.builtin
|
||||
|
||||
[(forward_parameter)(forward_argument)] @variable.parameter
|
||||
(keyword_parameter name:((_)":" @variable.parameter) @variable.parameter)
|
||||
(optional_parameter name:((_)"=" @operator) @variable.parameter)
|
||||
(optional_parameter name: (identifier) @variable.parameter)
|
||||
(splat_parameter name: (identifier) @variable.parameter) @variable.parameter
|
||||
(hash_splat_parameter name: (identifier) @variable.parameter) @variable.parameter
|
||||
(method_parameters (identifier) @variable.parameter)
|
||||
(block_parameter (identifier) @variable.parameter)
|
||||
(block_parameters (identifier) @variable.parameter)
|
||||
|
||||
; Keywords
|
||||
|
||||
[
|
||||
|
@ -73,43 +151,6 @@
|
|||
(method name: [(identifier) (constant)] @function.method)
|
||||
(singleton_method name: [(identifier) (constant)] @function.method)
|
||||
|
||||
; Identifiers
|
||||
|
||||
[
|
||||
(class_variable)
|
||||
(instance_variable)
|
||||
] @variable.other.member
|
||||
|
||||
((identifier) @constant.builtin
|
||||
(#match? @constant.builtin "^(__FILE__|__LINE__|__ENCODING__)$"))
|
||||
|
||||
((constant) @constant.builtin
|
||||
(#match? @constant.builtin "^(ENV|ARGV|ARGF|RUBY_PLATFORM|RUBY_RELEASE_DATE|RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING)$"))
|
||||
|
||||
((constant) @constant
|
||||
(#match? @constant "^[A-Z\\d_]+$"))
|
||||
|
||||
(constant) @constructor
|
||||
|
||||
(self) @variable.builtin
|
||||
(super) @function.builtin
|
||||
|
||||
[(forward_parameter)(forward_argument)] @variable.parameter
|
||||
(keyword_parameter name:((_)":" @variable.parameter) @variable.parameter)
|
||||
(optional_parameter name:((_)"=" @operator) @variable.parameter)
|
||||
(optional_parameter name: (identifier) @variable.parameter)
|
||||
(splat_parameter name: (identifier) @variable.parameter) @variable.parameter
|
||||
(hash_splat_parameter name: (identifier) @variable.parameter) @variable.parameter
|
||||
(method_parameters (identifier) @variable.parameter)
|
||||
(block_parameter (identifier) @variable.parameter)
|
||||
(block_parameters (identifier) @variable.parameter)
|
||||
|
||||
((identifier) @function.method
|
||||
(#is-not? local))
|
||||
[
|
||||
(identifier)
|
||||
] @variable
|
||||
|
||||
; Literals
|
||||
|
||||
[
|
||||
|
@ -147,44 +188,3 @@
|
|||
"}" @punctuation.special) @embedded
|
||||
|
||||
(comment) @comment
|
||||
|
||||
; Operators
|
||||
[
|
||||
":"
|
||||
"?"
|
||||
"~"
|
||||
"=>"
|
||||
"->"
|
||||
"!"
|
||||
] @operator
|
||||
|
||||
(assignment
|
||||
"=" @operator)
|
||||
|
||||
(operator_assignment
|
||||
operator: ["+=" "-=" "*=" "**=" "/=" "||=" "|=" "&&=" "&=" "%=" ">>=" "<<=" "^="] @operator)
|
||||
|
||||
(binary
|
||||
operator: ["/" "|" "==" "===" "||" "&&" ">>" "<<" "<" ">" "<=" ">=" "&" "^" "!~" "=~" "<=>" "**" "*" "!=" "%" "-" "+"] @operator)
|
||||
|
||||
(range
|
||||
operator: [".." "..."] @operator)
|
||||
|
||||
[
|
||||
","
|
||||
";"
|
||||
"."
|
||||
"&."
|
||||
] @punctuation.delimiter
|
||||
|
||||
[
|
||||
"|"
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
"%w("
|
||||
"%i("
|
||||
] @punctuation.bracket
|
||||
|
|
|
@ -1,10 +1,90 @@
|
|||
; -------
|
||||
; Tree-Sitter doesn't allow overrides in regards to captures,
|
||||
; though it is possible to affect the child node of a captured
|
||||
; node. Thus, the approach here is to flip the order so that
|
||||
; overrides are unnecessary.
|
||||
; Basic identifiers
|
||||
; -------
|
||||
|
||||
; We do not style ? as an operator on purpose as it allows styling ? differently, as many highlighters do. @operator.special might have been a better scope, but @special is already documented so the change would break themes (including the intent of the default theme)
|
||||
"?" @special
|
||||
|
||||
(type_identifier) @type
|
||||
(identifier) @variable
|
||||
(field_identifier) @variable.other.member
|
||||
|
||||
; -------
|
||||
; Operators
|
||||
; -------
|
||||
|
||||
[
|
||||
"*"
|
||||
"'"
|
||||
"->"
|
||||
"=>"
|
||||
"<="
|
||||
"="
|
||||
"=="
|
||||
"!"
|
||||
"!="
|
||||
"%"
|
||||
"%="
|
||||
"&"
|
||||
"&="
|
||||
"&&"
|
||||
"|"
|
||||
"|="
|
||||
"||"
|
||||
"^"
|
||||
"^="
|
||||
"*"
|
||||
"*="
|
||||
"-"
|
||||
"-="
|
||||
"+"
|
||||
"+="
|
||||
"/"
|
||||
"/="
|
||||
">"
|
||||
"<"
|
||||
">="
|
||||
">>"
|
||||
"<<"
|
||||
">>="
|
||||
"<<="
|
||||
"@"
|
||||
".."
|
||||
"..="
|
||||
"'"
|
||||
] @operator
|
||||
|
||||
; -------
|
||||
; Paths
|
||||
; -------
|
||||
|
||||
(use_declaration
|
||||
argument: (identifier) @namespace)
|
||||
(use_wildcard
|
||||
(identifier) @namespace)
|
||||
(extern_crate_declaration
|
||||
name: (identifier) @namespace
|
||||
alias: (identifier)? @namespace)
|
||||
(mod_item
|
||||
name: (identifier) @namespace)
|
||||
(scoped_use_list
|
||||
path: (identifier)? @namespace)
|
||||
(use_list
|
||||
(identifier) @namespace)
|
||||
(use_as_clause
|
||||
path: (identifier)? @namespace
|
||||
alias: (identifier) @namespace)
|
||||
|
||||
; ---
|
||||
; Remaining Paths
|
||||
; ---
|
||||
|
||||
(scoped_identifier
|
||||
path: (identifier)? @namespace
|
||||
name: (identifier) @namespace)
|
||||
(scoped_type_identifier
|
||||
path: (identifier) @namespace)
|
||||
|
||||
; -------
|
||||
; Types
|
||||
; -------
|
||||
|
@ -15,6 +95,8 @@
|
|||
left: (type_identifier) @type.parameter)
|
||||
(optional_type_parameter
|
||||
name: (type_identifier) @type.parameter)
|
||||
(type_arguments
|
||||
(type_identifier))
|
||||
|
||||
; ---
|
||||
; Primitives
|
||||
|
@ -282,9 +364,42 @@
|
|||
((identifier) @constructor)
|
||||
(#match? @constructor "^[A-Z]"))
|
||||
|
||||
; -------
|
||||
; Functions
|
||||
; -------
|
||||
|
||||
(call_expression
|
||||
function: [
|
||||
((identifier) @function)
|
||||
(scoped_identifier
|
||||
name: (identifier) @function)
|
||||
(field_expression
|
||||
field: (field_identifier) @function)
|
||||
])
|
||||
(generic_function
|
||||
function: [
|
||||
((identifier) @function)
|
||||
(scoped_identifier
|
||||
name: (identifier) @function)
|
||||
(field_expression
|
||||
field: (field_identifier) @function.method)
|
||||
])
|
||||
|
||||
(function_item
|
||||
name: (identifier) @function)
|
||||
|
||||
(function_signature_item
|
||||
name: (identifier) @function)
|
||||
|
||||
; -------
|
||||
; Guess Other Types
|
||||
; -------
|
||||
; Other PascalCase identifiers are assumed to be structs.
|
||||
|
||||
((identifier) @type
|
||||
(#match? @type "^[A-Z]"))
|
||||
|
||||
(never_type "!" @type)
|
||||
|
||||
((identifier) @constant
|
||||
(#match? @constant "^[A-Z][A-Z\\d_]*$"))
|
||||
|
@ -319,42 +434,6 @@
|
|||
(#match? @type "^[A-Z]")
|
||||
(#match? @constructor "^[A-Z]")))
|
||||
|
||||
; ---
|
||||
; Other PascalCase identifiers are assumed to be structs.
|
||||
; ---
|
||||
|
||||
((identifier) @type
|
||||
(#match? @type "^[A-Z]"))
|
||||
|
||||
(never_type "!" @type)
|
||||
|
||||
; -------
|
||||
; Functions
|
||||
; -------
|
||||
|
||||
(call_expression
|
||||
function: [
|
||||
((identifier) @function)
|
||||
(scoped_identifier
|
||||
name: (identifier) @function)
|
||||
(field_expression
|
||||
field: (field_identifier) @function)
|
||||
])
|
||||
(generic_function
|
||||
function: [
|
||||
((identifier) @function)
|
||||
(scoped_identifier
|
||||
name: (identifier) @function)
|
||||
(field_expression
|
||||
field: (field_identifier) @function.method)
|
||||
])
|
||||
|
||||
(function_item
|
||||
name: (identifier) @function)
|
||||
|
||||
(function_signature_item
|
||||
name: (identifier) @function)
|
||||
|
||||
; ---
|
||||
; Macros
|
||||
; ---
|
||||
|
@ -389,90 +468,3 @@
|
|||
|
||||
(metavariable) @variable.parameter
|
||||
(fragment_specifier) @type
|
||||
|
||||
; -------
|
||||
; Operators
|
||||
; -------
|
||||
|
||||
[
|
||||
"*"
|
||||
"'"
|
||||
"->"
|
||||
"=>"
|
||||
"<="
|
||||
"="
|
||||
"=="
|
||||
"!"
|
||||
"!="
|
||||
"%"
|
||||
"%="
|
||||
"&"
|
||||
"&="
|
||||
"&&"
|
||||
"|"
|
||||
"|="
|
||||
"||"
|
||||
"^"
|
||||
"^="
|
||||
"*"
|
||||
"*="
|
||||
"-"
|
||||
"-="
|
||||
"+"
|
||||
"+="
|
||||
"/"
|
||||
"/="
|
||||
">"
|
||||
"<"
|
||||
">="
|
||||
">>"
|
||||
"<<"
|
||||
">>="
|
||||
"<<="
|
||||
"@"
|
||||
".."
|
||||
"..="
|
||||
"'"
|
||||
] @operator
|
||||
|
||||
; -------
|
||||
; Paths
|
||||
; -------
|
||||
|
||||
(use_declaration
|
||||
argument: (identifier) @namespace)
|
||||
(use_wildcard
|
||||
(identifier) @namespace)
|
||||
(extern_crate_declaration
|
||||
name: (identifier) @namespace
|
||||
alias: (identifier)? @namespace)
|
||||
(mod_item
|
||||
name: (identifier) @namespace)
|
||||
(scoped_use_list
|
||||
path: (identifier)? @namespace)
|
||||
(use_list
|
||||
(identifier) @namespace)
|
||||
(use_as_clause
|
||||
path: (identifier)? @namespace
|
||||
alias: (identifier) @namespace)
|
||||
|
||||
; ---
|
||||
; Remaining Paths
|
||||
; ---
|
||||
|
||||
(scoped_identifier
|
||||
path: (identifier)? @namespace
|
||||
name: (identifier) @namespace)
|
||||
(scoped_type_identifier
|
||||
path: (identifier) @namespace)
|
||||
|
||||
; -------
|
||||
; Remaining Identifiers
|
||||
; -------
|
||||
|
||||
; We do not style ? as an operator on purpose as it allows styling ? differently, as many highlighters do. @operator.special might have been a better scope, but @special is already documented so the change would break themes (including the intent of the default theme)
|
||||
"?" @special
|
||||
|
||||
(type_identifier) @type
|
||||
(identifier) @variable
|
||||
(field_identifier) @variable.other.member
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
|
||||
;; variables
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
(operator_identifier) @operator
|
||||
|
||||
((identifier) @variable.builtin
|
||||
(#match? @variable.builtin "^this$"))
|
||||
|
@ -262,7 +265,3 @@
|
|||
|
||||
(case_block
|
||||
(case_clause ("case") @keyword.control.conditional))
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
(operator_identifier) @operator
|
||||
|
|
|
@ -10,32 +10,28 @@
|
|||
(block_comment) @comment.block
|
||||
(directive) @keyword.directive
|
||||
|
||||
; operators
|
||||
; variables
|
||||
|
||||
((symbol) @operator
|
||||
(#match? @operator "^(\\+|-|\\*|/|=|>|<|>=|<=)$"))
|
||||
((symbol) @variable.builtin
|
||||
(#eq? @variable.builtin "..."))
|
||||
|
||||
; keywords
|
||||
((symbol) @variable.builtin
|
||||
(#eq? @variable.builtin "."))
|
||||
|
||||
(symbol) @variable
|
||||
|
||||
["(" ")" "[" "]" "{" "}"] @punctuation.bracket
|
||||
|
||||
(quote "'") @operator
|
||||
(unquote_splicing ",@") @operator
|
||||
(unquote ",") @operator
|
||||
(quasiquote "`") @operator
|
||||
|
||||
; procedure
|
||||
|
||||
(list
|
||||
.
|
||||
((symbol) @keyword.conditional
|
||||
(#match? @keyword.conditional "^(if|cond|case|when|unless)$"
|
||||
)))
|
||||
|
||||
(list
|
||||
.
|
||||
(symbol) @keyword
|
||||
(#match? @keyword
|
||||
"^(define-syntax|let\\*|lambda|λ|case|=>|quote-splicing|unquote-splicing|set!|let|letrec|letrec-syntax|let-values|let\\*-values|do|else|define|cond|syntax-rules|unquote|begin|quote|let-syntax|and|if|quasiquote|letrec|delay|or|when|unless|identifier-syntax|assert|library|export|import|rename|only|except|prefix)$"
|
||||
))
|
||||
|
||||
(list
|
||||
.
|
||||
(symbol) @function.builtin
|
||||
(#match? @function.builtin
|
||||
"^(caar|cadr|call-with-input-file|call-with-output-file|cdar|cddr|list|open-input-file|open-output-file|with-input-from-file|with-output-to-file|\\*|\\+|-|/|<|<=|=|>|>=|abs|acos|angle|append|apply|asin|assoc|assq|assv|atan|boolean\\?|caaaar|caaadr|caaar|caadar|caaddr|caadr|cadaar|cadadr|cadar|caddar|cadddr|caddr|call-with-current-continuation|call-with-values|car|cdaaar|cdaadr|cdaar|cdadar|cdaddr|cdadr|cddaar|cddadr|cddar|cdddar|cddddr|cdddr|cdr|ceiling|char->integer|char-alphabetic\\?|char-ci<=\\?|char-ci<\\?|char-ci=\\?|char-ci>=\\?|char-ci>\\?|char-downcase|char-lower-case\\?|char-numeric\\?|char-ready\\?|char-upcase|char-upper-case\\?|char-whitespace\\?|char<=\\?|char<\\?|char=\\?|char>=\\?|char>\\?|char\\?|close-input-port|close-output-port|complex\\?|cons|cos|current-error-port|current-input-port|current-output-port|denominator|display|dynamic-wind|eof-object\\?|eq\\?|equal\\?|eqv\\?|eval|even\\?|exact->inexact|exact\\?|exp|expt|floor|flush-output|for-each|force|gcd|imag-part|inexact->exact|inexact\\?|input-port\\?|integer->char|integer\\?|interaction-environment|lcm|length|list->string|list->vector|list-ref|list-tail|list\\?|load|log|magnitude|make-polar|make-rectangular|make-string|make-vector|map|max|member|memq|memv|min|modulo|negative\\?|newline|not|null-environment|null\\?|number->string|number\\?|numerator|odd\\?|output-port\\?|pair\\?|peek-char|positive\\?|procedure\\?|quotient|rational\\?|rationalize|read|read-char|real-part|real\\?|remainder|reverse|round|scheme-report-environment|set-car!|set-cdr!|sin|sqrt|string|string->list|string->number|string->symbol|string-append|string-ci<=\\?|string-ci<\\?|string-ci=\\?|string-ci>=\\?|string-ci>\\?|string-copy|string-fill!|string-length|string-ref|string-set!|string<=\\?|string<\\?|string=\\?|string>=\\?|string>\\?|string\\?|substring|symbol->string|symbol\\?|tan|transcript-off|transcript-on|truncate|values|vector|vector->list|vector-fill!|vector-length|vector-ref|vector-set!|vector\\?|write|write-char|zero\\?)$"
|
||||
))
|
||||
(symbol) @function)
|
||||
|
||||
; special forms
|
||||
|
||||
|
@ -62,12 +58,10 @@
|
|||
(#match? @_f
|
||||
"^(let|let\\*|let-syntax|let-values|let\\*-values|letrec|letrec\\*|letrec-syntax)$"))
|
||||
|
||||
; quote
|
||||
; operators
|
||||
|
||||
(list
|
||||
.
|
||||
(symbol) @_f
|
||||
(#eq? @_f "quote")) @string.symbol
|
||||
((symbol) @operator
|
||||
(#match? @operator "^(\\+|-|\\*|/|=|>|<|>=|<=)$"))
|
||||
|
||||
; library
|
||||
|
||||
|
@ -79,26 +73,31 @@
|
|||
|
||||
(#eq? @_lib "library"))
|
||||
|
||||
; procedure
|
||||
; quote
|
||||
|
||||
(list
|
||||
.
|
||||
(symbol) @_f
|
||||
(#eq? @_f "quote")) @string.symbol
|
||||
|
||||
; keywords
|
||||
|
||||
(list
|
||||
.
|
||||
(symbol) @function)
|
||||
|
||||
;; variables
|
||||
|
||||
((symbol) @variable.builtin
|
||||
(#eq? @variable.builtin "..."))
|
||||
|
||||
((symbol) @variable.builtin
|
||||
(#eq? @variable.builtin "."))
|
||||
|
||||
(symbol) @variable
|
||||
|
||||
["(" ")" "[" "]" "{" "}"] @punctuation.bracket
|
||||
|
||||
(quote "'") @operator
|
||||
(unquote_splicing ",@") @operator
|
||||
(unquote ",") @operator
|
||||
(quasiquote "`") @operator
|
||||
((symbol) @keyword.conditional
|
||||
(#match? @keyword.conditional "^(if|cond|case|when|unless)$"
|
||||
)))
|
||||
|
||||
(list
|
||||
.
|
||||
(symbol) @keyword
|
||||
(#match? @keyword
|
||||
"^(define-syntax|let\\*|lambda|λ|case|=>|quote-splicing|unquote-splicing|set!|let|letrec|letrec-syntax|let-values|let\\*-values|do|else|define|cond|syntax-rules|unquote|begin|quote|let-syntax|and|if|quasiquote|letrec|delay|or|when|unless|identifier-syntax|assert|library|export|import|rename|only|except|prefix)$"
|
||||
))
|
||||
|
||||
(list
|
||||
.
|
||||
(symbol) @function.builtin
|
||||
(#match? @function.builtin
|
||||
"^(caar|cadr|call-with-input-file|call-with-output-file|cdar|cddr|list|open-input-file|open-output-file|with-input-from-file|with-output-to-file|\\*|\\+|-|/|<|<=|=|>|>=|abs|acos|angle|append|apply|asin|assoc|assq|assv|atan|boolean\\?|caaaar|caaadr|caaar|caadar|caaddr|caadr|cadaar|cadadr|cadar|caddar|cadddr|caddr|call-with-current-continuation|call-with-values|car|cdaaar|cdaadr|cdaar|cdadar|cdaddr|cdadr|cddaar|cddadr|cddar|cdddar|cddddr|cdddr|cdr|ceiling|char->integer|char-alphabetic\\?|char-ci<=\\?|char-ci<\\?|char-ci=\\?|char-ci>=\\?|char-ci>\\?|char-downcase|char-lower-case\\?|char-numeric\\?|char-ready\\?|char-upcase|char-upper-case\\?|char-whitespace\\?|char<=\\?|char<\\?|char=\\?|char>=\\?|char>\\?|char\\?|close-input-port|close-output-port|complex\\?|cons|cos|current-error-port|current-input-port|current-output-port|denominator|display|dynamic-wind|eof-object\\?|eq\\?|equal\\?|eqv\\?|eval|even\\?|exact->inexact|exact\\?|exp|expt|floor|flush-output|for-each|force|gcd|imag-part|inexact->exact|inexact\\?|input-port\\?|integer->char|integer\\?|interaction-environment|lcm|length|list->string|list->vector|list-ref|list-tail|list\\?|load|log|magnitude|make-polar|make-rectangular|make-string|make-vector|map|max|member|memq|memv|min|modulo|negative\\?|newline|not|null-environment|null\\?|number->string|number\\?|numerator|odd\\?|output-port\\?|pair\\?|peek-char|positive\\?|procedure\\?|quotient|rational\\?|rationalize|read|read-char|real-part|real\\?|remainder|reverse|round|scheme-report-environment|set-car!|set-cdr!|sin|sqrt|string|string->list|string->number|string->symbol|string-append|string-ci<=\\?|string-ci<\\?|string-ci=\\?|string-ci>=\\?|string-ci>\\?|string-copy|string-fill!|string-length|string-ref|string-set!|string<=\\?|string<\\?|string=\\?|string>=\\?|string>\\?|string\\?|substring|symbol->string|symbol\\?|tan|transcript-off|transcript-on|truncate|values|vector|vector->list|vector-fill!|vector-length|vector-ref|vector-set!|vector\\?|write|write-char|zero\\?)$"
|
||||
))
|
||||
|
|
|
@ -43,6 +43,8 @@
|
|||
"@warn" @constant.builtin
|
||||
"@while" @keyword.control.repeat
|
||||
|
||||
(property_name) @variable.other.member
|
||||
|
||||
((property_name) @variable
|
||||
(#match? @variable "^--"))
|
||||
((plain_value) @variable
|
||||
|
@ -59,7 +61,6 @@
|
|||
(class_name) @variable
|
||||
(id_name) @variable
|
||||
(namespace_name) @variable
|
||||
(property_name) @variable.other.member
|
||||
(feature_name) @variable
|
||||
(variable) @variable
|
||||
(variable_name) @variable.other.member
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
; identifiers
|
||||
; -----------
|
||||
(identifier) @variable
|
||||
((identifier) @variable.builtin (#any-of? @variable.builtin "this" "msg" "block" "tx"))
|
||||
(yul_identifier) @variable
|
||||
|
||||
; Pragma
|
||||
(pragma_directive) @keyword.directive
|
||||
(solidity_version_comparison_operator _ @keyword.directive)
|
||||
|
@ -231,10 +237,3 @@
|
|||
"delete"
|
||||
"new"
|
||||
] @keyword.operator
|
||||
|
||||
; identifiers
|
||||
; -----------
|
||||
((identifier) @variable.builtin (#any-of? @variable.builtin "this" "msg" "block" "tx"))
|
||||
(identifier) @variable
|
||||
(yul_identifier) @variable
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(syscall) @function
|
||||
(syscall) @function.builtin
|
||||
(integer) @constant.numeric
|
||||
(pointer) @constant.numeric
|
||||
(value) @label
|
||||
|
|
|
@ -1,14 +1,87 @@
|
|||
; -------
|
||||
; Tree-Sitter doesn't allow overrides in regards to captures,
|
||||
; though it is possible to affect the child node of a captured
|
||||
; node. Thus, the approach here is to flip the order so that
|
||||
; overrides are unnecessary.
|
||||
; Basic identifiers
|
||||
; -------
|
||||
|
||||
; We do not style ? as an operator on purpose as it allows styling ? differently, as many highlighters do. @operator.special might have been a better scope, but @special is already documented so the change would break themes (including the intent of the default theme)
|
||||
"?" @special
|
||||
|
||||
(type_identifier) @type
|
||||
(identifier) @variable
|
||||
(field_identifier) @variable.other.member
|
||||
|
||||
; -------
|
||||
; Types
|
||||
; Operators
|
||||
; -------
|
||||
|
||||
[
|
||||
"*"
|
||||
"'"
|
||||
"->"
|
||||
"=>"
|
||||
"<="
|
||||
"="
|
||||
"=="
|
||||
"!"
|
||||
"!="
|
||||
"%"
|
||||
"%="
|
||||
"&"
|
||||
"&="
|
||||
"&&"
|
||||
"|"
|
||||
"|="
|
||||
"||"
|
||||
"^"
|
||||
"^="
|
||||
"*"
|
||||
"*="
|
||||
"-"
|
||||
"-="
|
||||
"+"
|
||||
"+="
|
||||
"/"
|
||||
"/="
|
||||
">"
|
||||
"<"
|
||||
">="
|
||||
">>"
|
||||
"<<"
|
||||
">>="
|
||||
"<<="
|
||||
"@"
|
||||
".."
|
||||
"..="
|
||||
"'"
|
||||
] @operator
|
||||
|
||||
; -------
|
||||
; Paths
|
||||
; -------
|
||||
|
||||
(use_declaration
|
||||
argument: (identifier) @namespace)
|
||||
(use_wildcard
|
||||
(identifier) @namespace)
|
||||
(dep_item
|
||||
name: (identifier) @namespace)
|
||||
(scoped_use_list
|
||||
path: (identifier)? @namespace)
|
||||
(use_list
|
||||
(identifier) @namespace)
|
||||
(use_as_clause
|
||||
path: (identifier)? @namespace
|
||||
alias: (identifier) @namespace)
|
||||
|
||||
; ---
|
||||
; Remaining Paths
|
||||
; ---
|
||||
|
||||
(scoped_identifier
|
||||
path: (identifier)? @namespace
|
||||
name: (identifier) @namespace)
|
||||
(scoped_type_identifier
|
||||
path: (identifier) @namespace)
|
||||
|
||||
; ---
|
||||
; Primitives
|
||||
; ---
|
||||
|
@ -179,6 +252,10 @@
|
|||
; -------
|
||||
; Guess Other Types
|
||||
; -------
|
||||
; Other PascalCase identifiers are assumed to be structs.
|
||||
|
||||
((identifier) @type
|
||||
(#match? @type "^[A-Z]"))
|
||||
|
||||
((identifier) @constant
|
||||
(#match? @constant "^[A-Z][A-Z\\d_]*$"))
|
||||
|
@ -190,40 +267,28 @@
|
|||
|
||||
(call_expression
|
||||
function: [
|
||||
((identifier) @type.enum.variant
|
||||
(#match? @type.enum.variant "^[A-Z]"))
|
||||
((identifier) @constructor
|
||||
(#match? @constructor "^[A-Z]"))
|
||||
(scoped_identifier
|
||||
name: ((identifier) @type.enum.variant
|
||||
(#match? @type.enum.variant "^[A-Z]")))
|
||||
name: ((identifier) @constructor
|
||||
(#match? @constructor "^[A-Z]")))
|
||||
])
|
||||
|
||||
; ---
|
||||
; Assume that types in match arms are enums and not
|
||||
; tuple structs. Same for `if let` expressions.
|
||||
; PascalCase identifiers under a path which is also PascalCase
|
||||
; are assumed to be constructors if they have methods or fields.
|
||||
; ---
|
||||
|
||||
(match_pattern
|
||||
(scoped_identifier
|
||||
name: (identifier) @constructor))
|
||||
(tuple_struct_pattern
|
||||
type: [
|
||||
((identifier) @constructor)
|
||||
(scoped_identifier
|
||||
name: (identifier) @constructor)
|
||||
])
|
||||
(struct_pattern
|
||||
type: [
|
||||
((type_identifier) @constructor)
|
||||
(scoped_type_identifier
|
||||
name: (type_identifier) @constructor)
|
||||
])
|
||||
|
||||
; ---
|
||||
; Other PascalCase identifiers are assumed to be structs.
|
||||
; ---
|
||||
|
||||
((identifier) @type
|
||||
(#match? @type "^[A-Z]"))
|
||||
(field_expression
|
||||
value: (scoped_identifier
|
||||
path: [
|
||||
(identifier) @type
|
||||
(scoped_identifier
|
||||
name: (identifier) @type)
|
||||
]
|
||||
name: (identifier) @constructor
|
||||
(#match? @type "^[A-Z]")
|
||||
(#match? @constructor "^[A-Z]")))
|
||||
|
||||
; -------
|
||||
; Functions
|
||||
|
@ -251,86 +316,3 @@
|
|||
|
||||
(function_signature_item
|
||||
name: (identifier) @function)
|
||||
|
||||
; -------
|
||||
; Operators
|
||||
; -------
|
||||
|
||||
[
|
||||
"*"
|
||||
"'"
|
||||
"->"
|
||||
"=>"
|
||||
"<="
|
||||
"="
|
||||
"=="
|
||||
"!"
|
||||
"!="
|
||||
"%"
|
||||
"%="
|
||||
"&"
|
||||
"&="
|
||||
"&&"
|
||||
"|"
|
||||
"|="
|
||||
"||"
|
||||
"^"
|
||||
"^="
|
||||
"*"
|
||||
"*="
|
||||
"-"
|
||||
"-="
|
||||
"+"
|
||||
"+="
|
||||
"/"
|
||||
"/="
|
||||
">"
|
||||
"<"
|
||||
">="
|
||||
">>"
|
||||
"<<"
|
||||
">>="
|
||||
"<<="
|
||||
"@"
|
||||
".."
|
||||
"..="
|
||||
"'"
|
||||
] @operator
|
||||
|
||||
; -------
|
||||
; Paths
|
||||
; -------
|
||||
|
||||
(use_declaration
|
||||
argument: (identifier) @namespace)
|
||||
(use_wildcard
|
||||
(identifier) @namespace)
|
||||
(dep_item
|
||||
name: (identifier) @namespace)
|
||||
(scoped_use_list
|
||||
path: (identifier)? @namespace)
|
||||
(use_list
|
||||
(identifier) @namespace)
|
||||
(use_as_clause
|
||||
path: (identifier)? @namespace
|
||||
alias: (identifier) @namespace)
|
||||
|
||||
; ---
|
||||
; Remaining Paths
|
||||
; ---
|
||||
|
||||
(scoped_identifier
|
||||
path: (identifier)? @namespace
|
||||
name: (identifier) @namespace)
|
||||
(scoped_type_identifier
|
||||
path: (identifier) @namespace)
|
||||
|
||||
; -------
|
||||
; Remaining Identifiers
|
||||
; -------
|
||||
|
||||
"?" @special
|
||||
|
||||
(type_identifier) @type
|
||||
(identifier) @variable
|
||||
(field_identifier) @variable.other.member
|
||||
|
|
|
@ -6,7 +6,48 @@
|
|||
["." ";" ":" "," ] @punctuation.delimiter
|
||||
["(" ")" "[" "]" "{" "}" "<" ">"] @punctuation.bracket
|
||||
|
||||
; Operators
|
||||
[
|
||||
"!"
|
||||
"?"
|
||||
"+"
|
||||
"-"
|
||||
"\\"
|
||||
"*"
|
||||
"/"
|
||||
"%"
|
||||
"="
|
||||
"+="
|
||||
"-="
|
||||
"*="
|
||||
"/="
|
||||
"<"
|
||||
">"
|
||||
"<="
|
||||
">="
|
||||
"++"
|
||||
"--"
|
||||
"&"
|
||||
"~"
|
||||
"%="
|
||||
"!="
|
||||
"!=="
|
||||
"=="
|
||||
"==="
|
||||
"??"
|
||||
|
||||
"->"
|
||||
|
||||
"..<"
|
||||
"..."
|
||||
(custom_operator)
|
||||
] @operator
|
||||
|
||||
"?" @type
|
||||
(type_annotation "!" @type)
|
||||
|
||||
; Identifiers
|
||||
(simple_identifier) @variable
|
||||
(attribute) @variable
|
||||
(type_identifier) @type
|
||||
(self_expression) @variable.builtin
|
||||
|
@ -153,48 +194,6 @@
|
|||
(boolean_literal) @constant.builtin.boolean
|
||||
"nil" @constant.builtin
|
||||
|
||||
"?" @type
|
||||
(type_annotation "!" @type)
|
||||
|
||||
(simple_identifier) @variable
|
||||
|
||||
; Operators
|
||||
[
|
||||
"!"
|
||||
"?"
|
||||
"+"
|
||||
"-"
|
||||
"\\"
|
||||
"*"
|
||||
"/"
|
||||
"%"
|
||||
"="
|
||||
"+="
|
||||
"-="
|
||||
"*="
|
||||
"/="
|
||||
"<"
|
||||
">"
|
||||
"<="
|
||||
">="
|
||||
"++"
|
||||
"--"
|
||||
"&"
|
||||
"~"
|
||||
"%="
|
||||
"!="
|
||||
"!=="
|
||||
"=="
|
||||
"==="
|
||||
"??"
|
||||
|
||||
"->"
|
||||
|
||||
"..<"
|
||||
"..."
|
||||
(custom_operator)
|
||||
] @operator
|
||||
|
||||
(value_parameter_pack ["each" @keyword])
|
||||
(value_pack_expansion ["repeat" @keyword])
|
||||
(type_parameter_pack ["each" @keyword])
|
||||
|
|
|
@ -81,6 +81,10 @@
|
|||
"."
|
||||
] @punctuation.delimiter
|
||||
|
||||
; HLL variables
|
||||
(identifier) @variable
|
||||
(hll_field_identifier) @variable.other.member
|
||||
|
||||
|
||||
; Strings and others literal types
|
||||
(access_class) @constant.builtin
|
||||
|
@ -219,9 +223,5 @@
|
|||
command: (identifier) @keyword.control.loop)
|
||||
|
||||
|
||||
; HLL variables
|
||||
(identifier) @variable
|
||||
(hll_field_identifier) @variable.other.member
|
||||
|
||||
|
||||
(comment) @comment
|
||||
|
|
|
@ -9,40 +9,90 @@
|
|||
"@interface"
|
||||
] @attribute
|
||||
|
||||
; comment.line
|
||||
; ------------
|
||||
; operator
|
||||
; --------
|
||||
|
||||
((comment) @comment.line
|
||||
(#match? @comment.line "^//"))
|
||||
[
|
||||
"-" "-="
|
||||
"+" "+="
|
||||
"*" "*="
|
||||
"/" "/="
|
||||
"%" "%="
|
||||
"=" "=="
|
||||
"!" "!=" "!!"
|
||||
"<" "<=" "<<"
|
||||
">" ">=" ">>"
|
||||
"&" "|"
|
||||
"&&" "||"
|
||||
] @operator
|
||||
|
||||
; punctuation.bracket
|
||||
; -------------------
|
||||
|
||||
[
|
||||
"(" ")"
|
||||
"{" "}"
|
||||
] @punctuation.bracket
|
||||
|
||||
; punctuation.delimiter
|
||||
; ---------------------
|
||||
|
||||
[
|
||||
";"
|
||||
","
|
||||
"."
|
||||
":"
|
||||
"?"
|
||||
] @punctuation.delimiter
|
||||
|
||||
; variable
|
||||
; --------
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
; variable.builtin
|
||||
; ----------------
|
||||
|
||||
(self) @variable.builtin
|
||||
|
||||
; variable.parameter
|
||||
; ------------------
|
||||
|
||||
(parameter
|
||||
name: (identifier) @variable.parameter)
|
||||
|
||||
; variable.other.member
|
||||
; ---------------------
|
||||
|
||||
(field
|
||||
name: (identifier) @variable.other.member)
|
||||
|
||||
(contract_body
|
||||
(constant
|
||||
name: (identifier) @variable.other.member))
|
||||
|
||||
(trait_body
|
||||
(constant
|
||||
name: (identifier) @variable.other.member))
|
||||
|
||||
(field_access_expression
|
||||
name: (identifier) @variable.other.member)
|
||||
|
||||
(lvalue (_) (_) @variable.other.member)
|
||||
|
||||
(instance_argument
|
||||
name: (identifier) @variable.other.member)
|
||||
|
||||
; comment.block
|
||||
; -------------
|
||||
|
||||
(comment) @comment.block
|
||||
|
||||
; function.builtin
|
||||
; ----------------
|
||||
; comment.line
|
||||
; ------------
|
||||
|
||||
((identifier) @function.builtin
|
||||
(#any-of? @function.builtin
|
||||
"send" "sender" "require" "now"
|
||||
"myBalance" "myAddress" "newAddress"
|
||||
"contractAddress" "contractAddressExt"
|
||||
"emit" "cell" "ton"
|
||||
"beginString" "beginComment" "beginTailString" "beginStringFromBuilder" "beginCell" "emptyCell"
|
||||
"randomInt" "random"
|
||||
"checkSignature" "checkDataSignature" "sha256"
|
||||
"min" "max" "abs" "pow"
|
||||
"throw" "dump" "getConfigParam"
|
||||
"nativeThrowWhen" "nativeThrowUnless" "nativeReserve"
|
||||
"nativeRandomize" "nativeRandomizeLt" "nativePrepareRandom" "nativeRandom" "nativeRandomInterval")
|
||||
(#is-not? local))
|
||||
|
||||
; function.method
|
||||
; ---------------
|
||||
|
||||
(method_call_expression
|
||||
name: (identifier) @function.method)
|
||||
((comment) @comment.line
|
||||
(#match? @comment.line "^//"))
|
||||
|
||||
; function
|
||||
; --------
|
||||
|
@ -73,6 +123,30 @@
|
|||
(function
|
||||
name: (identifier) @function.method)
|
||||
|
||||
; function.method
|
||||
; ---------------
|
||||
|
||||
(method_call_expression
|
||||
name: (identifier) @function.method)
|
||||
|
||||
; function.builtin
|
||||
; ----------------
|
||||
|
||||
((identifier) @function.builtin
|
||||
(#any-of? @function.builtin
|
||||
"send" "sender" "require" "now"
|
||||
"myBalance" "myAddress" "newAddress"
|
||||
"contractAddress" "contractAddressExt"
|
||||
"emit" "cell" "ton"
|
||||
"beginString" "beginComment" "beginTailString" "beginStringFromBuilder" "beginCell" "emptyCell"
|
||||
"randomInt" "random"
|
||||
"checkSignature" "checkDataSignature" "sha256"
|
||||
"min" "max" "abs" "pow"
|
||||
"throw" "dump" "getConfigParam"
|
||||
"nativeThrowWhen" "nativeThrowUnless" "nativeReserve"
|
||||
"nativeRandomize" "nativeRandomizeLt" "nativePrepareRandom" "nativeRandom" "nativeRandomInterval")
|
||||
(#is-not? local))
|
||||
|
||||
; keyword.control.conditional
|
||||
; ---------------------------
|
||||
|
||||
|
@ -169,16 +243,21 @@
|
|||
(constant
|
||||
name: (identifier) @constant)
|
||||
|
||||
; string
|
||||
; ------
|
||||
|
||||
(string) @string
|
||||
|
||||
; string.special.path
|
||||
; -------------------
|
||||
|
||||
(import_statement
|
||||
library: (string) @string.special.path)
|
||||
|
||||
; string
|
||||
; ------
|
||||
; type
|
||||
; ----
|
||||
|
||||
(string) @string
|
||||
(type_identifier) @type
|
||||
|
||||
; type.builtin
|
||||
; ------------
|
||||
|
@ -209,11 +288,6 @@
|
|||
(#eq? @type.builtin "SendParameters")
|
||||
(#is-not? local))
|
||||
|
||||
; type
|
||||
; ----
|
||||
|
||||
(type_identifier) @type
|
||||
|
||||
; constructor
|
||||
; -----------
|
||||
|
||||
|
@ -222,77 +296,3 @@
|
|||
|
||||
(initOf
|
||||
name: (identifier) @constructor)
|
||||
|
||||
; operator
|
||||
; --------
|
||||
|
||||
[
|
||||
"-" "-="
|
||||
"+" "+="
|
||||
"*" "*="
|
||||
"/" "/="
|
||||
"%" "%="
|
||||
"=" "=="
|
||||
"!" "!=" "!!"
|
||||
"<" "<=" "<<"
|
||||
">" ">=" ">>"
|
||||
"&" "|"
|
||||
"&&" "||"
|
||||
] @operator
|
||||
|
||||
; punctuation.bracket
|
||||
; -------------------
|
||||
|
||||
[
|
||||
"(" ")"
|
||||
"{" "}"
|
||||
] @punctuation.bracket
|
||||
|
||||
; punctuation.delimiter
|
||||
; ---------------------
|
||||
|
||||
[
|
||||
";"
|
||||
","
|
||||
"."
|
||||
":"
|
||||
"?"
|
||||
] @punctuation.delimiter
|
||||
|
||||
; variable.other.member
|
||||
; ---------------------
|
||||
|
||||
(field
|
||||
name: (identifier) @variable.other.member)
|
||||
|
||||
(contract_body
|
||||
(constant
|
||||
name: (identifier) @variable.other.member))
|
||||
|
||||
(trait_body
|
||||
(constant
|
||||
name: (identifier) @variable.other.member))
|
||||
|
||||
(field_access_expression
|
||||
name: (identifier) @variable.other.member)
|
||||
|
||||
(lvalue (_) (_) @variable.other.member)
|
||||
|
||||
(instance_argument
|
||||
name: (identifier) @variable.other.member)
|
||||
|
||||
; variable.parameter
|
||||
; ------------------
|
||||
|
||||
(parameter
|
||||
name: (identifier) @variable.parameter)
|
||||
|
||||
; variable.builtin
|
||||
; ----------------
|
||||
|
||||
(self) @variable.builtin
|
||||
|
||||
; variable
|
||||
; --------
|
||||
|
||||
(identifier) @variable
|
||||
|
|
|
@ -36,12 +36,12 @@
|
|||
(named_node
|
||||
name: (identifier) @tag)
|
||||
|
||||
(predicate name: (identifier) @error)
|
||||
((predicate
|
||||
"#" @function.builtin
|
||||
name: (identifier) @function.builtin @_name
|
||||
type: (predicate_type) @function.builtin)
|
||||
(#any-of? @_name "eq" "not-eq" "match" "not-match" "any-of" "not-any-of" "is" "is-not" "not-same-line" "not-kind-eq" "set" "select-adjacent" "strip"))
|
||||
(predicate name: (identifier) @error)
|
||||
|
||||
(capture) @label
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
; See runtime/queries/ecma/README.md for more info.
|
||||
|
||||
; inherits: _jsx,_typescript,ecma
|
||||
; inherits: ecma,_typescript,_jsx
|
||||
|
|
|
@ -41,11 +41,6 @@
|
|||
"="
|
||||
] @punctuation.delimiter
|
||||
|
||||
(interpolated_string [
|
||||
"#{"
|
||||
"}"
|
||||
] @punctuation.delimiter)
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
|
@ -58,3 +53,8 @@
|
|||
"}"
|
||||
] @punctuation.bracket)
|
||||
|
||||
(interpolated_string [
|
||||
"#{"
|
||||
"}"
|
||||
] @punctuation.delimiter)
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
; See runtime/queries/ecma/README.md for more info.
|
||||
|
||||
; inherits: _typescript,ecma
|
||||
; inherits: ecma,_typescript
|
||||
|
|
|
@ -59,6 +59,10 @@
|
|||
|
||||
"?" @punctuation.special
|
||||
|
||||
; Identifiers
|
||||
|
||||
(identifier_or_member_expression) @type
|
||||
|
||||
; Imports
|
||||
|
||||
(import_statement
|
||||
|
@ -171,7 +175,3 @@
|
|||
] @constant.numeric.integer
|
||||
|
||||
(builtin_type) @type.builtin
|
||||
|
||||
; Identifiers
|
||||
|
||||
(identifier_or_member_expression) @type
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
(unqualified_type (symbol . (identifier) @type))
|
||||
(unqualified_type (symbol (symbol) @namespace (identifier) @type))
|
||||
|
||||
(identifier) @variable
|
||||
(attribute) @variable.other.member
|
||||
(method_declaration (symbol (symbol) @type (identifier) @function))
|
||||
(method_declaration (symbol (identifier) @function))
|
||||
|
@ -41,7 +42,6 @@
|
|||
(parameter (identifier) @variable.parameter)
|
||||
(property_declaration (symbol (identifier) @variable.other.member))
|
||||
(field_declaration (identifier) @variable)
|
||||
(identifier) @variable
|
||||
[
|
||||
(this_access)
|
||||
(base_access)
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
(float) @constant.numeric.float
|
||||
(integer) @constant.numeric.integer
|
||||
(comment) @comment
|
||||
[(path) (string) (json)] @string.special.path
|
||||
[(string) (json)] @string.special.path
|
||||
(path) @string.special.path
|
||||
(time) @string.special.symbol
|
||||
(boolean) @constant.builtin.boolean
|
||||
|
|
|
@ -89,6 +89,8 @@
|
|||
"~"
|
||||
] @operator
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
(function_declaration
|
||||
(identifier) @function)
|
||||
|
||||
|
@ -112,6 +114,4 @@
|
|||
(attribute
|
||||
(identifier) @attribute)
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
(comment) @comment
|
||||
|
|
|
@ -1,3 +1,13 @@
|
|||
(comment) @comment
|
||||
(string) @string
|
||||
(raw_string) @string
|
||||
(number) @constant.numeric.integer
|
||||
(name) @variable
|
||||
(field) @variable
|
||||
(static_field) @variable
|
||||
(null) @constant.builtin
|
||||
(boolean) @constant.builtin.boolean
|
||||
|
||||
((name) @variable.builtin
|
||||
(#match? @variable.builtin "^(Bool|Class|Fiber|Fn|List|Map|Null|Num|Object|Range|Sequence|String|System)$"))
|
||||
|
||||
|
@ -9,15 +19,6 @@
|
|||
|
||||
((parameter) @variable.parameter)
|
||||
|
||||
(comment) @comment
|
||||
(string) @string
|
||||
(raw_string) @string
|
||||
(number) @constant.numeric.integer
|
||||
(name) @variable
|
||||
(field) @variable
|
||||
(static_field) @variable
|
||||
(null) @constant.builtin
|
||||
(boolean) @constant.builtin.boolean
|
||||
|
||||
(if_statement
|
||||
[
|
||||
|
|
|
@ -1,13 +1,3 @@
|
|||
(block_mapping_pair
|
||||
key: (flow_node [(double_quote_scalar) (single_quote_scalar)] @variable.other.member))
|
||||
(block_mapping_pair
|
||||
key: (flow_node (plain_scalar (string_scalar) @variable.other.member)))
|
||||
|
||||
(flow_mapping
|
||||
(_ key: (flow_node [(double_quote_scalar) (single_quote_scalar)] @variable.other.member)))
|
||||
(flow_mapping
|
||||
(_ key: (flow_node (plain_scalar (string_scalar) @variable.other.member))))
|
||||
|
||||
(boolean_scalar) @constant.builtin.boolean
|
||||
(null_scalar) @constant.builtin
|
||||
(double_quote_scalar) @string
|
||||
|
@ -24,6 +14,16 @@
|
|||
(yaml_directive) @keyword
|
||||
(ERROR) @error
|
||||
|
||||
(block_mapping_pair
|
||||
key: (flow_node [(double_quote_scalar) (single_quote_scalar)] @variable.other.member))
|
||||
(block_mapping_pair
|
||||
key: (flow_node (plain_scalar (string_scalar) @variable.other.member)))
|
||||
|
||||
(flow_mapping
|
||||
(_ key: (flow_node [(double_quote_scalar) (single_quote_scalar)] @variable.other.member)))
|
||||
(flow_mapping
|
||||
(_ key: (flow_node (plain_scalar (string_scalar) @variable.other.member))))
|
||||
|
||||
[
|
||||
","
|
||||
"-"
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
(ident) @variable
|
||||
(index) @variable
|
||||
|
||||
; Errors
|
||||
|
||||
(ERROR) @error
|
||||
|
@ -64,6 +67,12 @@
|
|||
(function_call
|
||||
name: (ident) @function)
|
||||
|
||||
; Tags
|
||||
|
||||
; TODO apply to every symbol in list? I think it should probably only be applied to the first child of the list
|
||||
(list
|
||||
(symbol) @tag)
|
||||
|
||||
; Variables
|
||||
|
||||
(ident) @variable
|
||||
|
@ -94,14 +103,3 @@
|
|||
(loop_widget . "for" @keyword.control.repeat . (symbol) @variable . "in" @keyword.operator . (symbol) @variable)
|
||||
|
||||
(loop_widget . "for" @keyword.control.repeat . (symbol) @variable . "in" @keyword.operator)
|
||||
|
||||
; Tags
|
||||
|
||||
; TODO apply to every symbol in list? I think it should probably only be applied to the first child of the list
|
||||
(list
|
||||
(symbol) @tag)
|
||||
|
||||
; Other stuff that has not been caught by the previous queries yet
|
||||
|
||||
(ident) @variable
|
||||
(index) @variable
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue