1

Update generated neovim config

This commit is contained in:
2024-09-22 20:41:25 +02:00
parent 1743764e48
commit aa1271c42c
1247 changed files with 26512 additions and 15067 deletions

View File

@ -358,6 +358,9 @@
(preproc_pragma
(identifier) @constant)
(preproc_if
(identifier) @constant)
[
"if"
"else"
@ -367,15 +370,6 @@
"when"
] @keyword.conditional
(preproc_pragma
(identifier) @constant)
(preproc_if
(identifier) @constant)
(preproc_if
(identifier) @constant)
[
"while"
"for"

View File

@ -230,7 +230,7 @@
"private"
"protected"
"final"
(virtual)
"virtual"
] @keyword.modifier
[

View File

@ -0,0 +1,5 @@
[
(block)
(hunks)
(hunk)
] @fold

View File

@ -43,10 +43,6 @@
(statement_identifier) @label
(glimmer_opening_tag) @tag.builtin
(glimmer_closing_tag) @tag.builtin
; Function and method definitions
;--------------------------------
(function_expression

View File

@ -7,11 +7,7 @@
; html(`...`), html`...`, sql(`...`), etc.
(call_expression
function: [
(await_expression
(identifier) @injection.language)
(identifier) @injection.language
]
function: (identifier) @injection.language
arguments: [
(arguments
(template_string) @injection.content)
@ -27,13 +23,8 @@
; svg`...` or svg(`...`)
(call_expression
function: [
(await_expression
(identifier) @_name
(#eq? @_name "svg"))
((identifier) @_name
(#eq? @_name "svg"))
]
function: (identifier) @_name
(#eq? @_name "svg")
arguments: [
(arguments
(template_string) @injection.content)
@ -46,13 +37,8 @@
; Vercel PostgreSQL
; foo.sql`...` or foo.sql(`...`)
(call_expression
function: [
(await_expression
(member_expression
property: (property_identifier) @injection.language))
(member_expression
property: (property_identifier) @injection.language)
]
function: (member_expression
property: (property_identifier) @injection.language)
arguments: [
(arguments
(template_string) @injection.content)
@ -63,47 +49,29 @@
(#set! injection.include-children))
(call_expression
function: [
(await_expression
(identifier) @_name
(#eq? @_name "gql"))
((identifier) @_name
(#eq? @_name "gql"))
]
arguments: ((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "graphql")))
function: (identifier) @_name
(#eq? @_name "gql")
arguments: (template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "graphql"))
(call_expression
function: [
(await_expression
(identifier) @_name
(#eq? @_name "hbs"))
((identifier) @_name
(#eq? @_name "hbs"))
]
arguments: ((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "glimmer")))
((glimmer_template) @injection.content
function: (identifier) @_name
(#eq? @_name "hbs")
arguments: (template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "glimmer"))
; css`<css>`, keyframes`<css>`
(call_expression
function: [
(await_expression
(identifier) @_name
(#any-of? @_name "css" "keyframes"))
((identifier) @_name
(#any-of? @_name "css" "keyframes"))
]
arguments: ((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "styled")))
function: (identifier) @_name
(#any-of? @_name "css" "keyframes")
arguments: (template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "styled"))
; styled.div`<css>`
(call_expression

View File

@ -1,8 +1,7 @@
(comment) @comment @spell
; consistency with toml and ini
(section
(section_name) @type)
(section_name) @string.special.path)
(character_choice
(character) @constant)

View File

@ -0,0 +1,12 @@
[
(if_statement)
(elif_clause)
(else_clause)
(while_statement)
(repeat_statement)
(for_statement)
(atomic_statement)
(lambda)
(function)
(atomic_function)
] @fold

View File

@ -0,0 +1,208 @@
(identifier) @variable
; Functions
(assignment_statement
left: (identifier) @function
right: (function))
(assignment_statement
left: (identifier) @function
right: (atomic_function))
(assignment_statement
left: (identifier) @function
right: (lambda))
(call
function: (identifier) @function.call)
((call
function: (identifier) @function.builtin)
(#any-of? @function.builtin "Assert" "Info" "IsBound" "Unbind" "TryNextMethod"))
(parameters
(identifier) @variable.parameter)
(qualified_parameters
(identifier) @variable.parameter)
(qualified_parameters
(qualified_identifier
(identifier) @variable.parameter))
(lambda_parameters
(identifier) @variable.parameter)
; arg is treated specially when it is the only parameter of a function
((parameters
.
(identifier) @variable.parameter.builtin .)
(#eq? @variable.parameter.builtin "arg"))
((qualified_parameters
.
(identifier) @variable.parameter.builtin .)
(#eq? @variable.parameter.builtin "arg"))
((qualified_parameters
.
(qualified_identifier
(identifier) @variable.parameter.builtin) .)
(#eq? @variable.parameter.builtin "arg"))
((lambda_parameters
.
(identifier) @variable.parameter.builtin .)
(#eq? @variable.parameter.builtin "arg"))
; Literals
(bool) @constant.builtin
(integer) @number
(float) @number.float
(string) @string
(char) @character
(escape_sequence) @string.escape
[
(help_topic)
(help_book)
] @string.special
(tilde) @variable.builtin
; Record selectors
(record_entry
left: [
(identifier)
(integer)
] @variable.member)
(record_selector
selector: [
(identifier)
(integer)
] @variable.member)
(component_selector
selector: [
(identifier)
(integer)
] @variable.member)
(function_call_option
[
(identifier)
(record_entry ;Record entries specify global properties in function calls
left: [
(identifier)
(integer)
])
] @property)
(help_statement
(help_selector) @property)
; Operators
[
"+"
"-"
"*"
"/"
"^"
"->"
":="
"<"
"<="
"<>"
"="
">"
">="
".."
(ellipsis)
] @operator
(help_statement
(help_operator) @operator)
; Keywords
[
(break_statement)
(continue_statement)
"atomic"
(quit_statement)
] @keyword
[
"function"
"local"
"end"
] @keyword.function
[
"and"
"in"
"mod"
"not"
"or"
] @keyword.operator
"rec" @keyword.type
[
"readonly"
"readwrite"
] @keyword.modifier
(atomic_function
"atomic" @keyword.modifier)
[
"for"
"while"
"do"
"od"
"repeat"
"until"
] @keyword.repeat
[
"if"
"then"
"elif"
"else"
"fi"
] @keyword.conditional
"return" @keyword.return
(pragma) @keyword.directive
;Punctuation
[
","
";"
"."
"!."
":"
] @punctuation.delimiter
[
"("
")"
"["
"!["
"]"
"{"
"}"
] @punctuation.bracket
(help_statement
"?" @punctuation.special)
;Comments
(comment) @comment @spell

View File

@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,43 @@
[
(lambda)
(function)
(atomic_function)
] @local.scope
(parameters
(identifier) @local.definition.parameter)
(qualified_parameters
(identifier) @local.definition.parameter)
(qualified_parameters
(qualified_identifier
(identifier) @local.definition.parameter))
(lambda_parameters
(identifier) @local.definition.parameter)
(locals
(identifier) @local.definition.var)
(record_entry
left: [
(identifier)
(integer)
] @local.definition.field)
(assignment_statement
left: (identifier) @local.definition.var)
(for_statement
identifier: (identifier) @local.definition.var)
(assignment_statement
left: (identifier) @local.definition.function
right: [
(lambda)
(function)
(atomic_function)
])
(identifier) @local.reference

View File

@ -0,0 +1,7 @@
[
(if_statement)
(else_clause)
(local_statement)
(exec_statement)
(test_case)
] @fold

View File

@ -0,0 +1,19 @@
(output_line) @markup.raw.block
[
"#@local"
"#@exec"
] @keyword
[
"gap> "
"> "
] @keyword.debug
[
"#@if"
"#@else"
"#@fi"
] @keyword.conditional
(comment) @comment @spell

View File

@ -0,0 +1,9 @@
((comment) @injection.content
(#set! injection.language "comment"))
((gap_expression) @injection.content
(#set! injection.language "gap"))
((input_line) @injection.content
(#set! injection.language "gap")
(#set! injection.combined))

View File

@ -1,5 +1,5 @@
; Sections
(section_name) @type
(section_name) @markup.heading
((section_name) @keyword.import
(#eq? @keyword.import "include"))

View File

@ -24,6 +24,9 @@
; References
(identifier) @local.reference
; Block Scope
(block) @local.scope
; Function Body Scope
(function_body) @local.scope

View File

@ -1,2 +1,21 @@
; comments
((comment_statement) @injection.content
(#set! injection.language "comment"))
; <style> tags
((element_node
(element_node_start
(tag_name) @_tag_name
(#eq? @_tag_name "style"))) @injection.content
(#offset! @injection.content 0 7 0 -8)
(#set! injection.language "css")
(#set! injection.include-children))
; <script> tags
((element_node
(element_node_start
(tag_name) @_tag_name
(#eq? @_tag_name "script"))) @injection.content
(#offset! @injection.content 0 8 0 -9)
(#set! injection.language "glimmer_javascript")
(#set! injection.include-children))

View File

@ -0,0 +1,61 @@
; inherits: ecma
(glimmer_opening_tag) @tag.builtin
(glimmer_closing_tag) @tag.builtin
; Copied from javascript
; Parameters
(formal_parameters
(identifier) @variable.parameter)
(formal_parameters
(rest_pattern
(identifier) @variable.parameter))
; ({ a }) => null
(formal_parameters
(object_pattern
(shorthand_property_identifier_pattern) @variable.parameter))
; ({ a = b }) => null
(formal_parameters
(object_pattern
(object_assignment_pattern
(shorthand_property_identifier_pattern) @variable.parameter)))
; ({ a: b }) => null
(formal_parameters
(object_pattern
(pair_pattern
value: (identifier) @variable.parameter)))
; ([ a ]) => null
(formal_parameters
(array_pattern
(identifier) @variable.parameter))
; ({ a } = { a }) => null
(formal_parameters
(assignment_pattern
(object_pattern
(shorthand_property_identifier_pattern) @variable.parameter)))
; ({ a = b } = { a }) => null
(formal_parameters
(assignment_pattern
(object_pattern
(object_assignment_pattern
(shorthand_property_identifier_pattern) @variable.parameter))))
; a => null
(arrow_function
parameter: (identifier) @variable.parameter)
; optional parameters
(formal_parameters
(assignment_pattern
left: (identifier) @variable.parameter))
; punctuation
(optional_chain) @punctuation.delimiter

View File

@ -0,0 +1,5 @@
; inherits: ecma
(glimmer_opening_tag) @indent.begin
(glimmer_closing_tag) @indent.end

View File

@ -0,0 +1,15 @@
; inherits: ecma
; Parse Ember/Glimmer/Handlebars/HTMLBars/etc. template literals
; e.g.: await render(hbs`<SomeComponent />`)
(call_expression
function: ((identifier) @_name
(#eq? @_name "hbs"))
arguments: ((template_string) @glimmer
(#offset! @glimmer 0 1 0 -1)))
; Ember Unified <template> syntax
; e.g.: <template><SomeComponent @arg={{double @value}} /></template>
((glimmer_template) @injection.content
(#set! injection.language "glimmer")
(#set! injection.include-children))

View File

@ -0,0 +1,6 @@
; inherits: typescript
; Sub-language delimeters
(glimmer_opening_tag) @tag.builtin
(glimmer_closing_tag) @tag.builtin

View File

@ -0,0 +1,3 @@
(glimmer_opening_tag) @indent.begin
(glimmer_closing_tag) @indent.end

View File

@ -0,0 +1,15 @@
; inherits: typescript
; Parse Ember/Glimmer/Handlebars/HTMLBars/etc. template literals
; e.g.: await render(hbs`<SomeComponent />`)
(call_expression
function: ((identifier) @_name
(#eq? @_name "hbs"))
arguments: ((template_string) @glimmer
(#offset! @glimmer 0 1 0 -1)))
; Ember Unified <template> syntax
; e.g.: <template><SomeComponent @arg={{double @value}} /></template>
((glimmer_template) @injection.content
(#set! injection.language "glimmer")
(#set! injection.include-children))

View File

@ -34,7 +34,7 @@
(import_spec_list
")" @indent.branch)
(var_declaration
(var_spec_list
")" @indent.branch)
[

View File

@ -1,50 +1,36 @@
; Keywords
(scheme) @module
; Methods
(method) @function.method
; Headers
(header
name: (name) @constant)
name: (_) @constant)
; Variables
(variable_declaration
name: (identifier) @variable)
; Fields
(pair
name: (identifier) @variable.member)
; URL / Host
(host) @string.special.url
(path
(identifier) @string.special.url)
; Parameters
(query_param
(key) @variable.parameter)
; Operators
[
"="
"?"
"&"
"@"
"<"
] @operator
(comment
"=" @operator)
(variable_declaration
"=" @operator)
; keywords
(comment
"@" @keyword
name: (_) @keyword)
; Literals
(target_url) @string.special.url
(request
url: (_) @string.special.url)
(http_version) @constant
(string) @string
; Response
(status_code) @number
(number) @number
(boolean) @boolean
(status_text) @string
; Punctuation
[
@ -52,11 +38,15 @@
"}}"
] @punctuation.bracket
":" @punctuation.delimiter
(header
":" @punctuation.delimiter)
; external JSON body
(external_body
file_path: (path) @string.special.path)
path: (_) @string.special.path)
; Comments
(comment) @comment @spell
[
(comment)
(request_separator)
] @comment @spell

View File

@ -9,9 +9,16 @@
((xml_body) @injection.content
(#set! injection.language "xml"))
((graphql_body) @injection.content
((graphql_data) @injection.content
(#set! injection.language "graphql"))
; Lua scripting
((script_variable) @injection.content
(#set! injection.language "lua"))
; Script (default to javascript)
((comment
name: (_) @_name
(#eq? @_name "lang")
value: (_) @injection.language)?
.
(_
(script) @injection.content
(#offset! @injection.content 0 2 0 -2))
(#set! injection.language "javascript"))

View File

@ -168,7 +168,7 @@
(preproc_call
directive: (preproc_directive) @keyword.directive
argument: (_) @constant)
argument: (_)? @constant)
(module_dcl
(identifier) @module)

View File

@ -1,5 +1,5 @@
(section_name
(text) @type) ; consistency with toml
(text) @markup.heading)
(comment) @comment @spell
@ -13,4 +13,4 @@
(setting
(setting_name) @property)
; (setting_value) @none ; grammar does not support subtypes
(setting_value) @string

View File

@ -1,2 +1,3 @@
((comment) @injection.content
((comment
(text) @injection.content)
(#set! injection.language "comment"))

View File

@ -141,6 +141,8 @@
(constant_pattern) @constant
(boolean_pattern) @boolean
; Types
(generic_type
name: _ @type)

View File

@ -6,6 +6,7 @@
(abstract_definition)
(struct_definition)
(function_definition)
(macro_definition)
(assignment)
(const_statement)
]

View File

@ -177,7 +177,7 @@
] @number
[
"null"
(null_literal)
; should be highlighted the same as booleans
(boolean_literal)
] @boolean

View File

@ -112,10 +112,11 @@
command: _ @function.macro @nospell
keys: (curly_group_text_list) @markup.link @nospell)
(hyperlink
((hyperlink
command: _ @function @nospell
uri: (curly_group_uri
(_) @markup.link.url @nospell))
(_) @markup.link.url @nospell)) @_hyperlink
(#set! @_hyperlink url @markup.link.url))
(glossary_entry_definition
command: _ @function.macro @nospell
@ -237,6 +238,14 @@
(_) @markup.strong))
(#any-of? @_name "\\textbf" "\\mathbf"))
(generic_command
(command_name) @keyword.conditional
(#lua-match? @keyword.conditional "^\\if[a-zA-Z@]+$"))
(generic_command
(command_name) @keyword.conditional
(#any-of? @keyword.conditional "\\fi" "\\else"))
; File inclusion commands
(class_include
command: _ @keyword.import

View File

@ -1,7 +1,3 @@
(variable_identifier) @variable
(constant_identifier) @constant
[
"assert"
"assert_eq"
@ -31,6 +27,10 @@
"self" @variable.builtin
"network" @variable.builtin
"async" @keyword.coroutine
[
"finalize"
"function"
@ -113,16 +113,21 @@
(boolean_literal) @boolean
(constant_declaration
(identifier) @constant)
(identifier
(constant_identifier) @constant))
[
(program_id)
(this_program_id)
] @string.special
(variable
(constant_identifier) @constant)
(associated_constant) @constant
(variable) @variable
(program_id) @string.special
;record declaration
(record_declaration
(identifier) @variable.member)
(identifier) @type.definition)
;struct component
(struct_component_declaration
@ -130,18 +135,26 @@
(type) @type
(associated_constant) @constant
[
(block_height)
(self_address)
(self_caller)
(self_signer)
(network_id)
] @constant.builtin
(free_function_call
(locator
(identifier) @function))
(associated_function_call
(named_type
(identifier
(constant_identifier) @function)))
(associated_function_call
(identifier) @function.call)
(record_type
(locator
(identifier) @variable.member))
@ -171,11 +184,10 @@
(identifier) @variable.parameter)
(struct_declaration
name: (identifier) @variable.member)
name: (identifier) @type.definition)
(variable_declaration
(identifier_or_identifiers
(identifier) @variable))
(identifier) @variable)
[
(address_literal)
@ -189,4 +201,6 @@
(unsigned_literal)
] @number
(string_literal) @string
(annotation) @attribute

View File

@ -25,6 +25,7 @@
"as"
"assign"
"capture"
(custom_unpaired_statement)
"decrement"
"echo"
"endcapture"
@ -94,6 +95,7 @@
[
"include"
"include_relative"
"render"
"section"
"sections"

View File

@ -17,6 +17,7 @@
[
"end"
"}"
"]]"
] @indent.end
(")" @indent.end

View File

@ -114,6 +114,22 @@
")"
] @operator)
(automatic_variable
"$"
_ @character.special
(#set! priority 105))
(automatic_variable
[
"$"
"("
")"
] @operator
(#set! priority 105))
(recipe_line
"@" @character.special)
(function_call
[
"subst"

View File

@ -45,6 +45,11 @@
(link_destination) @_url
(#set! @_label url @_url))
(image
(image_description) @_label
(link_destination) @_url
(#set! @_label url @_url))
; Conceal image links
(image
[

View File

@ -211,3 +211,6 @@
(comment)
(line_continuation)
] @comment @spell
((comment) @keyword.directive
(#lua-match? @keyword.directive "^%%%% "))

View File

@ -0,0 +1,10 @@
[
(diagram_sequence)
(diagram_class)
(diagram_state)
(diagram_gantt)
(diagram_pie)
(diagram_er)
(diagram_flow)
(flow_stmt_subgraph)
] @fold

View File

@ -0,0 +1,18 @@
([
(diagram_sequence)
(diagram_class)
(diagram_state)
(diagram_gantt)
(diagram_pie)
(diagram_er)
(diagram_flow)
(flow_stmt_subgraph)
] @indent.begin
(#set! indent.immediate 1))
"end" @indent.branch
[
(ERROR)
(comment)
] @indent.auto

View File

@ -2,20 +2,31 @@
(pod) @fold
; fold the block-typed package statements only
; fold the block-typed package and class statements only
(package_statement
(block)) @fold
(class_statement
(block)) @fold
[
(subroutine_declaration_statement)
(method_declaration_statement)
(conditional_statement)
(loop_statement)
(for_statement)
(cstyle_for_statement)
(block_statement)
(defer_statement)
(phaser_statement)
] @fold
(try_statement
(block) @fold)
(eval_expression
(block) @fold)
(anonymous_subroutine_expression) @fold
; perhaps folks want to fold these too?

View File

@ -32,9 +32,18 @@
("continue" @keyword.repeat
(block))
[
"try"
"catch"
"finally"
] @keyword.exception
"return" @keyword.return
"sub" @keyword.function
[
"sub"
"method"
] @keyword.function
[
"map"
@ -42,14 +51,20 @@
"sort"
] @function.builtin
"package" @keyword.import
[
"package"
"class"
] @keyword.import
[
"defer"
"do"
"eval"
"my"
"our"
"local"
"state"
"field"
"last"
"next"
"redo"
@ -129,12 +144,18 @@
(package_statement
(package) @type)
(class_statement
(package) @type)
(require_expression
(bareword) @type)
(subroutine_declaration_statement
name: (bareword) @function)
(method_declaration_statement
name: (bareword) @function)
(attribute_name) @attribute
(attribute_value) @string

View File

@ -221,10 +221,26 @@
(name) @type
(qualified_name
(name) @type)
alias: (name) @type.definition
])
(namespace_aliasing_clause
(name) @type.definition)
(namespace_use_clause
type: "function"
[
(name) @function
(qualified_name
(name) @function)
alias: (name) @function
])
(namespace_use_clause
type: "const"
[
(name) @constant
(qualified_name
(name) @constant)
alias: (name) @constant
])
(class_interface_clause
[
@ -369,9 +385,8 @@
name: (namespace_name
(name) @module))
(namespace_name_as_prefix
(namespace_name
(name) @module))
(namespace_name
(name) @module)
; Attributes
(attribute_list) @attribute

View File

@ -13,12 +13,13 @@
(match_block)
(case_statement)
(default_statement)
(property_hook_list)
] @indent.begin
(return_statement
[
(object_creation_expression)
(anonymous_function_creation_expression)
(anonymous_function)
(arrow_function)
(match_expression)
]) @indent.dedent
@ -49,6 +50,9 @@
(return_statement
";" @indent.end)
(property_hook_list
"}" @indent.end)
(ERROR
"(" @indent.align
.

View File

@ -12,7 +12,7 @@
name: (name) @local.definition.function) @local.scope
(#set! definition.function.scope "parent"))
(anonymous_function_creation_expression
(anonymous_function
(anonymous_function_use_clause
(variable_name
(name) @local.definition.var))) @local.scope

View File

@ -0,0 +1,11 @@
[
(message_body)
(enum_body)
] @indent.begin
"}" @indent.end @indent.branch
[
(ERROR)
(comment)
] @indent.auto

View File

@ -33,7 +33,10 @@
")"
] @punctuation.bracket
":" @punctuation.delimiter
[
":"
"/"
] @punctuation.delimiter
[
"@"

View File

View File

@ -172,10 +172,10 @@
; (#is-not? local))
; Literals
[
(string)
(bare_string)
(subshell)
(heredoc_body)
(string_content)
(heredoc_content)
"\""
"`"
] @string
[
@ -190,11 +190,8 @@
(hash_key_symbol)
] @string.special.symbol
(pair
key: (hash_key_symbol)
":" @constant)
(regex) @string.regexp
(regex
(string_content) @string.regexp)
(escape_sequence) @string.escape
@ -276,8 +273,15 @@
";"
"."
"&."
"::"
] @punctuation.delimiter
(regex
"/" @punctuation.bracket)
(pair
":" @punctuation.delimiter)
[
"("
")"
@ -289,6 +293,9 @@
"%i("
] @punctuation.bracket
(block_parameters
"|" @punctuation.bracket)
(interpolation
"#{" @punctuation.special
"}" @punctuation.special) @none
"}" @punctuation.special)

View File

@ -23,6 +23,8 @@
(field_identifier) @variable.member
(shorthand_field_identifier) @variable.member
(shorthand_field_initializer
(identifier) @variable.member)
@ -212,17 +214,6 @@
(identifier) @function.macro .))
; Literals
[
(line_comment)
(block_comment)
] @comment @spell
(line_comment
(doc_comment)) @comment.documentation
(block_comment
(doc_comment)) @comment.documentation
(boolean_literal) @boolean
(integer_literal) @number
@ -461,3 +452,17 @@
macro: (identifier) @keyword.debug
"!" @keyword.debug
(#eq? @keyword.debug "dbg"))
; Comments
[
(line_comment)
(block_comment)
(outer_doc_comment_marker)
(inner_doc_comment_marker)
] @comment @spell
(line_comment
(doc_comment)) @comment.documentation
(block_comment
(doc_comment)) @comment.documentation

View File

@ -0,0 +1,48 @@
; highlights.scm
[
"|"
"|["
"]"
"("
")"
"|("
")|"
] @punctuation.bracket
[
","
";"
":"
] @punctuation.delimiter
"EXTERNAL" @keyword
"out of" @property
(number) @number
(identifier) @variable
(version) @string.special
(anonymous_block) @string
(limit) @property
(time) @function
(limit
(identifier) @string)
(event_detail
(event_detail_value) @string)
(log_level_setting
(component) @type)
(log_level_setting
(log_level) @constant)
(log_entry
(event_identifier
(identifier) @type))

View File

@ -13,10 +13,9 @@
name: _ @keyword))
; Subordinate directives (eg. input, output)
(_
body: (_
(directive
name: _ @label)))
body: (_
(directive
name: _ @label))
; rule/module/checkpoint names
(rule_definition
@ -30,11 +29,14 @@
; Rule imports
(rule_import
"use" @keyword.import
"rule" @keyword.import
"from" @keyword.import
"as"? @keyword.import
"with"? @keyword.import)
[
"use"
"rule"
"from"
"exclude"
"as"
"with"
] @keyword.import)
; Rule inheritance
(rule_inheritance
@ -44,7 +46,9 @@
; Wildcard names
(wildcard
(identifier) @variable
(identifier) @variable)
(wildcard
(flag) @variable.parameter.builtin)
; builtin variables

View File

@ -9,8 +9,17 @@
((rule_inheritance) @indent.begin
(#set! indent.immediate 1))
((rule_import
"with"
":") @indent.begin
(#set! indent.immediate 1))
((module_definition) @indent.begin
(#set! indent.immediate 1))
((directive) @indent.begin
(#set! indent.immediate 1))
; end indentation after last parameter node (no following ',')
(directive_parameters
(_) @indent.end .)

View File

@ -138,10 +138,6 @@
(instance_argument
name: (identifier) @variable.member)
(lvalue
(_)
(_) @variable.member)
(field_access_expression
name: (identifier) @variable.member)

View File

@ -71,5 +71,5 @@
(value_expression
(identifier) @local.reference)
(lvalue
(identifier) @local.reference)
(field_access_expression
name: (identifier) @local.reference)

View File

@ -7,9 +7,11 @@
(while_statement)
(if_statement)
(if_let_statement)
(elif_block)
(else_if_block)
(struct_definition)
(enum_definition)
(try_catch_statement)
(method_definition)
(import_statement)+
(initializer)
] @fold

View File

@ -8,17 +8,34 @@
(custom_type) @type
(class_field
name: (identifier) @variable.member)
name: (identifier) @property)
(struct_field
name: (identifier) @property)
(class_definition
name: (identifier) @type)
(struct_definition
name: (identifier) @type)
(interface_definition
name: (identifier) @type)
(method_definition
name: (identifier) @function.method)
(json_literal_member
(identifier) @property)
; Functions
(keyword_argument_key) @variable.parameter
(parameter_definition
name: (identifier) @variable.parameter)
(variadic) @variable.parameter.builtin
(call
caller: (reference
(nested_identifier
@ -37,24 +54,30 @@
(bool) @boolean
(builtin_type) @type.builtin
[
(builtin_type)
"MutSet"
"MutMap"
"MutArray"
"Json"
"Set"
"Map"
"Array"
"MutJson"
] @type.builtin
(json_container_type) @type.builtin
; Special
(comment) @comment @spell
[
"("
")"
"{"
"}"
] @punctuation.bracket
[
"-"
"-="
"+"
"+="
"*"
"**"
"/"
"%"
"<"
@ -68,23 +91,54 @@
"&&"
"??"
"||"
"?"
] @operator
[
"("
")"
"{"
"}"
"["
"]"
] @punctuation.bracket
(mutable_container_type
[
"<"
">"
] @punctuation.bracket)
(immutable_container_type
[
"<"
">"
] @punctuation.bracket)
[
";"
"."
","
":"
"=>"
] @punctuation.delimiter
[
"as"
"bring"
"let"
"new"
(inflight_specifier)
(phase_specifier)
"impl"
"test"
] @keyword
"class" @keyword.type
"bring" @keyword.import
[
"class"
"struct"
"interface"
] @keyword.type
[
"for"
@ -100,6 +154,26 @@
"pub"
"protected"
"internal"
"extern"
(static)
] @keyword.modifier
"return" @keyword.return
(import_statement
module_name: (identifier) @module)
(import_statement
alias: (identifier) @module)
(call
(reference
(nested_identifier
object: (reference) @_ref
property: (member_identifier) @_ident))
(argument_list
(positional_argument
(string) @string.regexp))
(#eq? @_ref "regex")
(#eq? @_ident "compile")
(#offset! @string.regexp 0 1 0 -1))

View File

@ -1,2 +1,15 @@
((comment) @injection.content
(#set! injection.language "comment"))
(call
(reference
(nested_identifier
object: (reference) @_ref
property: (member_identifier) @_ident))
(argument_list
(positional_argument
(string) @injection.content))
(#eq? @_ref "regex")
(#eq? @_ident "compile")
(#offset! @injection.content 0 1 0 -1)
(#set! injection.language "regex"))

View File

@ -1,14 +1,23 @@
[
(Block)
(ContainerDecl)
(SwitchExpr)
(InitList)
(AsmExpr)
(ErrorSetDecl)
(LINESTRING)
[
(IfPrefix)
(WhilePrefix)
(ForPrefix)
]
(block)
(switch_expression)
(initializer_list)
(asm_expression)
(multiline_string)
(if_statement)
(while_statement)
(for_statement)
(if_expression)
(else_clause)
(for_expression)
(while_expression)
(if_type_expression)
(function_signature)
(parameters)
(call_expression)
(struct_declaration)
(opaque_declaration)
(enum_declaration)
(union_declaration)
(error_set_declaration)
] @fold

View File

@ -1,104 +1,116 @@
(line_comment) @comment @spell
; Variables
(identifier) @variable
; Parameters
(parameter
name: (identifier) @variable.parameter)
(payload
(identifier) @variable.parameter)
; Types
(parameter
type: (identifier) @type)
((identifier) @type
(#lua-match? @type "^[A-Z_][a-zA-Z0-9_]*"))
(variable_declaration
(identifier) @type
"="
[
(struct_declaration)
(enum_declaration)
(union_declaration)
(opaque_declaration)
])
[
(container_doc_comment)
(doc_comment)
] @comment.documentation @spell
(builtin_type)
"anyframe"
] @type.builtin
; Constants
((identifier) @constant
(#lua-match? @constant "^[A-Z][A-Z_0-9]+$"))
[
variable: (IDENTIFIER)
variable_type_function: (IDENTIFIER)
] @variable
"null"
"unreachable"
"undefined"
] @constant.builtin
parameter: (IDENTIFIER) @variable.parameter
(field_expression
.
member: (identifier) @constant)
(enum_declaration
(container_field
type: (identifier) @constant))
; Labels
(block_label
(identifier) @label)
(break_label
(identifier) @label)
; Fields
(field_initializer
.
(identifier) @variable.member)
(field_expression
(_)
member: (identifier) @variable.member)
(container_field
name: (identifier) @variable.member)
(initializer_list
(assignment_expression
left: (field_expression
.
member: (identifier) @variable.member)))
; Functions
(builtin_identifier) @function.builtin
(call_expression
function: (identifier) @function.call)
(call_expression
function: (field_expression
member: (identifier) @function.call))
(function_declaration
name: (identifier) @function)
; Modules
(variable_declaration
(identifier) @module
(builtin_function
(builtin_identifier) @keyword.import
(#any-of? @keyword.import "@import" "@cImport")))
; Builtins
[
field_member: (IDENTIFIER)
field_access: (IDENTIFIER)
] @variable.member
"c"
"..."
] @variable.builtin
; assume TitleCase is a type
([
variable_type_function: (IDENTIFIER)
field_access: (IDENTIFIER)
parameter: (IDENTIFIER)
] @type
(#lua-match? @type "^%u([%l]+[%u%l%d]*)*$"))
; assume camelCase is a function
([
variable_type_function: (IDENTIFIER)
field_access: (IDENTIFIER)
parameter: (IDENTIFIER)
] @function
(#lua-match? @function "^%l+([%u][%l%d]*)+$"))
; assume all CAPS_1 is a constant
([
variable_type_function: (IDENTIFIER)
field_access: (IDENTIFIER)
] @constant
(#lua-match? @constant "^%u[%u%d_]+$"))
function: (IDENTIFIER) @function
function_call: (IDENTIFIER) @function.call
exception: "!" @keyword.exception
((IDENTIFIER) @variable.builtin
((identifier) @variable.builtin
(#eq? @variable.builtin "_"))
(PtrTypeStart
"c" @variable.builtin)
(ContainerDecl
(ContainerDeclType
"enum")
(ContainerField
(ErrorUnionExpr
(SuffixExpr
(IDENTIFIER) @constant))))
field_constant: (IDENTIFIER) @constant
(BUILTINIDENTIFIER) @function.builtin
((BUILTINIDENTIFIER) @keyword.import
(#any-of? @keyword.import "@import" "@cImport"))
(INTEGER) @number
(FLOAT) @number.float
[
"true"
"false"
] @boolean
[
(LINESTRING)
(STRINGLITERALSINGLE)
] @string @spell
(CHAR_LITERAL) @character
(EscapeSequence) @string.escape
(FormatSequence) @string.special
(BreakLabel
(IDENTIFIER) @label)
(BlockLabel
(IDENTIFIER) @label)
(calling_convention
(identifier) @variable.builtin)
; Keywords
[
"asm"
"defer"
"errdefer"
"test"
"opaque"
"error"
"const"
"var"
@ -108,6 +120,7 @@ field_constant: (IDENTIFIER) @constant
"struct"
"union"
"enum"
"opaque"
] @keyword.type
[
@ -151,11 +164,6 @@ field_constant: (IDENTIFIER) @constant
"catch"
] @keyword.exception
[
"anytype"
(BuildinTypeExpr)
] @type.builtin
[
"volatile"
"allowzero"
@ -168,50 +176,85 @@ field_constant: (IDENTIFIER) @constant
"inline"
"noinline"
"extern"
] @keyword.modifier
[
"comptime"
"packed"
"threadlocal"
] @attribute
] @keyword.modifier
; Operator
[
"null"
"unreachable"
"undefined"
] @constant.builtin
[
(CompareOp)
(BitwiseOp)
(BitShiftOp)
(AdditionOp)
(AssignOp)
(MultiplyOp)
(PrefixOp)
"="
"*="
"*%="
"*|="
"/="
"%="
"+="
"+%="
"+|="
"-="
"-%="
"-|="
"<<="
"<<|="
">>="
"&="
"^="
"|="
"!"
"~"
"-"
"-%"
"&"
"=="
"!="
">"
">="
"<="
"<"
"&"
"^"
"|"
"<<"
">>"
"<<|"
"+"
"++"
"+%"
"-%"
"+|"
"-|"
"*"
"/"
"%"
"**"
"->"
".?"
"*%"
"*|"
"||"
".*"
".?"
"?"
".."
] @operator
[
";"
"."
","
":"
"=>"
] @punctuation.delimiter
; Literals
(character) @character
[
".."
"..."
] @punctuation.special
([
(string)
(multiline_string)
] @string
(#set! "priority" 95))
(integer) @number
(float) @number.float
(boolean) @boolean
(escape_sequence) @string.escape
; Punctuation
[
"["
"]"
@ -221,19 +264,20 @@ field_constant: (IDENTIFIER) @constant
"}"
] @punctuation.bracket
(Payload
[
";"
"."
","
":"
"=>"
"->"
] @punctuation.delimiter
(payload
"|" @punctuation.bracket)
(PtrPayload
"|" @punctuation.bracket)
; Comments
(comment) @comment @spell
(PtrIndexPayload
"|" @punctuation.bracket)
(PtrListPayload
"|" @punctuation.bracket)
(ParamType
(ErrorUnionExpr
(SuffixExpr
variable_type_function: (IDENTIFIER) @type)))
((comment) @comment.documentation
(#lua-match? @comment.documentation "^//!"))

View File

@ -1,11 +1,10 @@
[
(Block)
(ContainerDecl)
(SwitchExpr)
(InitList)
(block)
(switch_expression)
(initializer_list)
] @indent.begin
(Block
(block
"}" @indent.end)
[
@ -18,8 +17,6 @@
] @indent.branch
[
(line_comment)
(container_doc_comment)
(doc_comment)
(LINESTRING)
(comment)
(multiline_string)
] @indent.ignore

View File

@ -1,6 +1,10 @@
([
(container_doc_comment)
(doc_comment)
(line_comment)
] @injection.content
((comment) @injection.content
(#set! injection.language "comment"))
; TODO: add when asm is added
; (asm_output_item (string) @injection.content
; (#set! injection.language "asm"))
; (asm_input_item (string) @injection.content
; (#set! injection.language "asm"))
; (asm_clobbers (string) @injection.content
; (#set! injection.language "asm"))