mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-02 03:26:52 -04:00
feat!: drop modules, general refactor and cleanup
This commit is contained in:
parent
c13e28f894
commit
2c8f2f2fad
829 changed files with 4905 additions and 8010 deletions
14
runtime/queries/ada/folds.scm
Normal file
14
runtime/queries/ada/folds.scm
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
;; Support for folding in Ada
|
||||
;; za toggles folding a package, subprogram, if statement or loop
|
||||
|
||||
[
|
||||
(package_declaration)
|
||||
(generic_package_declaration)
|
||||
(package_body)
|
||||
(subprogram_body)
|
||||
(block_statement)
|
||||
(if_statement)
|
||||
(loop_statement)
|
||||
(gnatprep_declarative_if_statement)
|
||||
(gnatprep_if_statement)
|
||||
] @fold
|
||||
196
runtime/queries/ada/highlights.scm
Normal file
196
runtime/queries/ada/highlights.scm
Normal file
|
|
@ -0,0 +1,196 @@
|
|||
;; highlight queries.
|
||||
;; See the syntax at https://tree-sitter.github.io/tree-sitter/using-parsers#pattern-matching-with-queries
|
||||
;; See also https://github.com/nvim-treesitter/nvim-treesitter/blob/master/CONTRIBUTING.md#parser-configurations
|
||||
;; for a list of recommended @ tags, though not all of them have matching
|
||||
;; highlights in neovim.
|
||||
|
||||
[
|
||||
"abort"
|
||||
"abs"
|
||||
"abstract"
|
||||
"accept"
|
||||
"access"
|
||||
"all"
|
||||
"array"
|
||||
"at"
|
||||
"begin"
|
||||
"declare"
|
||||
"delay"
|
||||
"delta"
|
||||
"digits"
|
||||
"do"
|
||||
"end"
|
||||
"entry"
|
||||
"exit"
|
||||
"generic"
|
||||
"interface"
|
||||
"is"
|
||||
"limited"
|
||||
"null"
|
||||
"of"
|
||||
"others"
|
||||
"out"
|
||||
"pragma"
|
||||
"private"
|
||||
"range"
|
||||
"synchronized"
|
||||
"tagged"
|
||||
"task"
|
||||
"terminate"
|
||||
"until"
|
||||
"when"
|
||||
] @keyword
|
||||
[
|
||||
"aliased"
|
||||
"constant"
|
||||
"renames"
|
||||
] @storageclass
|
||||
[
|
||||
"mod"
|
||||
"new"
|
||||
"protected"
|
||||
"record"
|
||||
"subtype"
|
||||
"type"
|
||||
] @keyword.type
|
||||
[
|
||||
"with"
|
||||
"use"
|
||||
] @include
|
||||
[
|
||||
"body"
|
||||
"function"
|
||||
"overriding"
|
||||
"procedure"
|
||||
"package"
|
||||
"separate"
|
||||
] @keyword.function
|
||||
[
|
||||
"and"
|
||||
"in"
|
||||
"not"
|
||||
"or"
|
||||
"xor"
|
||||
] @keyword.operator
|
||||
[
|
||||
"while"
|
||||
"loop"
|
||||
"for"
|
||||
"parallel"
|
||||
"reverse"
|
||||
"some"
|
||||
] @repeat
|
||||
[
|
||||
"return"
|
||||
] @keyword.return
|
||||
[
|
||||
"case"
|
||||
"if"
|
||||
"else"
|
||||
"then"
|
||||
"elsif"
|
||||
"select"
|
||||
] @conditional
|
||||
[
|
||||
"exception"
|
||||
"raise"
|
||||
] @exception
|
||||
(comment) @comment @spell
|
||||
(string_literal) @string
|
||||
(character_literal) @string
|
||||
(numeric_literal) @number
|
||||
|
||||
;; Highlight the name of subprograms
|
||||
(procedure_specification name: (_) @function)
|
||||
(function_specification name: (_) @function)
|
||||
(package_declaration name: (_) @function)
|
||||
(package_body name: (_) @function)
|
||||
(generic_instantiation name: (_) @function)
|
||||
(entry_declaration . (identifier) @function)
|
||||
|
||||
;; Some keywords should take different categories depending on the context
|
||||
(use_clause "use" @include "type" @include)
|
||||
(with_clause "private" @include)
|
||||
(with_clause "limited" @include)
|
||||
(use_clause (_) @namespace)
|
||||
(with_clause (_) @namespace)
|
||||
|
||||
(loop_statement "end" @keyword.repeat)
|
||||
(if_statement "end" @conditional)
|
||||
(loop_parameter_specification "in" @keyword.repeat)
|
||||
(loop_parameter_specification "in" @keyword.repeat)
|
||||
(iterator_specification ["in" "of"] @keyword.repeat)
|
||||
(range_attribute_designator "range" @keyword.repeat)
|
||||
|
||||
(raise_statement "with" @exception)
|
||||
|
||||
(gnatprep_declarative_if_statement) @preproc
|
||||
(gnatprep_if_statement) @preproc
|
||||
(gnatprep_identifier) @preproc
|
||||
|
||||
(subprogram_declaration "is" @keyword.function "abstract" @keyword.function)
|
||||
(aspect_specification "with" @keyword.function)
|
||||
|
||||
(full_type_declaration "is" @keyword.type)
|
||||
(subtype_declaration "is" @keyword.type)
|
||||
(record_definition "end" @keyword.type)
|
||||
(full_type_declaration (_ "access" @keyword.type))
|
||||
(array_type_definition "array" @keyword.type "of" @keyword.type)
|
||||
(access_to_object_definition "access" @keyword.type)
|
||||
(access_to_object_definition "access" @keyword.type
|
||||
[
|
||||
(general_access_modifier "constant" @keyword.type)
|
||||
(general_access_modifier "all" @keyword.type)
|
||||
]
|
||||
)
|
||||
(range_constraint "range" @keyword.type)
|
||||
(signed_integer_type_definition "range" @keyword.type)
|
||||
(index_subtype_definition "range" @keyword.type)
|
||||
(record_type_definition "abstract" @keyword.type)
|
||||
(record_type_definition "tagged" @keyword.type)
|
||||
(record_type_definition "limited" @keyword.type)
|
||||
(record_type_definition (record_definition "null" @keyword.type))
|
||||
(private_type_declaration "is" @keyword.type "private" @keyword.type)
|
||||
(private_type_declaration "tagged" @keyword.type)
|
||||
(private_type_declaration "limited" @keyword.type)
|
||||
(task_type_declaration "task" @keyword.type "is" @keyword.type)
|
||||
|
||||
;; Gray the body of expression functions
|
||||
(expression_function_declaration
|
||||
(function_specification)
|
||||
"is"
|
||||
(_) @attribute
|
||||
)
|
||||
(subprogram_declaration (aspect_specification) @attribute)
|
||||
|
||||
;; Highlight full subprogram specifications
|
||||
;(subprogram_body
|
||||
; [
|
||||
; (procedure_specification)
|
||||
; (function_specification)
|
||||
; ] @function.spec
|
||||
;)
|
||||
|
||||
((comment) @comment.documentation
|
||||
. [
|
||||
(entry_declaration)
|
||||
(subprogram_declaration)
|
||||
(parameter_specification)
|
||||
])
|
||||
|
||||
(compilation_unit
|
||||
. (comment) @comment.documentation)
|
||||
|
||||
(component_list
|
||||
(component_declaration)
|
||||
. (comment) @comment.documentation)
|
||||
|
||||
(enumeration_type_definition
|
||||
(identifier)
|
||||
. (comment) @comment.documentation)
|
||||
|
||||
;; Highlight errors in red. This is not very useful in practice, as text will
|
||||
;; be highlighted as user types, and the error could be elsewhere in the code.
|
||||
;; This also requires defining :hi @error guifg=Red for instance.
|
||||
(ERROR) @error
|
||||
|
||||
33
runtime/queries/ada/locals.scm
Normal file
33
runtime/queries/ada/locals.scm
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
;; Better highlighting by referencing to the definition, for variable
|
||||
;; references. However, this is not yet supported by neovim
|
||||
;; See https://tree-sitter.github.io/tree-sitter/syntax-highlighting#local-variables
|
||||
|
||||
(compilation) @scope
|
||||
(package_declaration) @scope
|
||||
(package_body) @scope
|
||||
(subprogram_declaration) @scope
|
||||
(subprogram_body) @scope
|
||||
(block_statement) @scope
|
||||
|
||||
(with_clause (identifier) @definition.import)
|
||||
(procedure_specification name: (_) @definition.function)
|
||||
(function_specification name: (_) @definition.function)
|
||||
(package_declaration name: (_) @definition.var)
|
||||
(package_body name: (_) @definition.var)
|
||||
(generic_instantiation . name: (_) @definition.var)
|
||||
(component_declaration . (identifier) @definition.var)
|
||||
(exception_declaration . (identifier) @definition.var)
|
||||
(formal_object_declaration . (identifier) @definition.var)
|
||||
(object_declaration . (identifier) @definition.var)
|
||||
(parameter_specification . (identifier) @definition.var)
|
||||
(full_type_declaration . (identifier) @definition.type)
|
||||
(private_type_declaration . (identifier) @definition.type)
|
||||
(private_extension_declaration . (identifier) @definition.type)
|
||||
(incomplete_type_declaration . (identifier) @definition.type)
|
||||
(protected_type_declaration . (identifier) @definition.type)
|
||||
(formal_complete_type_declaration . (identifier) @definition.type)
|
||||
(formal_incomplete_type_declaration . (identifier) @definition.type)
|
||||
(task_type_declaration . (identifier) @definition.type)
|
||||
(subtype_declaration . (identifier) @definition.type)
|
||||
|
||||
(identifier) @reference
|
||||
4
runtime/queries/agda/folds.scm
Normal file
4
runtime/queries/agda/folds.scm
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
[
|
||||
(record)
|
||||
(module)
|
||||
] @fold
|
||||
82
runtime/queries/agda/highlights.scm
Normal file
82
runtime/queries/agda/highlights.scm
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
|
||||
;; Constants
|
||||
(integer) @number
|
||||
|
||||
;; Variables and Symbols
|
||||
|
||||
(typed_binding (atom (qid) @variable))
|
||||
(untyped_binding) @variable
|
||||
(typed_binding (expr) @type)
|
||||
|
||||
(id) @function
|
||||
(bid) @function
|
||||
|
||||
(function_name (atom (qid) @function))
|
||||
(field_name) @function
|
||||
|
||||
|
||||
[(data_name) (record_name)] @constructor
|
||||
|
||||
; Set
|
||||
(SetN) @type.builtin
|
||||
|
||||
(expr . (atom) @function)
|
||||
|
||||
((atom) @boolean
|
||||
(#any-of? @boolean "true" "false" "True" "False"))
|
||||
|
||||
;; Imports and Module Declarations
|
||||
|
||||
"import" @include
|
||||
|
||||
(module_name) @namespace
|
||||
|
||||
;; Pragmas and comments
|
||||
|
||||
(pragma) @preproc
|
||||
|
||||
(comment) @comment
|
||||
|
||||
;; Keywords
|
||||
[
|
||||
"where"
|
||||
"data"
|
||||
"rewrite"
|
||||
"postulate"
|
||||
"public"
|
||||
"private"
|
||||
"tactic"
|
||||
"Prop"
|
||||
"quote"
|
||||
"renaming"
|
||||
"open"
|
||||
"in"
|
||||
"hiding"
|
||||
"constructor"
|
||||
"abstract"
|
||||
"let"
|
||||
"field"
|
||||
"mutual"
|
||||
"module"
|
||||
"infix"
|
||||
"infixl"
|
||||
"infixr"
|
||||
"record"
|
||||
(ARROW)
|
||||
]
|
||||
@keyword
|
||||
|
||||
;;;(expr
|
||||
;;; f_name: (atom) @function)
|
||||
;; Brackets
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"{"
|
||||
"}"]
|
||||
@punctuation.bracket
|
||||
|
||||
[
|
||||
"="
|
||||
] @operator
|
||||
1
runtime/queries/arduino/folds.scm
Normal file
1
runtime/queries/arduino/folds.scm
Normal file
|
|
@ -0,0 +1 @@
|
|||
; inherits: cpp
|
||||
111
runtime/queries/arduino/highlights.scm
Normal file
111
runtime/queries/arduino/highlights.scm
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
; inherits: cpp
|
||||
|
||||
((identifier) @function.builtin
|
||||
(#any-of? @function.builtin
|
||||
; Digital I/O
|
||||
"digitalRead"
|
||||
"digitalWrite"
|
||||
"pinMode"
|
||||
; Analog I/O
|
||||
"analogRead"
|
||||
"analogReference"
|
||||
"analogWrite"
|
||||
; Zero, Due & MKR Family
|
||||
"analogReadResolution"
|
||||
"analogWriteResolution"
|
||||
; Advanced I/O
|
||||
"noTone"
|
||||
"pulseIn"
|
||||
"pulseInLong"
|
||||
"shiftIn"
|
||||
"shiftOut"
|
||||
"tone"
|
||||
; Time
|
||||
"delay"
|
||||
"delayMicroseconds"
|
||||
"micros"
|
||||
"millis"
|
||||
; Math
|
||||
"abs"
|
||||
"constrain"
|
||||
"map"
|
||||
"max"
|
||||
"min"
|
||||
"pow"
|
||||
"sq"
|
||||
"sqrt"
|
||||
; Trigonometry
|
||||
"cos"
|
||||
"sin"
|
||||
"tan"
|
||||
; Characters
|
||||
"isAlpha"
|
||||
"isAlphaNumeric"
|
||||
"isAscii"
|
||||
"isControl"
|
||||
"isDigit"
|
||||
"isGraph"
|
||||
"isHexadecimalDigit"
|
||||
"isLowerCase"
|
||||
"isPrintable"
|
||||
"isPunct"
|
||||
"isSpace"
|
||||
"isUpperCase"
|
||||
"isWhitespace"
|
||||
; Random Numbers
|
||||
"random"
|
||||
"randomSeed"
|
||||
; Bits and Bytes
|
||||
"bit"
|
||||
"bitClear"
|
||||
"bitRead"
|
||||
"bitSet"
|
||||
"bitWrite"
|
||||
"highByte"
|
||||
"lowByte"
|
||||
; External Interrupts
|
||||
"attachInterrupt"
|
||||
"detachInterrupt"
|
||||
; Interrupts
|
||||
"interrupts"
|
||||
"noInterrupts"
|
||||
))
|
||||
|
||||
((identifier) @type.builtin
|
||||
(#any-of? @type.builtin
|
||||
"Serial"
|
||||
"SPI"
|
||||
"Stream"
|
||||
"Wire"
|
||||
"Keyboard"
|
||||
"Mouse"
|
||||
"String"
|
||||
))
|
||||
|
||||
((identifier) @constant.builtin
|
||||
(#any-of? @constant.builtin
|
||||
"HIGH"
|
||||
"LOW"
|
||||
"INPUT"
|
||||
"OUTPUT"
|
||||
"INPUT_PULLUP"
|
||||
"LED_BUILTIN"
|
||||
))
|
||||
|
||||
(function_definition
|
||||
(function_declarator
|
||||
declarator: (identifier) @function.builtin)
|
||||
(#any-of? @function.builtin "loop" "setup"))
|
||||
|
||||
(call_expression
|
||||
function: (primitive_type) @function.builtin)
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @constructor
|
||||
(#any-of? @constructor "SPISettings" "String"))
|
||||
|
||||
(declaration
|
||||
(type_identifier) @type.builtin
|
||||
(function_declarator
|
||||
declarator: (identifier) @constructor)
|
||||
(#eq? @type.builtin "SPISettings"))
|
||||
1
runtime/queries/arduino/indents.scm
Normal file
1
runtime/queries/arduino/indents.scm
Normal file
|
|
@ -0,0 +1 @@
|
|||
; inherits: cpp
|
||||
5
runtime/queries/arduino/injections.scm
Normal file
5
runtime/queries/arduino/injections.scm
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
((preproc_arg) @injection.content
|
||||
(#set! injection.language "arduino"))
|
||||
|
||||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
1
runtime/queries/arduino/locals.scm
Normal file
1
runtime/queries/arduino/locals.scm
Normal file
|
|
@ -0,0 +1 @@
|
|||
; inherits: cpp
|
||||
1
runtime/queries/astro/folds.scm
Normal file
1
runtime/queries/astro/folds.scm
Normal file
|
|
@ -0,0 +1 @@
|
|||
; inherits: html
|
||||
5
runtime/queries/astro/highlights.scm
Normal file
5
runtime/queries/astro/highlights.scm
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
; inherits: html
|
||||
|
||||
[ "---" ] @punctuation.delimiter
|
||||
|
||||
[ "{" "}" ] @punctuation.special
|
||||
1
runtime/queries/astro/indents.scm
Normal file
1
runtime/queries/astro/indents.scm
Normal file
|
|
@ -0,0 +1 @@
|
|||
; inherits: html
|
||||
23
runtime/queries/astro/injections.scm
Normal file
23
runtime/queries/astro/injections.scm
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
; inherits: html_tags
|
||||
|
||||
(frontmatter
|
||||
(raw_text) @injection.content
|
||||
(#set! injection.language "typescript"))
|
||||
|
||||
(interpolation
|
||||
(raw_text) @injection.content
|
||||
(#set! injection.language "tsx"))
|
||||
|
||||
(script_element
|
||||
(raw_text) @injection.content
|
||||
(#set! injection.language "typescript"))
|
||||
|
||||
(style_element
|
||||
(start_tag
|
||||
(attribute
|
||||
(attribute_name) @_lang_attr
|
||||
(quoted_attribute_value (attribute_value) @_lang_value)))
|
||||
(raw_text) @injection.content
|
||||
(#eq? @_lang_attr "lang")
|
||||
(#eq? @_lang_value "scss")
|
||||
(#set! injection.language "scss"))
|
||||
1
runtime/queries/astro/locals.scm
Normal file
1
runtime/queries/astro/locals.scm
Normal file
|
|
@ -0,0 +1 @@
|
|||
; inherits: html
|
||||
195
runtime/queries/awk/highlights.scm
Normal file
195
runtime/queries/awk/highlights.scm
Normal file
|
|
@ -0,0 +1,195 @@
|
|||
; adapted from https://github.com/Beaglefoot/tree-sitter-awk
|
||||
|
||||
[
|
||||
(identifier)
|
||||
(field_ref)
|
||||
] @variable
|
||||
(field_ref (_) @variable)
|
||||
|
||||
; https://www.gnu.org/software/gawk/manual/html_node/Auto_002dset.html
|
||||
((identifier) @constant.builtin
|
||||
(#any-of? @constant.builtin
|
||||
"ARGC"
|
||||
"ARGV"
|
||||
"ARGIND"
|
||||
"ENVIRON"
|
||||
"ERRNO"
|
||||
"FILENAME"
|
||||
"FNR"
|
||||
"NF"
|
||||
"FUNCTAB"
|
||||
"NR"
|
||||
"PROCINFO"
|
||||
"RLENGTH"
|
||||
"RSTART"
|
||||
"RT"
|
||||
"SYMTAB"))
|
||||
|
||||
; https://www.gnu.org/software/gawk/manual/html_node/User_002dmodified.html
|
||||
((identifier) @variable.builtin
|
||||
(#any-of? @variable.builtin
|
||||
"BINMODE"
|
||||
"CONVFMT"
|
||||
"FIELDWIDTHS"
|
||||
"FPAT"
|
||||
"FS"
|
||||
"IGNORECASE"
|
||||
"LINT"
|
||||
"OFMT"
|
||||
"OFS"
|
||||
"ORS"
|
||||
"PREC"
|
||||
"ROUNDMODE"
|
||||
"RS"
|
||||
"SUBSEP"
|
||||
"TEXTDOMAIN"))
|
||||
|
||||
(number) @number
|
||||
|
||||
(string) @string
|
||||
(regex) @string.regex
|
||||
(escape_sequence) @string.escape
|
||||
|
||||
(comment) @comment @spell
|
||||
|
||||
((program . (comment) @preproc)
|
||||
(#lua-match? @preproc "^#!/"))
|
||||
|
||||
(ns_qualified_name (namespace) @namespace)
|
||||
(ns_qualified_name "::" @punctuation.delimiter)
|
||||
|
||||
(func_def name: (_ (identifier) @function) @function)
|
||||
(func_call name: (_ (identifier) @function) @function)
|
||||
|
||||
(func_def (param_list (identifier) @parameter))
|
||||
|
||||
[
|
||||
"print"
|
||||
"printf"
|
||||
"getline"
|
||||
] @function.builtin
|
||||
|
||||
[
|
||||
(delete_statement)
|
||||
(break_statement)
|
||||
(continue_statement)
|
||||
(next_statement)
|
||||
(nextfile_statement)
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"func"
|
||||
"function"
|
||||
] @keyword.function
|
||||
|
||||
[
|
||||
"return"
|
||||
"exit"
|
||||
] @keyword.return
|
||||
|
||||
[
|
||||
"do"
|
||||
"while"
|
||||
"for"
|
||||
"in"
|
||||
] @repeat
|
||||
|
||||
[
|
||||
"if"
|
||||
"else"
|
||||
"switch"
|
||||
"case"
|
||||
"default"
|
||||
] @conditional
|
||||
|
||||
[
|
||||
"@include"
|
||||
"@load"
|
||||
] @include
|
||||
|
||||
"@namespace" @preproc
|
||||
|
||||
[
|
||||
"BEGIN"
|
||||
"END"
|
||||
"BEGINFILE"
|
||||
"ENDFILE"
|
||||
] @label
|
||||
|
||||
(binary_exp [
|
||||
"^"
|
||||
"**"
|
||||
"*"
|
||||
"/"
|
||||
"%"
|
||||
"+"
|
||||
"-"
|
||||
"<"
|
||||
">"
|
||||
"<="
|
||||
">="
|
||||
"=="
|
||||
"!="
|
||||
"~"
|
||||
"!~"
|
||||
"in"
|
||||
"&&"
|
||||
"||"
|
||||
] @operator)
|
||||
|
||||
(unary_exp [
|
||||
"!"
|
||||
"+"
|
||||
"-"
|
||||
] @operator)
|
||||
|
||||
(assignment_exp [
|
||||
"="
|
||||
"+="
|
||||
"-="
|
||||
"*="
|
||||
"/="
|
||||
"%="
|
||||
"^="
|
||||
] @operator)
|
||||
|
||||
(ternary_exp [
|
||||
"?"
|
||||
":"
|
||||
] @conditional.ternary)
|
||||
|
||||
(update_exp [
|
||||
"++"
|
||||
"--"
|
||||
] @operator)
|
||||
|
||||
(redirected_io_statement [
|
||||
">"
|
||||
">>"
|
||||
] @operator)
|
||||
|
||||
(piped_io_statement [
|
||||
"|"
|
||||
"|&"
|
||||
] @operator)
|
||||
|
||||
(piped_io_exp [
|
||||
"|"
|
||||
"|&"
|
||||
] @operator)
|
||||
|
||||
(field_ref "$" @punctuation.delimiter)
|
||||
|
||||
(regex "/" @punctuation.delimiter)
|
||||
(regex_constant "@" @punctuation.delimiter)
|
||||
|
||||
[ ";" "," ] @punctuation.delimiter
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
5
runtime/queries/awk/injections.scm
Normal file
5
runtime/queries/awk/injections.scm
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
|
||||
((regex) @injection.content
|
||||
(#set! injection.language "regex"))
|
||||
9
runtime/queries/bash/folds.scm
Normal file
9
runtime/queries/bash/folds.scm
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
[
|
||||
(function_definition)
|
||||
(if_statement)
|
||||
(case_statement)
|
||||
(for_statement)
|
||||
(while_statement)
|
||||
(c_style_for_statement)
|
||||
(heredoc_redirect)
|
||||
] @fold
|
||||
186
runtime/queries/bash/highlights.scm
Normal file
186
runtime/queries/bash/highlights.scm
Normal file
|
|
@ -0,0 +1,186 @@
|
|||
[
|
||||
"(" ")"
|
||||
"{" "}"
|
||||
"[" "]"
|
||||
"[[" "]]"
|
||||
"((" "))"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
";"
|
||||
";;"
|
||||
";&"
|
||||
";;&"
|
||||
"&"
|
||||
] @punctuation.delimiter
|
||||
|
||||
[
|
||||
">"
|
||||
">>"
|
||||
"<"
|
||||
"<<"
|
||||
"&&"
|
||||
"|"
|
||||
"|&"
|
||||
"||"
|
||||
"="
|
||||
"+="
|
||||
"=~"
|
||||
"=="
|
||||
"!="
|
||||
|
||||
"&>"
|
||||
"&>>"
|
||||
"<&"
|
||||
">&"
|
||||
">|"
|
||||
"<&-"
|
||||
">&-"
|
||||
|
||||
"<<-"
|
||||
"<<<"
|
||||
|
||||
".."
|
||||
] @operator
|
||||
|
||||
; Do *not* spell check strings since they typically have some sort of
|
||||
; interpolation in them, or, are typically used for things like filenames, URLs,
|
||||
; flags and file content.
|
||||
[
|
||||
(string)
|
||||
(raw_string)
|
||||
(ansi_c_string)
|
||||
(heredoc_body)
|
||||
] @string
|
||||
|
||||
[
|
||||
(heredoc_start)
|
||||
(heredoc_end)
|
||||
] @label
|
||||
|
||||
(variable_assignment (word) @string)
|
||||
(command argument: "$" @string) ; bare dollar
|
||||
|
||||
[
|
||||
"if"
|
||||
"then"
|
||||
"else"
|
||||
"elif"
|
||||
"fi"
|
||||
"case"
|
||||
"in"
|
||||
"esac"
|
||||
] @conditional
|
||||
|
||||
[
|
||||
"for"
|
||||
"do"
|
||||
"done"
|
||||
"select"
|
||||
"until"
|
||||
"while"
|
||||
] @repeat
|
||||
|
||||
[
|
||||
"declare"
|
||||
"typeset"
|
||||
"export"
|
||||
"readonly"
|
||||
"local"
|
||||
"unset"
|
||||
"unsetenv"
|
||||
] @keyword
|
||||
|
||||
"function" @keyword.function
|
||||
|
||||
(special_variable_name) @constant
|
||||
|
||||
; trap -l
|
||||
((word) @constant.builtin
|
||||
(#match? @constant.builtin "^SIG(HUP|INT|QUIT|ILL|TRAP|ABRT|BUS|FPE|KILL|USR[12]|SEGV|PIPE|ALRM|TERM|STKFLT|CHLD|CONT|STOP|TSTP|TT(IN|OU)|URG|XCPU|XFSZ|VTALRM|PROF|WINCH|IO|PWR|SYS|RTMIN([+]([1-9]|1[0-5]))?|RTMAX(-([1-9]|1[0-4]))?)$"))
|
||||
|
||||
((word) @boolean
|
||||
(#any-of? @boolean "true" "false"))
|
||||
|
||||
(comment) @comment @spell
|
||||
|
||||
(test_operator) @operator
|
||||
|
||||
(command_substitution "$(" @punctuation.bracket)
|
||||
(process_substitution "<(" @punctuation.bracket)
|
||||
|
||||
(arithmetic_expansion
|
||||
[ "$((" "((" ] @punctuation.special
|
||||
"))" @punctuation.special)
|
||||
|
||||
(arithmetic_expansion "," @punctuation.delimiter)
|
||||
|
||||
(ternary_expression [ "?" ":" ] @conditional.ternary)
|
||||
|
||||
(binary_expression operator: _ @operator)
|
||||
(unary_expression operator: _ @operator)
|
||||
(postfix_expression operator: _ @operator)
|
||||
|
||||
(function_definition
|
||||
name: (word) @function)
|
||||
|
||||
(command_name (word) @function.call)
|
||||
|
||||
((command_name (word) @function.builtin)
|
||||
(#any-of? @function.builtin
|
||||
"alias" "bg" "bind" "break" "builtin" "caller" "cd"
|
||||
"command" "compgen" "complete" "compopt" "continue"
|
||||
"coproc" "dirs" "disown" "echo" "enable" "eval"
|
||||
"exec" "exit" "fc" "fg" "getopts" "hash" "help"
|
||||
"history" "jobs" "kill" "let" "logout" "mapfile"
|
||||
"popd" "printf" "pushd" "pwd" "read" "readarray"
|
||||
"return" "set" "shift" "shopt" "source" "suspend"
|
||||
"test" "time" "times" "trap" "type" "typeset"
|
||||
"ulimit" "umask" "unalias" "wait"))
|
||||
|
||||
(command
|
||||
argument: [
|
||||
(word) @parameter
|
||||
(concatenation (word) @parameter)
|
||||
])
|
||||
|
||||
(number) @number
|
||||
((word) @number
|
||||
(#lua-match? @number "^[0-9]+$"))
|
||||
|
||||
(file_redirect
|
||||
destination: (word) @parameter)
|
||||
|
||||
(file_descriptor) @operator
|
||||
|
||||
(simple_expansion
|
||||
"$" @punctuation.special) @none
|
||||
(expansion
|
||||
"${" @punctuation.special
|
||||
"}" @punctuation.special) @none
|
||||
|
||||
(expansion operator: _ @punctuation.special)
|
||||
(expansion "@" . operator: _ @character.special)
|
||||
|
||||
((expansion
|
||||
(subscript
|
||||
index: (word) @character.special))
|
||||
(#any-of? @character.special "@" "*"))
|
||||
|
||||
"``" @punctuation.special
|
||||
|
||||
(variable_name) @variable
|
||||
|
||||
((variable_name) @constant
|
||||
(#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
|
||||
|
||||
(case_item
|
||||
value: (word) @parameter)
|
||||
|
||||
[
|
||||
(regex)
|
||||
(extglob_pattern)
|
||||
] @string.regex
|
||||
|
||||
((program . (comment) @preproc)
|
||||
(#lua-match? @preproc "^#!/"))
|
||||
10
runtime/queries/bash/injections.scm
Normal file
10
runtime/queries/bash/injections.scm
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
|
||||
((regex) @injection.content
|
||||
(#set! injection.language "regex"))
|
||||
|
||||
((heredoc_redirect
|
||||
(heredoc_body) @injection.content
|
||||
(heredoc_end) @injection.language)
|
||||
(#downcase! @injection.language))
|
||||
13
runtime/queries/bash/locals.scm
Normal file
13
runtime/queries/bash/locals.scm
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
; Scopes
|
||||
(function_definition) @scope
|
||||
|
||||
; Definitions
|
||||
(variable_assignment
|
||||
name: (variable_name) @definition.var)
|
||||
|
||||
(function_definition
|
||||
name: (word) @definition.function)
|
||||
|
||||
; References
|
||||
(variable_name) @reference
|
||||
(word) @reference
|
||||
5
runtime/queries/bass/folds.scm
Normal file
5
runtime/queries/bass/folds.scm
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
[
|
||||
(list)
|
||||
(scope)
|
||||
(cons)
|
||||
] @fold
|
||||
109
runtime/queries/bass/highlights.scm
Normal file
109
runtime/queries/bass/highlights.scm
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
;; Variables
|
||||
|
||||
(list (symbol) @variable)
|
||||
|
||||
(cons (symbol) @variable)
|
||||
|
||||
(scope (symbol) @variable)
|
||||
|
||||
(symbind (symbol) @variable)
|
||||
|
||||
;; Constants
|
||||
|
||||
((symbol) @constant
|
||||
(#lua-match? @constant "^_*[A-Z][A-Z0-9_]*$"))
|
||||
|
||||
;; Functions
|
||||
|
||||
(list
|
||||
. (symbol) @function)
|
||||
|
||||
;; Namespaces
|
||||
|
||||
(symbind
|
||||
(symbol) @namespace
|
||||
. (keyword))
|
||||
|
||||
;; Includes
|
||||
|
||||
((symbol) @include
|
||||
(#any-of? @include "use" "import" "load"))
|
||||
|
||||
;; Keywords
|
||||
|
||||
((symbol) @keyword
|
||||
(#any-of? @keyword "do" "doc"))
|
||||
|
||||
;; Special Functions
|
||||
|
||||
; Keywords construct a symbol
|
||||
|
||||
(keyword) @constructor
|
||||
|
||||
((list
|
||||
. (symbol) @keyword.function
|
||||
. (symbol) @function
|
||||
(symbol)? @parameter)
|
||||
(#any-of? @keyword.function "def" "defop" "defn" "fn"))
|
||||
|
||||
((cons
|
||||
. (symbol) @keyword.function
|
||||
. (symbol) @function
|
||||
(symbol)? @parameter)
|
||||
(#any-of? @keyword.function "def" "defop" "defn" "fn"))
|
||||
|
||||
((symbol) @function.builtin
|
||||
(#any-of? @function.builtin "dump" "mkfs" "json" "log" "error" "now" "cons" "wrap" "unwrap" "eval" "make-scope" "bind" "meta" "with-meta" "null?" "ignore?" "boolean?" "number?" "string?" "symbol?" "scope?" "sink?" "source?" "list?" "pair?" "applicative?" "operative?" "combiner?" "path?" "empty?" "thunk?" "+" "*" "quot" "-" "max" "min" "=" ">" ">=" "<" "<=" "list->source" "across" "emit" "next" "reduce-kv" "assoc" "symbol->string" "string->symbol" "str" "substring" "trim" "scope->list" "string->fs-path" "string->cmd-path" "string->dir" "subpath" "path-name" "path-stem" "with-image" "with-dir" "with-args" "with-cmd" "with-stdin" "with-env" "with-insecure" "with-label" "with-port" "with-tls" "with-mount" "thunk-cmd" "thunk-args" "resolve" "start" "addr" "wait" "read" "cache-dir" "binds?" "recall-memo" "store-memo" "mask" "list" "list*" "first" "rest" "length" "second" "third" "map" "map-pairs" "foldr" "foldl" "append" "filter" "conj" "list->scope" "merge" "apply" "id" "always" "vals" "keys" "memo" "succeeds?" "run" "last" "take" "take-all" "insecure!" "from" "cd" "wrap-cmd" "mkfile" "path-base" "not"))
|
||||
|
||||
((symbol) @function.macro
|
||||
(#any-of? @function.macro "op" "current-scope" "quote" "let" "provide" "module" "or" "and" "curryfn" "for" "$" "linux"))
|
||||
|
||||
;; Conditionals
|
||||
|
||||
((symbol) @conditional
|
||||
(#any-of? @conditional "if" "case" "cond" "when"))
|
||||
|
||||
;; Repeats
|
||||
|
||||
((symbol) @repeat
|
||||
(#any-of? @repeat "each"))
|
||||
|
||||
;; Operators
|
||||
|
||||
((symbol) @operator (#any-of? @operator "&" "*" "+" "-" "<" "<=" "=" ">" ">="))
|
||||
|
||||
;; Punctuation
|
||||
|
||||
[ "(" ")" ] @punctuation.bracket
|
||||
|
||||
[ "{" "}" ] @punctuation.bracket
|
||||
|
||||
[ "[" "]" ] @punctuation.bracket
|
||||
|
||||
((symbol) @punctuation.delimiter
|
||||
(#eq? @punctuation.delimiter "->"))
|
||||
|
||||
;; Literals
|
||||
|
||||
(string) @string
|
||||
|
||||
(escape_sequence) @string.escape
|
||||
|
||||
(path) @text.uri @string.special
|
||||
|
||||
(number) @number
|
||||
|
||||
(boolean) @boolean
|
||||
|
||||
[
|
||||
(ignore)
|
||||
(null)
|
||||
] @constant.builtin
|
||||
|
||||
[
|
||||
"^"
|
||||
] @character.special
|
||||
|
||||
;; Comments
|
||||
|
||||
(comment) @comment @spell
|
||||
22
runtime/queries/bass/indents.scm
Normal file
22
runtime/queries/bass/indents.scm
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
[
|
||||
(list)
|
||||
(scope)
|
||||
(cons)
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
")"
|
||||
"}"
|
||||
"]"
|
||||
] @indent.end
|
||||
|
||||
[ "(" ")" ] @indent.branch
|
||||
|
||||
[ "{" "}" ] @indent.branch
|
||||
|
||||
[ "[" "]" ] @indent.branch
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
(comment)
|
||||
] @indent.auto
|
||||
5
runtime/queries/bass/injections.scm
Normal file
5
runtime/queries/bass/injections.scm
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
|
||||
((block_comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
25
runtime/queries/bass/locals.scm
Normal file
25
runtime/queries/bass/locals.scm
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
; Scopes
|
||||
|
||||
[
|
||||
(list)
|
||||
(scope)
|
||||
(cons)
|
||||
] @scope
|
||||
|
||||
; References
|
||||
|
||||
(symbol) @reference
|
||||
|
||||
; Definitions
|
||||
|
||||
((list
|
||||
. (symbol) @_fnkw
|
||||
. (symbol) @definition.function
|
||||
(symbol)? @definition.parameter)
|
||||
(#any-of? @_fnkw "def" "defop" "defn" "fn"))
|
||||
|
||||
((cons
|
||||
. (symbol) @_fnkw
|
||||
. (symbol) @definition.function
|
||||
(symbol)? @definition.parameter)
|
||||
(#any-of? @_fnkw "def" "defop" "defn" "fn"))
|
||||
4
runtime/queries/beancount/folds.scm
Normal file
4
runtime/queries/beancount/folds.scm
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
[
|
||||
(transaction)
|
||||
(section)
|
||||
] @fold
|
||||
24
runtime/queries/beancount/highlights.scm
Normal file
24
runtime/queries/beancount/highlights.scm
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
(date) @field
|
||||
(txn) @attribute
|
||||
(account) @type
|
||||
(amount) @number
|
||||
(incomplete_amount) @number
|
||||
(compound_amount) @number
|
||||
(amount_tolerance) @number
|
||||
(currency) @property
|
||||
(key) @label
|
||||
(string) @string
|
||||
(narration) @string @spell
|
||||
(payee) @string @spell
|
||||
(tag) @constant
|
||||
(link) @constant
|
||||
[
|
||||
(minus) (plus) (slash) (asterisk)
|
||||
] @operator
|
||||
(comment) @comment @spell
|
||||
[
|
||||
(balance) (open) (close) (commodity) (pad)
|
||||
(event) (price) (note) (document) (query)
|
||||
(custom) (pushtag) (poptag) (pushmeta)
|
||||
(popmeta) (option) (include) (plugin)
|
||||
] @keyword
|
||||
3
runtime/queries/bibtex/folds.scm
Normal file
3
runtime/queries/bibtex/folds.scm
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
[
|
||||
(entry)
|
||||
] @fold
|
||||
49
runtime/queries/bibtex/highlights.scm
Normal file
49
runtime/queries/bibtex/highlights.scm
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
; CREDITS @pfoerster (adapted from https://github.com/latex-lsp/tree-sitter-bibtex)
|
||||
|
||||
[
|
||||
(string_type)
|
||||
(preamble_type)
|
||||
(entry_type)
|
||||
] @keyword
|
||||
|
||||
[
|
||||
(junk)
|
||||
(comment)
|
||||
] @comment
|
||||
|
||||
[
|
||||
"="
|
||||
"#"
|
||||
] @operator
|
||||
|
||||
(command) @function.builtin
|
||||
|
||||
(number) @number
|
||||
|
||||
(field
|
||||
name: (identifier) @field)
|
||||
|
||||
(token
|
||||
(identifier) @parameter)
|
||||
|
||||
[
|
||||
(brace_word)
|
||||
(quote_word)
|
||||
] @string
|
||||
|
||||
[
|
||||
(key_brace)
|
||||
(key_paren)
|
||||
] @symbol
|
||||
|
||||
(string
|
||||
name: (identifier) @constant)
|
||||
|
||||
[
|
||||
"{"
|
||||
"}"
|
||||
"("
|
||||
")"
|
||||
] @punctuation.bracket
|
||||
|
||||
"," @punctuation.delimiter
|
||||
10
runtime/queries/bibtex/indents.scm
Normal file
10
runtime/queries/bibtex/indents.scm
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
[
|
||||
(entry)
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
"{"
|
||||
"}"
|
||||
] @indent.branch
|
||||
|
||||
(comment) @indent.ignore
|
||||
25
runtime/queries/bicep/folds.scm
Normal file
25
runtime/queries/bicep/folds.scm
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
[
|
||||
(module_declaration)
|
||||
(metadata_declaration)
|
||||
(output_declaration)
|
||||
(parameter_declaration)
|
||||
(resource_declaration)
|
||||
(type_declaration)
|
||||
(variable_declaration)
|
||||
|
||||
(parenthesized_expression)
|
||||
|
||||
(decorators)
|
||||
(array)
|
||||
(object)
|
||||
|
||||
(if_statement)
|
||||
(for_statement)
|
||||
|
||||
(subscript_expression)
|
||||
(ternary_expression)
|
||||
|
||||
(string)
|
||||
|
||||
(comment)
|
||||
] @fold
|
||||
230
runtime/queries/bicep/highlights.scm
Normal file
230
runtime/queries/bicep/highlights.scm
Normal file
|
|
@ -0,0 +1,230 @@
|
|||
; Includes
|
||||
|
||||
(import_statement
|
||||
"import" @include)
|
||||
|
||||
(import_with_statement
|
||||
"import" @include
|
||||
"with" @include)
|
||||
|
||||
; Namespaces
|
||||
|
||||
(module_declaration
|
||||
(identifier) @namespace)
|
||||
|
||||
; Builtins
|
||||
|
||||
(primitive_type) @type.builtin
|
||||
|
||||
((member_expression
|
||||
object: (identifier) @type.builtin)
|
||||
(#eq? @type.builtin "sys"))
|
||||
|
||||
; Functions
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @function.call)
|
||||
|
||||
; Properties
|
||||
|
||||
(object_property
|
||||
(identifier) @property
|
||||
":" @punctuation.delimiter
|
||||
(_))
|
||||
|
||||
(object_property
|
||||
(compatible_identifier) @property
|
||||
":" @punctuation.delimiter
|
||||
(_))
|
||||
|
||||
(property_identifier) @property
|
||||
|
||||
; Attributes
|
||||
|
||||
(decorator
|
||||
"@" @attribute)
|
||||
|
||||
(decorator
|
||||
(call_expression (identifier) @attribute))
|
||||
|
||||
(decorator
|
||||
(call_expression
|
||||
(member_expression
|
||||
object: (identifier) @attribute
|
||||
property: (property_identifier) @attribute)))
|
||||
|
||||
; Types
|
||||
|
||||
(type_declaration
|
||||
(identifier) @type)
|
||||
|
||||
(type_declaration
|
||||
(identifier)
|
||||
"="
|
||||
(identifier) @type)
|
||||
|
||||
(type_declaration
|
||||
(identifier)
|
||||
"="
|
||||
(array_type (identifier) @type))
|
||||
|
||||
(type
|
||||
(identifier) @type)
|
||||
|
||||
(resource_declaration
|
||||
(identifier) @type)
|
||||
|
||||
(resource_expression
|
||||
(identifier) @type)
|
||||
|
||||
; Parameters
|
||||
|
||||
(parameter_declaration
|
||||
(identifier) @parameter
|
||||
(_))
|
||||
|
||||
(call_expression
|
||||
function: (_)
|
||||
(arguments (identifier) @parameter))
|
||||
|
||||
(call_expression
|
||||
function: (_)
|
||||
(arguments (member_expression object: (identifier) @parameter)))
|
||||
|
||||
; Variables
|
||||
|
||||
(variable_declaration
|
||||
(identifier) @variable
|
||||
(_))
|
||||
|
||||
(metadata_declaration
|
||||
(identifier) @variable
|
||||
(_))
|
||||
|
||||
(output_declaration
|
||||
(identifier) @variable
|
||||
(_))
|
||||
|
||||
(object_property
|
||||
(_)
|
||||
":"
|
||||
(identifier) @variable)
|
||||
|
||||
(for_statement
|
||||
"for"
|
||||
(for_loop_parameters
|
||||
(loop_variable) @variable
|
||||
(loop_enumerator) @variable))
|
||||
|
||||
; Conditionals
|
||||
|
||||
"if" @conditional
|
||||
|
||||
(ternary_expression
|
||||
"?" @conditional.ternary
|
||||
":" @conditional.ternary)
|
||||
|
||||
; Loops
|
||||
|
||||
(for_statement
|
||||
"for" @repeat
|
||||
"in"
|
||||
":" @punctuation.delimiter)
|
||||
|
||||
; Keywords
|
||||
|
||||
[
|
||||
"module"
|
||||
"metadata"
|
||||
"output"
|
||||
"param"
|
||||
"resource"
|
||||
"existing"
|
||||
"targetScope"
|
||||
"type"
|
||||
"var"
|
||||
] @keyword
|
||||
|
||||
; Operators
|
||||
|
||||
[
|
||||
"+"
|
||||
"-"
|
||||
"*"
|
||||
"/"
|
||||
"%"
|
||||
"||"
|
||||
"&&"
|
||||
"|"
|
||||
"=="
|
||||
"!="
|
||||
"=~"
|
||||
"!~"
|
||||
">"
|
||||
">="
|
||||
"<="
|
||||
"<"
|
||||
"??"
|
||||
"="
|
||||
"!"
|
||||
] @operator
|
||||
|
||||
[
|
||||
"in"
|
||||
] @keyword.operator
|
||||
|
||||
|
||||
; Literals
|
||||
|
||||
(string) @string
|
||||
(import_string
|
||||
"'" @string
|
||||
(import_name) @namespace
|
||||
"@" @symbol
|
||||
(import_version) @string.special)
|
||||
|
||||
(escape_sequence) @string.escape
|
||||
|
||||
(number) @number
|
||||
|
||||
(boolean) @boolean
|
||||
|
||||
(null) @constant.builtin
|
||||
|
||||
; Misc
|
||||
|
||||
(compatible_identifier
|
||||
"?" @punctuation.special)
|
||||
|
||||
(nullable_return_type) @punctuation.special
|
||||
|
||||
["{" "}"] @punctuation.bracket
|
||||
|
||||
["[" "]"] @punctuation.bracket
|
||||
|
||||
["(" ")"] @punctuation.bracket
|
||||
|
||||
[
|
||||
"."
|
||||
"::"
|
||||
"=>"
|
||||
] @punctuation.delimiter
|
||||
|
||||
|
||||
; Interpolation
|
||||
|
||||
(interpolation) @none
|
||||
|
||||
(interpolation
|
||||
"${" @punctuation.special
|
||||
"}" @punctuation.special)
|
||||
|
||||
(interpolation
|
||||
(identifier) @variable)
|
||||
|
||||
; Comments
|
||||
|
||||
[
|
||||
(comment)
|
||||
(diagnostic_comment)
|
||||
] @comment @spell
|
||||
18
runtime/queries/bicep/indents.scm
Normal file
18
runtime/queries/bicep/indents.scm
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
[
|
||||
(array)
|
||||
(object)
|
||||
] @indent.begin
|
||||
|
||||
"}" @indent.end
|
||||
|
||||
[ "{" "}" ] @indent.branch
|
||||
|
||||
[ "[" "]" ] @indent.branch
|
||||
|
||||
[ "(" ")" ] @indent.branch
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
(comment)
|
||||
(diagnostic_comment)
|
||||
] @indent.auto
|
||||
5
runtime/queries/bicep/injections.scm
Normal file
5
runtime/queries/bicep/injections.scm
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
([
|
||||
(comment)
|
||||
(diagnostic_comment)
|
||||
] @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
74
runtime/queries/bicep/locals.scm
Normal file
74
runtime/queries/bicep/locals.scm
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
; Scopes
|
||||
|
||||
[
|
||||
(infrastructure)
|
||||
(call_expression)
|
||||
|
||||
(lambda_expression)
|
||||
(subscript_expression)
|
||||
|
||||
(if_statement)
|
||||
(for_statement)
|
||||
|
||||
(array)
|
||||
(object)
|
||||
(interpolation)
|
||||
] @scope
|
||||
|
||||
; References
|
||||
|
||||
(property_identifier) @reference
|
||||
|
||||
(call_expression
|
||||
(identifier) @reference)
|
||||
|
||||
(object_property
|
||||
(_)
|
||||
":"
|
||||
(identifier) @reference)
|
||||
|
||||
(resource_expression
|
||||
(identifier) @reference)
|
||||
|
||||
; Definitions
|
||||
|
||||
(type) @definition.associated
|
||||
|
||||
(object_property
|
||||
(identifier) @definition.field
|
||||
(_))
|
||||
|
||||
(object_property
|
||||
(compatible_identifier) @definition.field
|
||||
(_))
|
||||
|
||||
(import_name) @definition.import
|
||||
|
||||
(module_declaration
|
||||
(identifier) @definition.namespace)
|
||||
|
||||
(parameter_declaration
|
||||
(identifier) @definition.parameter
|
||||
(_))
|
||||
|
||||
(type_declaration
|
||||
(identifier) @definition.type
|
||||
(_))
|
||||
|
||||
(variable_declaration
|
||||
(identifier) @definition.var
|
||||
(_))
|
||||
|
||||
(metadata_declaration
|
||||
(identifier) @definition.var
|
||||
(_))
|
||||
|
||||
(output_declaration
|
||||
(identifier) @definition.var
|
||||
(_))
|
||||
|
||||
(for_statement
|
||||
"for"
|
||||
(for_loop_parameters
|
||||
(loop_variable) @definition.var
|
||||
(loop_enumerator) @definition.var))
|
||||
29
runtime/queries/bitbake/folds.scm
Normal file
29
runtime/queries/bitbake/folds.scm
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
[
|
||||
(function_definition)
|
||||
(anonymous_python_function)
|
||||
(python_function_definition)
|
||||
|
||||
(while_statement)
|
||||
(for_statement)
|
||||
(if_statement)
|
||||
(with_statement)
|
||||
(try_statement)
|
||||
|
||||
(import_from_statement)
|
||||
(parameters)
|
||||
(argument_list)
|
||||
|
||||
(parenthesized_expression)
|
||||
(generator_expression)
|
||||
(list_comprehension)
|
||||
(set_comprehension)
|
||||
(dictionary_comprehension)
|
||||
|
||||
(tuple)
|
||||
(list)
|
||||
(set)
|
||||
(dictionary)
|
||||
|
||||
(string)
|
||||
(python_string)
|
||||
] @fold
|
||||
360
runtime/queries/bitbake/highlights.scm
Normal file
360
runtime/queries/bitbake/highlights.scm
Normal file
|
|
@ -0,0 +1,360 @@
|
|||
; Includes
|
||||
|
||||
[
|
||||
"inherit"
|
||||
"include"
|
||||
"require"
|
||||
"export"
|
||||
"import"
|
||||
] @include
|
||||
|
||||
; Keywords
|
||||
|
||||
[
|
||||
"unset"
|
||||
"EXPORT_FUNCTIONS"
|
||||
"python"
|
||||
|
||||
"assert"
|
||||
"exec"
|
||||
"global"
|
||||
"nonlocal"
|
||||
"pass"
|
||||
"print"
|
||||
"with"
|
||||
"as"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"async"
|
||||
"await"
|
||||
] @keyword.coroutine
|
||||
|
||||
[
|
||||
"return"
|
||||
"yield"
|
||||
] @keyword.return
|
||||
(yield "from" @keyword.return)
|
||||
|
||||
(future_import_statement
|
||||
"from" @include
|
||||
"__future__" @constant.builtin)
|
||||
(import_from_statement "from" @include)
|
||||
"import" @include
|
||||
|
||||
(aliased_import "as" @include)
|
||||
|
||||
["if" "elif" "else"] @conditional
|
||||
|
||||
["for" "while" "break" "continue"] @repeat
|
||||
|
||||
[
|
||||
"try"
|
||||
"except"
|
||||
"except*"
|
||||
"raise"
|
||||
"finally"
|
||||
] @exception
|
||||
|
||||
(raise_statement "from" @exception)
|
||||
|
||||
(try_statement
|
||||
(else_clause
|
||||
"else" @exception))
|
||||
|
||||
[
|
||||
"addtask"
|
||||
"deltask"
|
||||
"addhandler"
|
||||
"def"
|
||||
"lambda"
|
||||
] @keyword.function
|
||||
|
||||
[
|
||||
"before"
|
||||
"after"
|
||||
] @storageclass
|
||||
|
||||
[
|
||||
"append"
|
||||
"prepend"
|
||||
"remove"
|
||||
] @type.qualifier
|
||||
|
||||
; Variables
|
||||
|
||||
[
|
||||
(identifier)
|
||||
(python_identifier)
|
||||
] @variable
|
||||
|
||||
[
|
||||
"noexec"
|
||||
"INHERIT"
|
||||
"OVERRIDES"
|
||||
"$BB_ENV_PASSTHROUGH"
|
||||
"$BB_ENV_PASSTHROUGH_ADDITIONS"
|
||||
] @variable.builtin
|
||||
|
||||
; Reset highlighting in f-string interpolations
|
||||
(interpolation) @none
|
||||
|
||||
;; Identifier naming conventions
|
||||
((python_identifier) @type
|
||||
(#lua-match? @type "^[A-Z].*[a-z]"))
|
||||
([(identifier) (python_identifier)] @constant
|
||||
(#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
|
||||
|
||||
((python_identifier) @constant.builtin
|
||||
(#lua-match? @constant.builtin "^__[a-zA-Z0-9_]*__$"))
|
||||
|
||||
((python_identifier) @constant.builtin
|
||||
(#any-of? @constant.builtin
|
||||
;; https://docs.python.org/3/library/constants.html
|
||||
"NotImplemented"
|
||||
"Ellipsis"
|
||||
"quit"
|
||||
"exit"
|
||||
"copyright"
|
||||
"credits"
|
||||
"license"))
|
||||
|
||||
((assignment
|
||||
left: (python_identifier) @type.definition
|
||||
(type (python_identifier) @_annotation))
|
||||
(#eq? @_annotation "TypeAlias"))
|
||||
|
||||
((assignment
|
||||
left: (python_identifier) @type.definition
|
||||
right: (call
|
||||
function: (python_identifier) @_func))
|
||||
(#any-of? @_func "TypeVar" "NewType"))
|
||||
|
||||
; Fields
|
||||
|
||||
(flag) @field
|
||||
|
||||
((attribute
|
||||
attribute: (python_identifier) @field)
|
||||
(#lua-match? @field "^[%l_].*$"))
|
||||
|
||||
; Functions
|
||||
|
||||
(call
|
||||
function: (python_identifier) @function.call)
|
||||
|
||||
(call
|
||||
function: (attribute
|
||||
attribute: (python_identifier) @method.call))
|
||||
|
||||
((call
|
||||
function: (python_identifier) @constructor)
|
||||
(#lua-match? @constructor "^%u"))
|
||||
|
||||
((call
|
||||
function: (attribute
|
||||
attribute: (python_identifier) @constructor))
|
||||
(#lua-match? @constructor "^%u"))
|
||||
|
||||
((call
|
||||
function: (python_identifier) @function.builtin)
|
||||
(#any-of? @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__"))
|
||||
|
||||
(python_function_definition
|
||||
name: (python_identifier) @function)
|
||||
|
||||
(type (python_identifier) @type)
|
||||
(type
|
||||
(subscript
|
||||
(python_identifier) @type)) ; type subscript: Tuple[int]
|
||||
|
||||
((call
|
||||
function: (python_identifier) @_isinstance
|
||||
arguments: (argument_list
|
||||
(_)
|
||||
(python_identifier) @type))
|
||||
(#eq? @_isinstance "isinstance"))
|
||||
|
||||
(anonymous_python_function (identifier) @function)
|
||||
|
||||
(function_definition (identifier) @function)
|
||||
|
||||
(addtask_statement (identifier) @function)
|
||||
|
||||
(deltask_statement (identifier) @function)
|
||||
|
||||
(export_functions_statement (identifier) @function)
|
||||
|
||||
(addhandler_statement (identifier) @function)
|
||||
|
||||
(python_function_definition
|
||||
body:
|
||||
(block
|
||||
. (expression_statement (python_string) @string.documentation @spell)))
|
||||
|
||||
; Namespace
|
||||
|
||||
(inherit_directive (identifier) @namespace)
|
||||
|
||||
;; Normal parameters
|
||||
(parameters
|
||||
(python_identifier) @parameter)
|
||||
;; Lambda parameters
|
||||
(lambda_parameters
|
||||
(python_identifier) @parameter)
|
||||
(lambda_parameters
|
||||
(tuple_pattern
|
||||
(python_identifier) @parameter))
|
||||
; Default parameters
|
||||
(keyword_argument
|
||||
name: (python_identifier) @parameter)
|
||||
; Naming parameters on call-site
|
||||
(default_parameter
|
||||
name: (python_identifier) @parameter)
|
||||
(typed_parameter
|
||||
(python_identifier) @parameter)
|
||||
(typed_default_parameter
|
||||
(python_identifier) @parameter)
|
||||
; Variadic parameters *args, **kwargs
|
||||
(parameters
|
||||
(list_splat_pattern ; *args
|
||||
(python_identifier) @parameter))
|
||||
(parameters
|
||||
(dictionary_splat_pattern ; **kwargs
|
||||
(python_identifier) @parameter))
|
||||
|
||||
;; Literals
|
||||
|
||||
(none) @constant.builtin
|
||||
[(true) (false)] @boolean
|
||||
((python_identifier) @variable.builtin
|
||||
(#eq? @variable.builtin "self"))
|
||||
((python_identifier) @variable.builtin
|
||||
(#eq? @variable.builtin "cls"))
|
||||
|
||||
(integer) @number
|
||||
(float) @float
|
||||
|
||||
; Operators
|
||||
|
||||
[
|
||||
"?="
|
||||
"??="
|
||||
":="
|
||||
"=+"
|
||||
".="
|
||||
"=."
|
||||
"-"
|
||||
"-="
|
||||
":="
|
||||
"!="
|
||||
"*"
|
||||
"**"
|
||||
"**="
|
||||
"*="
|
||||
"/"
|
||||
"//"
|
||||
"//="
|
||||
"/="
|
||||
"&"
|
||||
"&="
|
||||
"%"
|
||||
"%="
|
||||
"^"
|
||||
"^="
|
||||
"+"
|
||||
"+="
|
||||
"<"
|
||||
"<<"
|
||||
"<<="
|
||||
"<="
|
||||
"<>"
|
||||
"="
|
||||
"=="
|
||||
">"
|
||||
">="
|
||||
">>"
|
||||
">>="
|
||||
"@"
|
||||
"@="
|
||||
"|"
|
||||
"|="
|
||||
"~"
|
||||
"->"
|
||||
] @operator
|
||||
|
||||
[
|
||||
"and"
|
||||
"in"
|
||||
"is"
|
||||
"not"
|
||||
"or"
|
||||
"is not"
|
||||
"not in"
|
||||
|
||||
"del"
|
||||
] @keyword.operator
|
||||
|
||||
; Literals
|
||||
|
||||
[
|
||||
(string)
|
||||
(python_string)
|
||||
"\""
|
||||
] @string
|
||||
|
||||
(include_path) @string.special
|
||||
|
||||
[
|
||||
(escape_sequence)
|
||||
(escape_interpolation)
|
||||
] @string.escape
|
||||
|
||||
; Punctuation
|
||||
|
||||
[ "(" ")" "{" "}" "[" "]" ] @punctuation.bracket
|
||||
|
||||
[
|
||||
":"
|
||||
"->"
|
||||
";"
|
||||
"."
|
||||
","
|
||||
(ellipsis)
|
||||
] @punctuation.delimiter
|
||||
|
||||
(variable_expansion [ "${" "}" ] @punctuation.special)
|
||||
(inline_python [ "${@" "}" ] @punctuation.special)
|
||||
(interpolation
|
||||
"{" @punctuation.special
|
||||
"}" @punctuation.special)
|
||||
|
||||
(type_conversion) @function.macro
|
||||
|
||||
([(identifier) (python_identifier)] @type.builtin
|
||||
(#any-of? @type.builtin
|
||||
;; https://docs.python.org/3/library/exceptions.html
|
||||
"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"
|
||||
;; https://docs.python.org/3/library/stdtypes.html
|
||||
"bool" "int" "float" "complex" "list" "tuple" "range" "str"
|
||||
"bytes" "bytearray" "memoryview" "set" "frozenset" "dict" "type" "object"))
|
||||
|
||||
(comment) @comment @spell
|
||||
|
||||
(ERROR) @error
|
||||
127
runtime/queries/bitbake/indents.scm
Normal file
127
runtime/queries/bitbake/indents.scm
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
[
|
||||
(import_from_statement)
|
||||
|
||||
(parenthesized_expression)
|
||||
(generator_expression)
|
||||
(list_comprehension)
|
||||
(set_comprehension)
|
||||
(dictionary_comprehension)
|
||||
|
||||
(tuple_pattern)
|
||||
(list_pattern)
|
||||
(binary_operator)
|
||||
|
||||
(lambda)
|
||||
|
||||
(concatenated_string)
|
||||
] @indent.begin
|
||||
|
||||
((list) @indent.align
|
||||
(#set! indent.open_delimiter "[")
|
||||
(#set! indent.close_delimiter "]")
|
||||
)
|
||||
((dictionary) @indent.align
|
||||
(#set! indent.open_delimiter "{")
|
||||
(#set! indent.close_delimiter "}")
|
||||
)
|
||||
((set) @indent.align
|
||||
(#set! indent.open_delimiter "{")
|
||||
(#set! indent.close_delimiter "}")
|
||||
)
|
||||
|
||||
((for_statement) @indent.begin
|
||||
(#set! indent.immediate 1))
|
||||
((if_statement) @indent.begin
|
||||
(#set! indent.immediate 1))
|
||||
((while_statement) @indent.begin
|
||||
(#set! indent.immediate 1))
|
||||
((try_statement) @indent.begin
|
||||
(#set! indent.immediate 1))
|
||||
(ERROR "try" ":" @indent.begin (#set! indent.immediate 1))
|
||||
((python_function_definition) @indent.begin
|
||||
(#set! indent.immediate 1))
|
||||
(function_definition) @indent.begin
|
||||
(anonymous_python_function) @indent.begin
|
||||
((with_statement) @indent.begin
|
||||
(#set! indent.immediate 1))
|
||||
|
||||
(if_statement
|
||||
condition: (parenthesized_expression) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")")
|
||||
(#set! indent.avoid_last_matching_next 1))
|
||||
(while_statement
|
||||
condition: (parenthesized_expression) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")")
|
||||
(#set! indent.avoid_last_matching_next 1))
|
||||
|
||||
(ERROR "(" @indent.align (#set! indent.open_delimiter "(") (#set! indent.close_delimiter ")") . (_))
|
||||
((argument_list) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
((parameters) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")")
|
||||
(#set! indent.avoid_last_matching_next 1))
|
||||
((tuple) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
|
||||
(ERROR "[" @indent.align (#set! indent.open_delimiter "[") (#set! indent.close_delimiter "]") . (_))
|
||||
|
||||
(ERROR "{" @indent.align (#set! indent.open_delimiter "{") (#set! indent.close_delimiter "}") . (_))
|
||||
|
||||
[
|
||||
(break_statement)
|
||||
(continue_statement)
|
||||
] @indent.dedent
|
||||
|
||||
(ERROR
|
||||
(_) @indent.branch ":" .
|
||||
(#lua-match? @indent.branch "^else"))
|
||||
|
||||
(ERROR
|
||||
(_) @indent.branch @indent.dedent ":" .
|
||||
(#lua-match? @indent.branch "^elif"))
|
||||
|
||||
(parenthesized_expression ")" @indent.end)
|
||||
(generator_expression ")" @indent.end)
|
||||
(list_comprehension "]" @indent.end)
|
||||
(set_comprehension "}" @indent.end)
|
||||
(dictionary_comprehension "}" @indent.end)
|
||||
|
||||
(tuple_pattern ")" @indent.end)
|
||||
(list_pattern "]" @indent.end)
|
||||
|
||||
(function_definition "}" @indent.end)
|
||||
(anonymous_python_function "}" @indent.end)
|
||||
|
||||
(return_statement
|
||||
[
|
||||
(_) @indent.end
|
||||
(_
|
||||
[
|
||||
(_)
|
||||
")"
|
||||
"}"
|
||||
"]"
|
||||
] @indent.end .)
|
||||
(attribute
|
||||
attribute: (_) @indent.end)
|
||||
(call
|
||||
arguments: (_ ")" @indent.end))
|
||||
"return" @indent.end
|
||||
] .)
|
||||
|
||||
[
|
||||
")"
|
||||
"]"
|
||||
"}"
|
||||
(elif_clause)
|
||||
(else_clause)
|
||||
(except_clause)
|
||||
(finally_clause)
|
||||
] @indent.branch
|
||||
|
||||
(string) @indent.auto
|
||||
14
runtime/queries/bitbake/injections.scm
Normal file
14
runtime/queries/bitbake/injections.scm
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
(call
|
||||
function: (attribute
|
||||
object: (python_identifier) @_re)
|
||||
arguments: (argument_list (python_string
|
||||
(string_content) @injection.content) @_string)
|
||||
(#eq? @_re "re")
|
||||
(#lua-match? @_string "^r.*")
|
||||
(#set! injection.language "regex"))
|
||||
|
||||
((shell_content) @injection.content
|
||||
(#set! injection.language "bash"))
|
||||
|
||||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
99
runtime/queries/bitbake/locals.scm
Normal file
99
runtime/queries/bitbake/locals.scm
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
; References
|
||||
[
|
||||
(python_identifier)
|
||||
(identifier)
|
||||
] @reference
|
||||
|
||||
; Imports
|
||||
(aliased_import
|
||||
alias: (python_identifier) @definition.import)
|
||||
(import_statement
|
||||
name: (dotted_name ((python_identifier) @definition.import)))
|
||||
(import_from_statement
|
||||
name: (dotted_name ((python_identifier) @definition.import)))
|
||||
|
||||
; Function with parameters, defines parameters
|
||||
(parameters
|
||||
(python_identifier) @definition.parameter)
|
||||
|
||||
(default_parameter
|
||||
(python_identifier) @definition.parameter)
|
||||
|
||||
(typed_parameter
|
||||
(python_identifier) @definition.parameter)
|
||||
|
||||
(typed_default_parameter
|
||||
(python_identifier) @definition.parameter)
|
||||
|
||||
; *args parameter
|
||||
(parameters
|
||||
(list_splat_pattern
|
||||
(python_identifier) @definition.parameter))
|
||||
|
||||
; **kwargs parameter
|
||||
(parameters
|
||||
(dictionary_splat_pattern
|
||||
(python_identifier) @definition.parameter))
|
||||
|
||||
; Function defines function and scope
|
||||
((python_function_definition
|
||||
name: (python_identifier) @definition.function) @scope
|
||||
(#set! definition.function.scope "parent"))
|
||||
|
||||
(function_definition (identifier) @definition.function)
|
||||
|
||||
(anonymous_python_function (identifier) @definition.function)
|
||||
|
||||
;;; Loops
|
||||
; not a scope!
|
||||
(for_statement
|
||||
left: (pattern_list
|
||||
(python_identifier) @definition.var))
|
||||
(for_statement
|
||||
left: (tuple_pattern
|
||||
(python_identifier) @definition.var))
|
||||
(for_statement
|
||||
left: (python_identifier) @definition.var)
|
||||
|
||||
; not a scope!
|
||||
;(while_statement) @scope
|
||||
|
||||
; for in list comprehension
|
||||
(for_in_clause
|
||||
left: (python_identifier) @definition.var)
|
||||
(for_in_clause
|
||||
left: (tuple_pattern
|
||||
(python_identifier) @definition.var))
|
||||
(for_in_clause
|
||||
left: (pattern_list
|
||||
(python_identifier) @definition.var))
|
||||
|
||||
(dictionary_comprehension) @scope
|
||||
(list_comprehension) @scope
|
||||
(set_comprehension) @scope
|
||||
|
||||
;;; Assignments
|
||||
|
||||
(assignment
|
||||
left: (python_identifier) @definition.var)
|
||||
|
||||
(assignment
|
||||
left: (pattern_list
|
||||
(python_identifier) @definition.var))
|
||||
(assignment
|
||||
left: (tuple_pattern
|
||||
(python_identifier) @definition.var))
|
||||
|
||||
(assignment
|
||||
left: (attribute
|
||||
(python_identifier)
|
||||
(python_identifier) @definition.field))
|
||||
|
||||
(variable_assignment (identifier) operator: [ "=" "?=" "??=" ":=" ] @definition.var)
|
||||
|
||||
; Walrus operator x := 1
|
||||
(named_expression
|
||||
(python_identifier) @definition.var)
|
||||
|
||||
(as_pattern
|
||||
alias: (as_pattern_target) @definition.var)
|
||||
57
runtime/queries/blueprint/highlights.scm
Normal file
57
runtime/queries/blueprint/highlights.scm
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
(object_id) @variable
|
||||
|
||||
(string) @string
|
||||
(escape_sequence) @string.escape
|
||||
|
||||
(comment) @comment
|
||||
|
||||
(constant) @constant.builtin
|
||||
|
||||
(boolean) @boolean
|
||||
|
||||
(using) @include
|
||||
|
||||
(template) @keyword
|
||||
|
||||
(decorator) @attribute
|
||||
|
||||
(property_definition (property_name) @property)
|
||||
|
||||
(object) @type
|
||||
|
||||
(signal_binding (signal_name) @function.builtin)
|
||||
(signal_binding (function (identifier)) @function)
|
||||
(signal_binding "swapped" @keyword)
|
||||
|
||||
(styles_list "styles" @function.macro)
|
||||
(layout_definition "layout" @function.macro)
|
||||
|
||||
(gettext_string "_" @function.builtin)
|
||||
|
||||
(menu_definition "menu" @keyword)
|
||||
(menu_section "section" @keyword)
|
||||
(menu_item "item" @function.macro)
|
||||
|
||||
(template_definition (template_name_qualifier) @type.qualifier)
|
||||
|
||||
(import_statement (gobject_library) @namespace)
|
||||
|
||||
(import_statement (version_number) @float)
|
||||
|
||||
(float) @float
|
||||
(number) @number
|
||||
|
||||
[
|
||||
";"
|
||||
"."
|
||||
","
|
||||
] @punctuation.delimiter
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
20
runtime/queries/c/folds.scm
Normal file
20
runtime/queries/c/folds.scm
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
[
|
||||
(for_statement)
|
||||
(if_statement)
|
||||
(while_statement)
|
||||
(switch_statement)
|
||||
(case_statement)
|
||||
(function_definition)
|
||||
(struct_specifier)
|
||||
(enum_specifier)
|
||||
(comment)
|
||||
(preproc_if)
|
||||
(preproc_elif)
|
||||
(preproc_else)
|
||||
(preproc_ifdef)
|
||||
(initializer_list)
|
||||
(gnu_asm_expression)
|
||||
] @fold
|
||||
|
||||
(compound_statement
|
||||
(compound_statement) @fold)
|
||||
286
runtime/queries/c/highlights.scm
Normal file
286
runtime/queries/c/highlights.scm
Normal file
|
|
@ -0,0 +1,286 @@
|
|||
; Lower priority to prefer @parameter when identifier appears in parameter_declaration.
|
||||
((identifier) @variable (#set! "priority" 95))
|
||||
(preproc_def (preproc_arg) @variable)
|
||||
|
||||
[
|
||||
"default"
|
||||
"enum"
|
||||
"struct"
|
||||
"typedef"
|
||||
"union"
|
||||
"goto"
|
||||
"asm"
|
||||
"__asm__"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"sizeof"
|
||||
"offsetof"
|
||||
] @keyword.operator
|
||||
(alignof_expression . _ @keyword.operator)
|
||||
|
||||
"return" @keyword.return
|
||||
|
||||
[
|
||||
"while"
|
||||
"for"
|
||||
"do"
|
||||
"continue"
|
||||
"break"
|
||||
] @repeat
|
||||
|
||||
[
|
||||
"if"
|
||||
"else"
|
||||
"case"
|
||||
"switch"
|
||||
] @conditional
|
||||
|
||||
[
|
||||
"#if"
|
||||
"#ifdef"
|
||||
"#ifndef"
|
||||
"#else"
|
||||
"#elif"
|
||||
"#endif"
|
||||
"#elifdef"
|
||||
"#elifndef"
|
||||
(preproc_directive)
|
||||
] @preproc
|
||||
|
||||
"#define" @define
|
||||
|
||||
"#include" @include
|
||||
|
||||
[ ";" ":" "," "::" ] @punctuation.delimiter
|
||||
|
||||
"..." @punctuation.special
|
||||
|
||||
[ "(" ")" "[" "]" "{" "}"] @punctuation.bracket
|
||||
|
||||
[
|
||||
"="
|
||||
|
||||
"-"
|
||||
"*"
|
||||
"/"
|
||||
"+"
|
||||
"%"
|
||||
|
||||
"~"
|
||||
"|"
|
||||
"&"
|
||||
"^"
|
||||
"<<"
|
||||
">>"
|
||||
|
||||
"->"
|
||||
"."
|
||||
|
||||
"<"
|
||||
"<="
|
||||
">="
|
||||
">"
|
||||
"=="
|
||||
"!="
|
||||
|
||||
"!"
|
||||
"&&"
|
||||
"||"
|
||||
|
||||
"-="
|
||||
"+="
|
||||
"*="
|
||||
"/="
|
||||
"%="
|
||||
"|="
|
||||
"&="
|
||||
"^="
|
||||
">>="
|
||||
"<<="
|
||||
"--"
|
||||
"++"
|
||||
] @operator
|
||||
|
||||
;; Make sure the comma operator is given a highlight group after the comma
|
||||
;; punctuator so the operator is highlighted properly.
|
||||
(comma_expression [ "," ] @operator)
|
||||
|
||||
[
|
||||
(true)
|
||||
(false)
|
||||
] @boolean
|
||||
|
||||
(conditional_expression [ "?" ":" ] @conditional.ternary)
|
||||
|
||||
(string_literal) @string
|
||||
(system_lib_string) @string
|
||||
(escape_sequence) @string.escape
|
||||
|
||||
(null) @constant.builtin
|
||||
(number_literal) @number
|
||||
(char_literal) @character
|
||||
|
||||
((preproc_arg) @function.macro (#set! "priority" 90))
|
||||
(preproc_defined) @function.macro
|
||||
|
||||
(((field_expression
|
||||
(field_identifier) @property)) @_parent
|
||||
(#not-has-parent? @_parent template_method function_declarator call_expression))
|
||||
|
||||
(field_designator) @property
|
||||
(((field_identifier) @property)
|
||||
(#has-ancestor? @property field_declaration)
|
||||
(#not-has-ancestor? @property function_declarator))
|
||||
|
||||
(statement_identifier) @label
|
||||
|
||||
[
|
||||
(type_identifier)
|
||||
(type_descriptor)
|
||||
] @type
|
||||
|
||||
(storage_class_specifier) @storageclass
|
||||
|
||||
[
|
||||
(type_qualifier)
|
||||
(gnu_asm_qualifier)
|
||||
"__extension__"
|
||||
] @type.qualifier
|
||||
|
||||
(linkage_specification
|
||||
"extern" @storageclass)
|
||||
|
||||
(type_definition
|
||||
declarator: (type_identifier) @type.definition)
|
||||
|
||||
(primitive_type) @type.builtin
|
||||
|
||||
(sized_type_specifier _ @type.builtin type: _?)
|
||||
|
||||
((identifier) @constant
|
||||
(#lua-match? @constant "^[A-Z][A-Z0-9_]+$"))
|
||||
(preproc_def (preproc_arg) @constant
|
||||
(#lua-match? @constant "^[A-Z][A-Z0-9_]+$"))
|
||||
(enumerator
|
||||
name: (identifier) @constant)
|
||||
(case_statement
|
||||
value: (identifier) @constant)
|
||||
|
||||
((identifier) @constant.builtin
|
||||
(#any-of? @constant.builtin
|
||||
"stderr" "stdin" "stdout"
|
||||
"__FILE__" "__LINE__" "__DATE__" "__TIME__"
|
||||
"__STDC__" "__STDC_VERSION__" "__STDC_HOSTED__"
|
||||
"__cplusplus" "__OBJC__" "__ASSEMBLER__"
|
||||
"__BASE_FILE__" "__FILE_NAME__" "__INCLUDE_LEVEL__"
|
||||
"__TIMESTAMP__" "__clang__" "__clang_major__"
|
||||
"__clang_minor__" "__clang_patchlevel__"
|
||||
"__clang_version__" "__clang_literal_encoding__"
|
||||
"__clang_wide_literal_encoding__"
|
||||
"__FUNCTION__" "__func__" "__PRETTY_FUNCTION__"
|
||||
"__VA_ARGS__" "__VA_OPT__"))
|
||||
(preproc_def (preproc_arg) @constant.builtin
|
||||
(#any-of? @constant.builtin
|
||||
"stderr" "stdin" "stdout"
|
||||
"__FILE__" "__LINE__" "__DATE__" "__TIME__"
|
||||
"__STDC__" "__STDC_VERSION__" "__STDC_HOSTED__"
|
||||
"__cplusplus" "__OBJC__" "__ASSEMBLER__"
|
||||
"__BASE_FILE__" "__FILE_NAME__" "__INCLUDE_LEVEL__"
|
||||
"__TIMESTAMP__" "__clang__" "__clang_major__"
|
||||
"__clang_minor__" "__clang_patchlevel__"
|
||||
"__clang_version__" "__clang_literal_encoding__"
|
||||
"__clang_wide_literal_encoding__"
|
||||
"__FUNCTION__" "__func__" "__PRETTY_FUNCTION__"
|
||||
"__VA_ARGS__" "__VA_OPT__"))
|
||||
|
||||
(attribute_specifier
|
||||
(argument_list (identifier) @variable.builtin))
|
||||
((attribute_specifier
|
||||
(argument_list (call_expression
|
||||
function: (identifier) @variable.builtin))))
|
||||
|
||||
((call_expression
|
||||
function: (identifier) @function.builtin)
|
||||
(#lua-match? @function.builtin "^__builtin_"))
|
||||
((call_expression
|
||||
function: (identifier) @function.builtin)
|
||||
(#has-ancestor? @function.builtin attribute_specifier))
|
||||
|
||||
;; Preproc def / undef
|
||||
(preproc_def
|
||||
name: (_) @constant)
|
||||
(preproc_call
|
||||
directive: (preproc_directive) @_u
|
||||
argument: (_) @constant
|
||||
(#eq? @_u "#undef"))
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @function.call)
|
||||
(call_expression
|
||||
function: (field_expression
|
||||
field: (field_identifier) @function.call))
|
||||
(function_declarator
|
||||
declarator: (identifier) @function)
|
||||
(function_declarator
|
||||
declarator: (parenthesized_declarator
|
||||
(pointer_declarator
|
||||
declarator: (field_identifier) @function)))
|
||||
(preproc_function_def
|
||||
name: (identifier) @function.macro)
|
||||
|
||||
(comment) @comment @spell
|
||||
|
||||
((comment) @comment.documentation
|
||||
(#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$"))
|
||||
|
||||
;; Parameters
|
||||
(parameter_declaration
|
||||
declarator: (identifier) @parameter)
|
||||
|
||||
(parameter_declaration
|
||||
declarator: (array_declarator) @parameter)
|
||||
|
||||
(parameter_declaration
|
||||
declarator: (pointer_declarator) @parameter)
|
||||
|
||||
; K&R functions
|
||||
; To enable support for K&R functions,
|
||||
; add the following lines to your own query config and uncomment them.
|
||||
; They are commented out as they'll conflict with C++
|
||||
; Note that you'll need to have `; extends` at the top of your query file.
|
||||
;
|
||||
; (parameter_list (identifier) @parameter)
|
||||
;
|
||||
; (function_definition
|
||||
; declarator: _
|
||||
; (declaration
|
||||
; declarator: (identifier) @parameter))
|
||||
;
|
||||
; (function_definition
|
||||
; declarator: _
|
||||
; (declaration
|
||||
; declarator: (array_declarator) @parameter))
|
||||
;
|
||||
; (function_definition
|
||||
; declarator: _
|
||||
; (declaration
|
||||
; declarator: (pointer_declarator) @parameter))
|
||||
|
||||
(preproc_params (identifier) @parameter)
|
||||
|
||||
[
|
||||
"__attribute__"
|
||||
"__declspec"
|
||||
"__based"
|
||||
"__cdecl"
|
||||
"__clrcall"
|
||||
"__stdcall"
|
||||
"__fastcall"
|
||||
"__thiscall"
|
||||
"__vectorcall"
|
||||
(ms_pointer_modifier)
|
||||
(attribute_declaration)
|
||||
] @attribute
|
||||
|
||||
(ERROR) @error
|
||||
90
runtime/queries/c/indents.scm
Normal file
90
runtime/queries/c/indents.scm
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
[
|
||||
(compound_statement)
|
||||
(field_declaration_list)
|
||||
(case_statement)
|
||||
(enumerator_list)
|
||||
(compound_literal_expression)
|
||||
(initializer_list)
|
||||
(init_declarator)
|
||||
] @indent.begin
|
||||
|
||||
; With current indent logic, if we capture expression_statement with @indent.begin
|
||||
; It will be affected by _parent_ node with error subnodes deep down the tree
|
||||
; So narrow indent capture to check for error inside expression statement only,
|
||||
(expression_statement
|
||||
(_) @indent.begin
|
||||
";" @indent.end)
|
||||
|
||||
(ERROR
|
||||
"for" "(" @indent.begin ";" ";" ")" @indent.end)
|
||||
|
||||
((for_statement
|
||||
body: (_) @_body) @indent.begin
|
||||
(#not-has-type? @_body compound_statement))
|
||||
|
||||
(while_statement
|
||||
condition: (_) @indent.begin)
|
||||
|
||||
((while_statement
|
||||
body: (_) @_body) @indent.begin
|
||||
(#not-has-type? @_body compound_statement))
|
||||
|
||||
(
|
||||
(if_statement)
|
||||
.
|
||||
(ERROR "else" @indent.begin))
|
||||
|
||||
(if_statement
|
||||
condition: (_) @indent.begin)
|
||||
|
||||
;; Supports if without braces (but not both if-else without braces)
|
||||
((if_statement
|
||||
consequence:
|
||||
(_ ";" @indent.end) @_consequence
|
||||
(#not-has-type? @_consequence compound_statement)
|
||||
alternative:
|
||||
(else_clause
|
||||
"else" @indent.branch
|
||||
[
|
||||
(if_statement (compound_statement) @indent.dedent)? @indent.dedent
|
||||
(compound_statement)? @indent.dedent
|
||||
(_)? @indent.dedent
|
||||
]
|
||||
)?
|
||||
) @indent.begin)
|
||||
|
||||
(else_clause (_ . "{" @indent.branch))
|
||||
|
||||
|
||||
(compound_statement "}" @indent.end)
|
||||
|
||||
[
|
||||
")"
|
||||
"}"
|
||||
(statement_identifier)
|
||||
] @indent.branch
|
||||
|
||||
[
|
||||
"#define"
|
||||
"#ifdef"
|
||||
"#ifndef"
|
||||
"#elif"
|
||||
"#if"
|
||||
"#else"
|
||||
"#endif"
|
||||
] @indent.zero
|
||||
|
||||
[
|
||||
(preproc_arg)
|
||||
(string_literal)
|
||||
] @indent.ignore
|
||||
|
||||
((ERROR (parameter_declaration)) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
([(argument_list) (parameter_list)] @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
|
||||
(comment) @indent.auto
|
||||
|
||||
19
runtime/queries/c/injections.scm
Normal file
19
runtime/queries/c/injections.scm
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
((preproc_arg) @injection.content
|
||||
(#set! injection.language "c"))
|
||||
|
||||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
|
||||
((comment) @injection.content
|
||||
(#match? @injection.content "/\\*!([a-zA-Z]+:)?re2c")
|
||||
(#set! injection.language "re2c"))
|
||||
|
||||
((comment) @injection.content
|
||||
(#lua-match? @injection.content "/[*][!<*][^a-zA-Z]")
|
||||
(#set! injection.language "doxygen"))
|
||||
|
||||
; TODO: add when asm is added
|
||||
; (gnu_asm_expression assembly_code: (string_literal) @injection.content
|
||||
; (#set! injection.language "asm"))
|
||||
; (gnu_asm_expression assembly_code: (concatenated_string (string_literal) @injection.content)
|
||||
; (#set! injection.language "asm"))
|
||||
53
runtime/queries/c/locals.scm
Normal file
53
runtime/queries/c/locals.scm
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
;; Functions definitions
|
||||
(function_declarator
|
||||
declarator: (identifier) @definition.function)
|
||||
(preproc_function_def
|
||||
name: (identifier) @definition.macro) @scope
|
||||
|
||||
(preproc_def
|
||||
name: (identifier) @definition.macro)
|
||||
(pointer_declarator
|
||||
declarator: (identifier) @definition.var)
|
||||
(parameter_declaration
|
||||
declarator: (identifier) @definition.parameter)
|
||||
(init_declarator
|
||||
declarator: (identifier) @definition.var)
|
||||
(array_declarator
|
||||
declarator: (identifier) @definition.var)
|
||||
(declaration
|
||||
declarator: (identifier) @definition.var)
|
||||
(enum_specifier
|
||||
name: (_) @definition.type
|
||||
(enumerator_list
|
||||
(enumerator name: (identifier) @definition.var)))
|
||||
|
||||
;; Type / Struct / Enum
|
||||
(field_declaration
|
||||
declarator: (field_identifier) @definition.field)
|
||||
(type_definition
|
||||
declarator: (type_identifier) @definition.type)
|
||||
(struct_specifier
|
||||
name: (type_identifier) @definition.type)
|
||||
|
||||
;; goto
|
||||
(labeled_statement (statement_identifier) @definition)
|
||||
|
||||
;; References
|
||||
(identifier) @reference
|
||||
((field_identifier) @reference
|
||||
(#set! reference.kind "field"))
|
||||
((type_identifier) @reference
|
||||
(#set! reference.kind "type"))
|
||||
|
||||
(goto_statement (statement_identifier) @reference)
|
||||
|
||||
;; Scope
|
||||
[
|
||||
(for_statement)
|
||||
(if_statement)
|
||||
(while_statement)
|
||||
(translation_unit)
|
||||
(function_definition)
|
||||
(compound_statement) ; a block in curly braces
|
||||
(struct_specifier)
|
||||
] @scope
|
||||
15
runtime/queries/c_sharp/folds.scm
Normal file
15
runtime/queries/c_sharp/folds.scm
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
body: [
|
||||
(declaration_list)
|
||||
(switch_body)
|
||||
(enum_member_declaration_list)
|
||||
] @fold
|
||||
|
||||
accessors: [
|
||||
(accessor_list)
|
||||
] @fold
|
||||
|
||||
initializer: [
|
||||
(initializer_expression)
|
||||
] @fold
|
||||
|
||||
(block) @fold
|
||||
416
runtime/queries/c_sharp/highlights.scm
Normal file
416
runtime/queries/c_sharp/highlights.scm
Normal file
|
|
@ -0,0 +1,416 @@
|
|||
(identifier) @variable
|
||||
|
||||
((identifier) @keyword
|
||||
(#eq? @keyword "value")
|
||||
(#has-ancestor? @keyword accessor_declaration))
|
||||
|
||||
(method_declaration
|
||||
name: (identifier) @method)
|
||||
|
||||
(local_function_statement
|
||||
name: (identifier) @method)
|
||||
|
||||
(method_declaration
|
||||
type: (identifier) @type)
|
||||
|
||||
(local_function_statement
|
||||
type: (identifier) @type)
|
||||
|
||||
(interpolation) @none
|
||||
|
||||
(invocation_expression
|
||||
(member_access_expression
|
||||
name: (identifier) @method.call))
|
||||
|
||||
(invocation_expression
|
||||
function: (conditional_access_expression
|
||||
(member_binding_expression
|
||||
name: (identifier) @method.call)))
|
||||
|
||||
(namespace_declaration
|
||||
name: [(qualified_name) (identifier)] @namespace)
|
||||
|
||||
(qualified_name
|
||||
(identifier) @type)
|
||||
|
||||
(invocation_expression
|
||||
(identifier) @method.call)
|
||||
|
||||
(field_declaration
|
||||
(variable_declaration
|
||||
(variable_declarator
|
||||
(identifier) @field)))
|
||||
|
||||
(initializer_expression
|
||||
(assignment_expression
|
||||
left: (identifier) @field))
|
||||
|
||||
(parameter_list
|
||||
(parameter
|
||||
name: (identifier) @parameter))
|
||||
|
||||
(parameter_list
|
||||
(parameter
|
||||
type: (identifier) @type))
|
||||
|
||||
(integer_literal) @number
|
||||
(real_literal) @float
|
||||
|
||||
(null_literal) @constant.builtin
|
||||
(character_literal) @character
|
||||
|
||||
[
|
||||
(string_literal)
|
||||
(verbatim_string_literal)
|
||||
(interpolated_string_expression)
|
||||
] @string
|
||||
|
||||
(boolean_literal) @boolean
|
||||
|
||||
[
|
||||
(predefined_type)
|
||||
] @type.builtin
|
||||
|
||||
(implicit_type) @keyword
|
||||
|
||||
(comment) @comment @spell
|
||||
|
||||
((comment) @comment.documentation
|
||||
(#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$"))
|
||||
|
||||
((comment) @comment.documentation
|
||||
(#lua-match? @comment.documentation "^///[^/]"))
|
||||
((comment) @comment.documentation
|
||||
(#lua-match? @comment.documentation "^///$"))
|
||||
|
||||
(using_directive
|
||||
(identifier) @type)
|
||||
|
||||
(using_directive
|
||||
(name_equals (identifier) @type.definition))
|
||||
|
||||
(property_declaration
|
||||
name: (identifier) @property)
|
||||
|
||||
(property_declaration
|
||||
type: (identifier) @type)
|
||||
|
||||
(nullable_type
|
||||
(identifier) @type)
|
||||
|
||||
(catch_declaration
|
||||
type: (identifier) @type)
|
||||
|
||||
(interface_declaration
|
||||
name: (identifier) @type)
|
||||
(class_declaration
|
||||
name: (identifier) @type)
|
||||
(record_declaration
|
||||
name: (identifier) @type)
|
||||
(enum_declaration
|
||||
name: (identifier) @type)
|
||||
(constructor_declaration
|
||||
name: (identifier) @constructor)
|
||||
(constructor_initializer [
|
||||
"base" @constructor
|
||||
])
|
||||
|
||||
(variable_declaration
|
||||
(identifier) @type)
|
||||
(object_creation_expression
|
||||
(identifier) @type)
|
||||
|
||||
; Generic Types.
|
||||
(type_of_expression
|
||||
(generic_name
|
||||
(identifier) @type))
|
||||
|
||||
(type_argument_list
|
||||
(generic_name
|
||||
(identifier) @type))
|
||||
|
||||
(base_list
|
||||
(generic_name
|
||||
(identifier) @type))
|
||||
|
||||
(type_constraint
|
||||
(generic_name
|
||||
(identifier) @type))
|
||||
|
||||
(object_creation_expression
|
||||
(generic_name
|
||||
(identifier) @type))
|
||||
|
||||
(property_declaration
|
||||
(generic_name
|
||||
(identifier) @type))
|
||||
|
||||
(_
|
||||
type: (generic_name
|
||||
(identifier) @type))
|
||||
; Generic Method invocation with generic type
|
||||
(invocation_expression
|
||||
function: (generic_name
|
||||
. (identifier) @method.call))
|
||||
|
||||
(invocation_expression
|
||||
(member_access_expression
|
||||
(generic_name
|
||||
(identifier) @method)))
|
||||
|
||||
(base_list
|
||||
(identifier) @type)
|
||||
|
||||
(type_argument_list
|
||||
(identifier) @type)
|
||||
|
||||
(type_parameter_list
|
||||
(type_parameter) @type)
|
||||
|
||||
(type_parameter_constraints_clause
|
||||
target: (identifier) @type)
|
||||
|
||||
(attribute
|
||||
name: (identifier) @attribute)
|
||||
|
||||
(for_each_statement
|
||||
type: (identifier) @type)
|
||||
|
||||
(tuple_element
|
||||
type: (identifier) @type)
|
||||
|
||||
(tuple_expression
|
||||
(argument
|
||||
(declaration_expression
|
||||
type: (identifier) @type)))
|
||||
|
||||
(as_expression
|
||||
right: (identifier) @type)
|
||||
|
||||
(type_of_expression
|
||||
(identifier) @type)
|
||||
|
||||
(name_colon
|
||||
(identifier) @parameter)
|
||||
|
||||
(warning_directive) @text.warning
|
||||
(error_directive) @exception
|
||||
|
||||
(define_directive
|
||||
(identifier) @constant) @constant.macro
|
||||
(undef_directive
|
||||
(identifier) @constant) @constant.macro
|
||||
|
||||
(line_directive) @constant.macro
|
||||
(line_directive
|
||||
(preproc_integer_literal) @constant
|
||||
(preproc_string_literal)? @string)
|
||||
|
||||
(pragma_directive
|
||||
(identifier) @constant) @constant.macro
|
||||
(pragma_directive
|
||||
(preproc_string_literal) @string) @constant.macro
|
||||
|
||||
[
|
||||
(nullable_directive)
|
||||
(region_directive)
|
||||
(endregion_directive)
|
||||
] @constant.macro
|
||||
|
||||
[
|
||||
"if"
|
||||
"else"
|
||||
"switch"
|
||||
"break"
|
||||
"case"
|
||||
"when"
|
||||
(if_directive)
|
||||
(elif_directive)
|
||||
(else_directive)
|
||||
(endif_directive)
|
||||
] @conditional
|
||||
|
||||
(if_directive
|
||||
(identifier) @constant)
|
||||
(elif_directive
|
||||
(identifier) @constant)
|
||||
|
||||
[
|
||||
"while"
|
||||
"for"
|
||||
"do"
|
||||
"continue"
|
||||
"goto"
|
||||
"foreach"
|
||||
] @repeat
|
||||
|
||||
[
|
||||
"try"
|
||||
"catch"
|
||||
"throw"
|
||||
"finally"
|
||||
] @exception
|
||||
|
||||
[
|
||||
"+"
|
||||
"?"
|
||||
":"
|
||||
"++"
|
||||
"-"
|
||||
"--"
|
||||
"&"
|
||||
"&&"
|
||||
"|"
|
||||
"||"
|
||||
"!"
|
||||
"!="
|
||||
"=="
|
||||
"*"
|
||||
"/"
|
||||
"%"
|
||||
"<"
|
||||
"<="
|
||||
">"
|
||||
">="
|
||||
"="
|
||||
"-="
|
||||
"+="
|
||||
"*="
|
||||
"/="
|
||||
"%="
|
||||
"^"
|
||||
"^="
|
||||
"&="
|
||||
"|="
|
||||
"~"
|
||||
">>"
|
||||
">>>"
|
||||
"<<"
|
||||
"<<="
|
||||
">>="
|
||||
">>>="
|
||||
"=>"
|
||||
"??"
|
||||
"??="
|
||||
] @operator
|
||||
|
||||
[
|
||||
";"
|
||||
"."
|
||||
","
|
||||
":"
|
||||
] @punctuation.delimiter
|
||||
|
||||
(conditional_expression ["?" ":"] @conditional.ternary)
|
||||
|
||||
[
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
"("
|
||||
")"
|
||||
] @punctuation.bracket
|
||||
|
||||
(type_argument_list ["<" ">"] @punctuation.bracket)
|
||||
|
||||
[
|
||||
(this_expression)
|
||||
(base_expression)
|
||||
] @variable.builtin
|
||||
|
||||
[
|
||||
"using"
|
||||
"as"
|
||||
] @include
|
||||
|
||||
(alias_qualified_name
|
||||
(identifier "global") @include)
|
||||
|
||||
[
|
||||
"with"
|
||||
"new"
|
||||
"typeof"
|
||||
"sizeof"
|
||||
"is"
|
||||
"and"
|
||||
"or"
|
||||
"not"
|
||||
"stackalloc"
|
||||
"in"
|
||||
"out"
|
||||
"ref"
|
||||
] @keyword.operator
|
||||
|
||||
[
|
||||
"lock"
|
||||
"params"
|
||||
"operator"
|
||||
"default"
|
||||
"implicit"
|
||||
"explicit"
|
||||
"override"
|
||||
"class"
|
||||
"delegate"
|
||||
"enum"
|
||||
"interface"
|
||||
"namespace"
|
||||
"struct"
|
||||
"get"
|
||||
"set"
|
||||
"init"
|
||||
"where"
|
||||
"record"
|
||||
"event"
|
||||
"add"
|
||||
"remove"
|
||||
"checked"
|
||||
"unchecked"
|
||||
"fixed"
|
||||
"alias"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"async"
|
||||
"await"
|
||||
] @keyword.coroutine
|
||||
|
||||
[
|
||||
"const"
|
||||
"extern"
|
||||
"readonly"
|
||||
"static"
|
||||
"volatile"
|
||||
"required"
|
||||
] @storageclass
|
||||
|
||||
[
|
||||
"abstract"
|
||||
"private"
|
||||
"protected"
|
||||
"internal"
|
||||
"public"
|
||||
"partial"
|
||||
"sealed"
|
||||
"virtual"
|
||||
] @type.qualifier
|
||||
|
||||
(parameter_modifier) @operator
|
||||
|
||||
(query_expression
|
||||
(_ [
|
||||
"from"
|
||||
"orderby"
|
||||
"select"
|
||||
"group"
|
||||
"by"
|
||||
"ascending"
|
||||
"descending"
|
||||
"equals"
|
||||
"let"
|
||||
] @keyword))
|
||||
|
||||
[
|
||||
"return"
|
||||
"yield"
|
||||
] @keyword.return
|
||||
2
runtime/queries/c_sharp/injections.scm
Normal file
2
runtime/queries/c_sharp/injections.scm
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
41
runtime/queries/c_sharp/locals.scm
Normal file
41
runtime/queries/c_sharp/locals.scm
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
;; Definitions
|
||||
(variable_declarator
|
||||
. (identifier) @definition.var)
|
||||
|
||||
(variable_declarator
|
||||
(tuple_pattern
|
||||
(identifier) @definition.var))
|
||||
|
||||
(declaration_expression
|
||||
name: (identifier) @definition.var)
|
||||
|
||||
(for_each_statement
|
||||
left: (identifier) @definition.var)
|
||||
|
||||
(for_each_statement
|
||||
left: (tuple_pattern
|
||||
(identifier) @definition.var))
|
||||
|
||||
(parameter
|
||||
(identifier) @definition.parameter)
|
||||
|
||||
(method_declaration
|
||||
name: (identifier) @definition.method)
|
||||
|
||||
(local_function_statement
|
||||
name: (identifier) @definition.method)
|
||||
|
||||
(property_declaration
|
||||
name: (identifier) @definition)
|
||||
|
||||
(type_parameter
|
||||
(identifier) @definition.type)
|
||||
|
||||
(class_declaration
|
||||
name: (identifier) @definition)
|
||||
|
||||
;; References
|
||||
(identifier) @reference
|
||||
|
||||
;; Scope
|
||||
(block) @scope
|
||||
31
runtime/queries/cairo/folds.scm
Normal file
31
runtime/queries/cairo/folds.scm
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
[
|
||||
(mod_item)
|
||||
(struct_item)
|
||||
(trait_item)
|
||||
(enum_item)
|
||||
(impl_item)
|
||||
(type_item)
|
||||
|
||||
(use_declaration)
|
||||
(let_declaration)
|
||||
(namespace_definition)
|
||||
|
||||
(arguments)
|
||||
(implicit_arguments)
|
||||
(tuple_type)
|
||||
|
||||
(import_statement)
|
||||
(attribute_statement)
|
||||
(with_statement)
|
||||
(if_statement)
|
||||
|
||||
(function_definition)
|
||||
(struct_definition)
|
||||
(loop_expression)
|
||||
(if_expression)
|
||||
(match_expression)
|
||||
(call_expression)
|
||||
(tuple_expression)
|
||||
|
||||
(attribute_item)
|
||||
] @fold
|
||||
338
runtime/queries/cairo/highlights.scm
Normal file
338
runtime/queries/cairo/highlights.scm
Normal file
|
|
@ -0,0 +1,338 @@
|
|||
; Preproc
|
||||
|
||||
[
|
||||
"%builtins"
|
||||
"%lang"
|
||||
] @preproc
|
||||
|
||||
; Includes
|
||||
|
||||
(import_statement [ "from" "import" ] @include module_name: (dotted_name (identifier) @namespace . ))
|
||||
|
||||
[
|
||||
"as"
|
||||
"use"
|
||||
"mod"
|
||||
] @include
|
||||
|
||||
; Variables
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
; Namespaces
|
||||
|
||||
(namespace_definition (identifier) @namespace)
|
||||
|
||||
(mod_item
|
||||
name: (identifier) @namespace)
|
||||
|
||||
(use_list (self) @namespace)
|
||||
|
||||
(scoped_use_list (self) @namespace)
|
||||
|
||||
(scoped_identifier
|
||||
path: (identifier) @namespace)
|
||||
|
||||
(scoped_identifier
|
||||
(scoped_identifier
|
||||
name: (identifier) @namespace))
|
||||
|
||||
(scoped_type_identifier
|
||||
path: (identifier) @namespace)
|
||||
|
||||
((scoped_identifier
|
||||
path: (identifier) @type)
|
||||
(#lua-match? @type "^[A-Z]"))
|
||||
|
||||
((scoped_identifier
|
||||
name: (identifier) @type)
|
||||
(#lua-match? @type "^[A-Z]"))
|
||||
|
||||
((scoped_identifier
|
||||
name: (identifier) @constant)
|
||||
(#lua-match? @constant "^[A-Z][A-Z%d_]*$"))
|
||||
|
||||
((scoped_identifier
|
||||
path: (identifier) @type
|
||||
name: (identifier) @constant)
|
||||
(#lua-match? @type "^[A-Z]")
|
||||
(#lua-match? @constant "^[A-Z]"))
|
||||
|
||||
((scoped_type_identifier
|
||||
path: (identifier) @type
|
||||
name: (type_identifier) @constant)
|
||||
(#lua-match? @type "^[A-Z]")
|
||||
(#lua-match? @constant "^[A-Z]"))
|
||||
|
||||
(scoped_use_list
|
||||
path: (identifier) @namespace)
|
||||
|
||||
(scoped_use_list
|
||||
path: (scoped_identifier
|
||||
(identifier) @namespace))
|
||||
|
||||
(use_list (scoped_identifier (identifier) @namespace . (_)))
|
||||
|
||||
(use_list (identifier) @type (#lua-match? @type "^[A-Z]"))
|
||||
|
||||
(use_as_clause alias: (identifier) @type (#lua-match? @type "^[A-Z]"))
|
||||
|
||||
; Keywords
|
||||
|
||||
[
|
||||
; 0.x
|
||||
"using"
|
||||
"namespace"
|
||||
"struct"
|
||||
"let"
|
||||
"const"
|
||||
"local"
|
||||
"rel"
|
||||
"abs"
|
||||
"dw"
|
||||
"alloc_locals"
|
||||
(inst_ret)
|
||||
"with_attr"
|
||||
"with"
|
||||
"call"
|
||||
"nondet"
|
||||
|
||||
; 1.0
|
||||
"type"
|
||||
"impl"
|
||||
"implicits"
|
||||
"of"
|
||||
"ref"
|
||||
"mut"
|
||||
"trait"
|
||||
"enum"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"func"
|
||||
"fn"
|
||||
"end"
|
||||
] @keyword.function
|
||||
|
||||
"return" @keyword.return
|
||||
|
||||
[
|
||||
"cast"
|
||||
"new"
|
||||
"and"
|
||||
] @keyword.operator
|
||||
|
||||
[
|
||||
"tempvar"
|
||||
"extern"
|
||||
] @storageclass
|
||||
|
||||
[
|
||||
"if"
|
||||
"else"
|
||||
"match"
|
||||
] @conditional
|
||||
|
||||
[
|
||||
"loop"
|
||||
] @repeat
|
||||
|
||||
[
|
||||
"assert"
|
||||
"static_assert"
|
||||
"nopanic"
|
||||
] @exception
|
||||
|
||||
; Fields
|
||||
|
||||
(implicit_arguments (typed_identifier (identifier) @field))
|
||||
|
||||
(member_expression "." (identifier) @field)
|
||||
|
||||
(call_expression (assignment_expression left: (identifier) @field))
|
||||
|
||||
(tuple_expression (assignment_expression left: (identifier) @field))
|
||||
|
||||
(field_identifier) @field
|
||||
|
||||
(shorthand_field_initializer (identifier) @field)
|
||||
|
||||
; Parameters
|
||||
|
||||
(arguments (typed_identifier (identifier) @parameter))
|
||||
|
||||
(call_expression (tuple_expression (assignment_expression left: (identifier) @parameter)))
|
||||
|
||||
(return_type (tuple_type (named_type . (identifier) @parameter)))
|
||||
|
||||
(parameter (identifier) @parameter)
|
||||
|
||||
; Builtins
|
||||
|
||||
(builtin_directive (identifier) @variable.builtin)
|
||||
(lang_directive (identifier) @variable.builtin)
|
||||
|
||||
[
|
||||
"ap"
|
||||
"fp"
|
||||
(self)
|
||||
] @variable.builtin
|
||||
|
||||
; Functions
|
||||
|
||||
(function_definition "func" (identifier) @function)
|
||||
(function_definition "fn" (identifier) @function)
|
||||
(function_signature "fn" (identifier) @function)
|
||||
(extern_function_statement (identifier) @function)
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @function.call)
|
||||
|
||||
(call_expression
|
||||
function: (scoped_identifier
|
||||
(identifier) @function.call .))
|
||||
|
||||
(call_expression
|
||||
function: (field_expression
|
||||
field: (field_identifier) @function.call))
|
||||
|
||||
[
|
||||
"jmp"
|
||||
] @function.builtin
|
||||
|
||||
; Types
|
||||
|
||||
(struct_definition . (identifier) @type (typed_identifier (identifier) @field)?)
|
||||
|
||||
(named_type (identifier) @type .)
|
||||
|
||||
[
|
||||
(builtin_type)
|
||||
(primitive_type)
|
||||
] @type.builtin
|
||||
|
||||
((identifier) @type
|
||||
(#lua-match? @type "^[A-Z][a-zA-Z0-9_]*$"))
|
||||
|
||||
(type_identifier) @type
|
||||
|
||||
; Constants
|
||||
|
||||
((identifier) @constant
|
||||
(#lua-match? @constant "^[A-Z_][A-Z0-9_]*$"))
|
||||
|
||||
(enum_variant
|
||||
name: (identifier) @constant)
|
||||
|
||||
(call_expression
|
||||
function: (scoped_identifier
|
||||
"::"
|
||||
name: (identifier) @constant)
|
||||
(#lua-match? @constant "^[A-Z]"))
|
||||
|
||||
((match_arm
|
||||
pattern: (match_pattern (identifier) @constant))
|
||||
(#lua-match? @constant "^[A-Z]"))
|
||||
|
||||
((match_arm
|
||||
pattern: (match_pattern
|
||||
(scoped_identifier
|
||||
name: (identifier) @constant)))
|
||||
(#lua-match? @constant "^[A-Z]"))
|
||||
|
||||
((identifier) @constant.builtin
|
||||
(#any-of? @constant.builtin "Some" "None" "Ok" "Err"))
|
||||
|
||||
; Constructors
|
||||
|
||||
(unary_expression "new" (call_expression . (identifier) @constructor))
|
||||
|
||||
((call_expression . (identifier) @constructor)
|
||||
(#lua-match? @constructor "^%u"))
|
||||
|
||||
; Attributes
|
||||
|
||||
(decorator "@" @attribute (identifier) @attribute)
|
||||
|
||||
(attribute_item (identifier) @function.macro)
|
||||
|
||||
(attribute_item (scoped_identifier (identifier) @function.macro .))
|
||||
|
||||
; Labels
|
||||
|
||||
(label . (identifier) @label)
|
||||
|
||||
(inst_jmp_to_label "jmp" . (identifier) @label)
|
||||
|
||||
(inst_jnz_to_label "jmp" . (identifier) @label)
|
||||
|
||||
; Operators
|
||||
|
||||
[
|
||||
"+"
|
||||
"-"
|
||||
"*"
|
||||
"/"
|
||||
"**"
|
||||
"=="
|
||||
"!="
|
||||
"&"
|
||||
"="
|
||||
"++"
|
||||
"+="
|
||||
"@"
|
||||
"!"
|
||||
"~"
|
||||
".."
|
||||
"&&"
|
||||
"||"
|
||||
"^"
|
||||
"<"
|
||||
"<="
|
||||
">"
|
||||
">="
|
||||
"<<"
|
||||
">>"
|
||||
"%"
|
||||
"-="
|
||||
"*="
|
||||
"/="
|
||||
"%="
|
||||
"&="
|
||||
"|="
|
||||
"^="
|
||||
"<<="
|
||||
">>="
|
||||
"?"
|
||||
] @operator
|
||||
|
||||
; Literals
|
||||
|
||||
(number) @number
|
||||
|
||||
(boolean) @boolean
|
||||
|
||||
[
|
||||
(string)
|
||||
(short_string)
|
||||
] @string
|
||||
|
||||
; Punctuation
|
||||
|
||||
(attribute_item "#" @punctuation.special)
|
||||
|
||||
[ "." "," ":" ";" "->" "=>" "::" ] @punctuation.delimiter
|
||||
|
||||
[ "{" "}" "(" ")" "[" "]" "%{" "%}" ] @punctuation.bracket
|
||||
|
||||
(type_parameters [ "<" ">" ] @punctuation.bracket)
|
||||
|
||||
(type_arguments [ "<" ">" ] @punctuation.bracket)
|
||||
|
||||
; Comment
|
||||
|
||||
(comment) @comment @spell
|
||||
|
||||
; Errors
|
||||
|
||||
(ERROR) @error
|
||||
45
runtime/queries/cairo/indents.scm
Normal file
45
runtime/queries/cairo/indents.scm
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
[
|
||||
(mod_item)
|
||||
(struct_item)
|
||||
(enum_item)
|
||||
(impl_item)
|
||||
(struct_expression)
|
||||
(match_expression)
|
||||
(tuple_expression)
|
||||
(match_arm)
|
||||
(match_block)
|
||||
(call_expression)
|
||||
(assignment_expression)
|
||||
(arguments)
|
||||
(block)
|
||||
(use_list)
|
||||
(field_declaration_list)
|
||||
(enum_variant_list)
|
||||
(tuple_pattern)
|
||||
] @indent.begin
|
||||
|
||||
(import_statement "(") @indent.begin
|
||||
|
||||
(block "}" @indent.end)
|
||||
(enum_item
|
||||
body: (enum_variant_list "}" @indent.end))
|
||||
(match_expression
|
||||
body: (match_block "}" @indent.end))
|
||||
(mod_item
|
||||
body: (declaration_list "}" @indent.end))
|
||||
(struct_item
|
||||
body: (field_declaration_list "}" @indent.end))
|
||||
(trait_item
|
||||
body: (declaration_list "}" @indent.end))
|
||||
|
||||
[
|
||||
")"
|
||||
"]"
|
||||
"}"
|
||||
] @indent.branch
|
||||
|
||||
[
|
||||
(comment)
|
||||
(string)
|
||||
(short_string)
|
||||
] @indent.ignore
|
||||
5
runtime/queries/cairo/injections.scm
Normal file
5
runtime/queries/cairo/injections.scm
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
((python_code) @injection.content
|
||||
(#set! injection.language "python"))
|
||||
|
||||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
68
runtime/queries/cairo/locals.scm
Normal file
68
runtime/queries/cairo/locals.scm
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
; References
|
||||
|
||||
(identifier) @reference
|
||||
((type_identifier) @reference
|
||||
(#set! reference.kind "type"))
|
||||
((field_identifier) @reference
|
||||
(#set! reference.kind "field"))
|
||||
|
||||
; Scopes
|
||||
|
||||
[
|
||||
(program)
|
||||
(block)
|
||||
(function_definition)
|
||||
(loop_expression)
|
||||
(if_expression)
|
||||
(match_expression)
|
||||
(match_arm)
|
||||
|
||||
(struct_item)
|
||||
(enum_item)
|
||||
(impl_item)
|
||||
] @scope
|
||||
|
||||
(use_declaration
|
||||
argument: (scoped_identifier
|
||||
name: (identifier) @definition.import))
|
||||
|
||||
(use_as_clause
|
||||
alias: (identifier) @definition.import)
|
||||
|
||||
(use_list
|
||||
(identifier) @definition.import) ; use std::process::{Child, Command, Stdio};
|
||||
|
||||
; Functions
|
||||
|
||||
(function_definition
|
||||
(identifier) @definition.function)
|
||||
|
||||
(function_definition
|
||||
(identifier) @definition.method
|
||||
(parameter (self)))
|
||||
|
||||
; Function with parameters, defines parameters
|
||||
|
||||
(parameter
|
||||
[ (identifier) (self) ] @definition.parameter)
|
||||
|
||||
; Types
|
||||
|
||||
(struct_item
|
||||
name: (type_identifier) @definition.type)
|
||||
|
||||
(constrained_type_parameter
|
||||
left: (type_identifier) @definition.type) ; the P in remove_file<P: AsRef<Path>>(path: P)
|
||||
|
||||
(enum_item
|
||||
name: (type_identifier) @definition.type)
|
||||
|
||||
; Module
|
||||
|
||||
(mod_item
|
||||
name: (identifier) @definition.namespace)
|
||||
|
||||
; Variables
|
||||
|
||||
(assignment_expression
|
||||
left: (identifier) @definition.var)
|
||||
14
runtime/queries/capnp/folds.scm
Normal file
14
runtime/queries/capnp/folds.scm
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
[
|
||||
(annotation_targets)
|
||||
(const_list)
|
||||
(enum)
|
||||
(interface)
|
||||
(implicit_generics)
|
||||
(generics)
|
||||
(group)
|
||||
(method_parameters)
|
||||
(named_return_types)
|
||||
(struct)
|
||||
(struct_shorthand)
|
||||
(union)
|
||||
] @fold
|
||||
154
runtime/queries/capnp/highlights.scm
Normal file
154
runtime/queries/capnp/highlights.scm
Normal file
|
|
@ -0,0 +1,154 @@
|
|||
; Preproc
|
||||
|
||||
[
|
||||
(unique_id)
|
||||
(top_level_annotation_body)
|
||||
] @preproc
|
||||
|
||||
; Includes
|
||||
|
||||
[
|
||||
"import"
|
||||
"$import"
|
||||
"embed"
|
||||
"using"
|
||||
] @include
|
||||
|
||||
(import_path) @string @text.uri
|
||||
|
||||
; Keywords
|
||||
|
||||
[
|
||||
"annotation"
|
||||
"enum"
|
||||
"group"
|
||||
"interface"
|
||||
"struct"
|
||||
"union"
|
||||
"extends"
|
||||
"namespace"
|
||||
] @keyword
|
||||
|
||||
; Builtins
|
||||
|
||||
[
|
||||
"const"
|
||||
] @type.qualifier
|
||||
|
||||
[
|
||||
(primitive_type)
|
||||
"List"
|
||||
] @type.builtin
|
||||
|
||||
; Typedefs
|
||||
|
||||
(type_definition) @type.definition
|
||||
|
||||
; Labels (@number, @number!)
|
||||
|
||||
(field_version) @label
|
||||
|
||||
; Methods
|
||||
|
||||
[
|
||||
(annotation_definition_identifier)
|
||||
(method_identifier)
|
||||
] @method
|
||||
|
||||
; Fields
|
||||
|
||||
(field_identifier) @field
|
||||
|
||||
; Properties
|
||||
|
||||
(property) @property
|
||||
|
||||
; Parameters
|
||||
|
||||
[
|
||||
(param_identifier)
|
||||
(return_identifier)
|
||||
] @parameter
|
||||
|
||||
(annotation_target) @parameter.builtin
|
||||
|
||||
; Constants
|
||||
|
||||
[
|
||||
(const_identifier)
|
||||
(local_const)
|
||||
(enum_member)
|
||||
] @constant
|
||||
|
||||
(void) @constant.builtin
|
||||
|
||||
; Types
|
||||
|
||||
[
|
||||
(enum_identifier)
|
||||
(extend_type)
|
||||
(type_identifier)
|
||||
] @type
|
||||
|
||||
; Attributes
|
||||
|
||||
[
|
||||
(annotation_identifier)
|
||||
(attribute)
|
||||
] @attribute
|
||||
|
||||
; Operators
|
||||
|
||||
"=" @operator
|
||||
|
||||
; Literals
|
||||
|
||||
[
|
||||
(string)
|
||||
(concatenated_string)
|
||||
(block_text)
|
||||
(namespace)
|
||||
] @string
|
||||
|
||||
(namespace) @text.underline
|
||||
|
||||
(escape_sequence) @string.escape
|
||||
|
||||
(data_string) @string.special
|
||||
|
||||
(number) @number
|
||||
|
||||
(float) @float
|
||||
|
||||
(boolean) @boolean
|
||||
|
||||
(data_hex) @symbol
|
||||
|
||||
; Punctuation
|
||||
|
||||
[
|
||||
"*"
|
||||
"$"
|
||||
":"
|
||||
] @punctuation.special
|
||||
|
||||
["{" "}"] @punctuation.bracket
|
||||
|
||||
["(" ")"] @punctuation.bracket
|
||||
|
||||
["[" "]"] @punctuation.bracket
|
||||
|
||||
[
|
||||
"."
|
||||
","
|
||||
";"
|
||||
"->"
|
||||
] @punctuation.delimiter
|
||||
|
||||
; Comments
|
||||
|
||||
(comment) @comment @spell
|
||||
|
||||
; Errors
|
||||
|
||||
(ERROR) @error
|
||||
38
runtime/queries/capnp/indents.scm
Normal file
38
runtime/queries/capnp/indents.scm
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
[
|
||||
(annotation_targets)
|
||||
(const)
|
||||
(enum)
|
||||
(interface)
|
||||
(implicit_generics)
|
||||
(generics)
|
||||
(group)
|
||||
(method_parameters)
|
||||
(named_return_types)
|
||||
(struct)
|
||||
(union)
|
||||
(field)
|
||||
] @indent.begin
|
||||
|
||||
((struct_shorthand (property)) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
|
||||
((method (field_version)) @indent.align
|
||||
(#set! indent.open_delimiter field_version))
|
||||
|
||||
((const_list (const_value)) @indent.align
|
||||
(#set! indent.open_delimiter "[")
|
||||
(#set! indent.close_delimiter "]"))
|
||||
|
||||
(concatenated_string) @indent.align
|
||||
|
||||
[
|
||||
"}"
|
||||
")"
|
||||
] @indent.end @indent.branch
|
||||
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
(comment)
|
||||
] @indent.auto
|
||||
2
runtime/queries/capnp/injections.scm
Normal file
2
runtime/queries/capnp/injections.scm
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
90
runtime/queries/capnp/locals.scm
Normal file
90
runtime/queries/capnp/locals.scm
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
[
|
||||
(message)
|
||||
(annotation_targets)
|
||||
(const_list)
|
||||
(enum)
|
||||
(interface)
|
||||
(implicit_generics)
|
||||
(generics)
|
||||
(group)
|
||||
(method_parameters)
|
||||
(named_return_types)
|
||||
(struct)
|
||||
(struct_shorthand)
|
||||
(union)
|
||||
] @scope
|
||||
|
||||
[
|
||||
(extend_type)
|
||||
(field_type)
|
||||
] @reference
|
||||
(custom_type (type_identifier) @reference)
|
||||
(custom_type
|
||||
(generics
|
||||
(generic_parameters
|
||||
(generic_identifier) @reference)))
|
||||
|
||||
(annotation_definition_identifier) @definition
|
||||
|
||||
(const_identifier) @definition.constant
|
||||
|
||||
(enum (enum_identifier) @definition.enum)
|
||||
|
||||
[
|
||||
(enum_member)
|
||||
(field_identifier)
|
||||
] @definition.field
|
||||
|
||||
(method_identifier) @definition.method
|
||||
|
||||
(namespace) @definition.namespace
|
||||
|
||||
[
|
||||
(param_identifier)
|
||||
(return_identifier)
|
||||
] @definition.parameter
|
||||
|
||||
(group (type_identifier) @definition.type)
|
||||
|
||||
(struct (type_identifier) @definition.type)
|
||||
|
||||
(union (type_identifier) @definition.type)
|
||||
|
||||
(interface (type_identifier) @definition.type)
|
||||
|
||||
; Generics Related (don't know how to combine these)
|
||||
|
||||
(struct
|
||||
(generics
|
||||
(generic_parameters
|
||||
(generic_identifier) @definition.parameter)))
|
||||
|
||||
(interface
|
||||
(generics
|
||||
(generic_parameters
|
||||
(generic_identifier) @definition.parameter)))
|
||||
|
||||
(method
|
||||
(implicit_generics
|
||||
(implicit_generic_parameters
|
||||
(generic_identifier) @definition.parameter)))
|
||||
|
||||
(method
|
||||
(generics
|
||||
(generic_parameters
|
||||
(generic_identifier) @definition.parameter)))
|
||||
|
||||
(annotation
|
||||
(generics
|
||||
(generic_parameters
|
||||
(generic_identifier) @definition.type)))
|
||||
|
||||
(replace_using
|
||||
(generics
|
||||
(generic_parameters
|
||||
(generic_identifier) @definition.type)))
|
||||
|
||||
(return_type
|
||||
(generics
|
||||
(generic_parameters
|
||||
(generic_identifier) @definition.type)))
|
||||
5
runtime/queries/chatito/folds.scm
Normal file
5
runtime/queries/chatito/folds.scm
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
[
|
||||
(intent_def)
|
||||
(slot_def)
|
||||
(alias_def)
|
||||
] @fold
|
||||
54
runtime/queries/chatito/highlights.scm
Normal file
54
runtime/queries/chatito/highlights.scm
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
;; Punctuation
|
||||
|
||||
[
|
||||
"%["
|
||||
"@["
|
||||
"~["
|
||||
"*["
|
||||
"]"
|
||||
"("
|
||||
")"
|
||||
] @punctuation.bracket
|
||||
|
||||
[":" ","] @punctuation.delimiter
|
||||
|
||||
(["\"" "'"] @punctuation.special @conceal
|
||||
(#set! conceal ""))
|
||||
|
||||
["%" "?" "#"] @character.special
|
||||
|
||||
;; Entities
|
||||
|
||||
(intent) @namespace
|
||||
|
||||
(slot) @type
|
||||
|
||||
(variation) @type.qualifier
|
||||
|
||||
(alias) @property
|
||||
|
||||
(number) @number
|
||||
|
||||
(argument
|
||||
key: (string) @label
|
||||
value: (string) @string)
|
||||
|
||||
(escape) @string.escape
|
||||
|
||||
;; Import
|
||||
|
||||
"import" @include
|
||||
|
||||
(file) @string.special
|
||||
|
||||
;; Text
|
||||
|
||||
(word) @text @spell
|
||||
|
||||
;; Comment
|
||||
|
||||
(comment) @comment @spell
|
||||
|
||||
;; Error
|
||||
|
||||
(ERROR) @error
|
||||
7
runtime/queries/chatito/indents.scm
Normal file
7
runtime/queries/chatito/indents.scm
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
[
|
||||
(intent_def)
|
||||
(slot_def)
|
||||
(alias_def)
|
||||
] @indent.begin
|
||||
|
||||
(ERROR "]") @indent.begin
|
||||
2
runtime/queries/chatito/injections.scm
Normal file
2
runtime/queries/chatito/injections.scm
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
10
runtime/queries/chatito/locals.scm
Normal file
10
runtime/queries/chatito/locals.scm
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
;; Definitions
|
||||
|
||||
(intent_def (intent) @definition)
|
||||
(slot_def (slot) @definition)
|
||||
(alias_def (alias) @definition)
|
||||
|
||||
;; References
|
||||
|
||||
(slot_ref (slot) @reference)
|
||||
(alias_ref (alias) @reference)
|
||||
1
runtime/queries/clojure/folds.scm
Normal file
1
runtime/queries/clojure/folds.scm
Normal file
|
|
@ -0,0 +1 @@
|
|||
(source (list_lit) @fold)
|
||||
381
runtime/queries/clojure/highlights.scm
Normal file
381
runtime/queries/clojure/highlights.scm
Normal file
|
|
@ -0,0 +1,381 @@
|
|||
;; >> Explanation
|
||||
;; Parsers for lisps are a bit weird in that they just return the raw forms.
|
||||
;; This means we have to do a bit of extra work in the queries to get things
|
||||
;; highlighted as they should be.
|
||||
;;
|
||||
;; For the most part this means that some things have to be assigned multiple
|
||||
;; groups.
|
||||
;; By doing this we can add a basic capture and then later refine it with more
|
||||
;; specialized captures.
|
||||
;; This can mean that sometimes things are highlighted weirdly because they
|
||||
;; have multiple highlight groups applied to them.
|
||||
|
||||
|
||||
;; >> Literals
|
||||
|
||||
(
|
||||
(dis_expr) @comment
|
||||
(#set! "priority" 105) ; Higher priority to mark the whole sexpr as a comment
|
||||
)
|
||||
(kwd_lit) @symbol
|
||||
(str_lit) @string
|
||||
(num_lit) @number
|
||||
(char_lit) @character
|
||||
(bool_lit) @boolean
|
||||
(nil_lit) @constant.builtin
|
||||
(comment) @comment @spell
|
||||
(regex_lit) @string.regex
|
||||
|
||||
["'" "`"] @string.escape
|
||||
|
||||
["~" "~@" "#"] @punctuation.special
|
||||
|
||||
["{" "}" "[" "]" "(" ")"] @punctuation.bracket
|
||||
|
||||
|
||||
|
||||
;; >> Symbols
|
||||
|
||||
; General symbol highlighting
|
||||
(sym_lit) @variable
|
||||
|
||||
; General function calls
|
||||
(list_lit
|
||||
.
|
||||
(sym_lit) @function.call)
|
||||
(anon_fn_lit
|
||||
.
|
||||
(sym_lit) @function.call)
|
||||
|
||||
; Quoted symbols
|
||||
(quoting_lit
|
||||
(sym_lit) @symbol)
|
||||
(syn_quoting_lit
|
||||
(sym_lit) @symbol)
|
||||
|
||||
; Used in destructure pattern
|
||||
((sym_lit) @parameter
|
||||
(#lua-match? @parameter "^[&]"))
|
||||
|
||||
; Inline function variables
|
||||
((sym_lit) @variable.builtin
|
||||
(#lua-match? @variable.builtin "^%%"))
|
||||
|
||||
; Constructor
|
||||
((sym_lit) @constructor
|
||||
(#lua-match? @constructor "^-%>[^>].*"))
|
||||
|
||||
; Builtin dynamic variables
|
||||
((sym_lit) @variable.builtin
|
||||
(#any-of? @variable.builtin
|
||||
"*agent*" "*allow-unresolved-vars*" "*assert*"
|
||||
"*clojure-version*" "*command-line-args*"
|
||||
"*compile-files*" "*compile-path*" "*compiler-options*"
|
||||
"*data-readers*" "*default-data-reader-fn*"
|
||||
"*err*" "*file*" "*flush-on-newline*" "*fn-loader*"
|
||||
"*in*" "*math-context*" "*ns*" "*out*"
|
||||
"*print-dup*" "*print-length*" "*print-level*"
|
||||
"*print-meta*" "*print-namespace-maps*" "*print-readably*"
|
||||
"*read-eval*" "*reader-resolver*"
|
||||
"*source-path*" "*suppress-read*"
|
||||
"*unchecked-math*" "*use-context-classloader*"
|
||||
"*verbose-defrecords*" "*warn-on-reflection*"))
|
||||
|
||||
; Builtin repl variables
|
||||
((sym_lit) @variable.builtin
|
||||
(#any-of? @variable.builtin
|
||||
"*1" "*2" "*3" "*e"))
|
||||
|
||||
; Gensym
|
||||
;; Might not be needed
|
||||
((sym_lit) @variable
|
||||
(#lua-match? @variable "^.*#$"))
|
||||
|
||||
; Types
|
||||
;; TODO: improve?
|
||||
((sym_lit) @type
|
||||
(#lua-match? @type "^[%u][^/]*$"))
|
||||
;; Symbols with `.` but not `/`
|
||||
((sym_lit) @type
|
||||
(#lua-match? @type "^[^/]+[.][^/]*$"))
|
||||
|
||||
; Interop
|
||||
; (.instanceMember instance args*)
|
||||
; (.instanceMember Classname args*)
|
||||
((sym_lit) @method
|
||||
(#lua-match? @method "^%.[^-]"))
|
||||
; (.-instanceField instance)
|
||||
((sym_lit) @field
|
||||
(#lua-match? @field "^%.%-.*"))
|
||||
; Classname/staticField
|
||||
((sym_lit) @field
|
||||
(#lua-match? @field "^[%u].*/.+"))
|
||||
; (Classname/staticMethod args*)
|
||||
(list_lit
|
||||
.
|
||||
(sym_lit) @method
|
||||
(#lua-match? @method "^[%u].*/.+"))
|
||||
;; TODO: Special casing for the `.` macro
|
||||
|
||||
; Operators
|
||||
((sym_lit) @operator
|
||||
(#any-of? @operator
|
||||
"*" "*'" "+" "+'" "-" "-'" "/"
|
||||
"<" "<=" ">" ">=" "=" "=="))
|
||||
((sym_lit) @keyword.operator
|
||||
(#any-of? @keyword.operator
|
||||
"not" "not=" "and" "or"))
|
||||
|
||||
; Definition functions
|
||||
((sym_lit) @keyword
|
||||
(#any-of? @keyword
|
||||
"def" "defonce" "defrecord" "defmacro" "definline" "definterface"
|
||||
"defmulti" "defmethod" "defstruct" "defprotocol"
|
||||
"deftype"))
|
||||
((sym_lit) @keyword
|
||||
(#eq? @keyword "declare"))
|
||||
((sym_name) @keyword.coroutine
|
||||
(#any-of? @keyword.coroutine
|
||||
"alts!" "alts!!" "await" "await-for" "await1" "chan" "close!" "future" "go" "sync" "thread" "timeout" "<!" "<!!" ">!" ">!!"))
|
||||
((sym_lit) @keyword.function
|
||||
(#any-of? @keyword.function "defn" "defn-" "fn" "fn*"))
|
||||
|
||||
; Comment
|
||||
((sym_lit) @comment
|
||||
(#any-of? @comment "comment"))
|
||||
|
||||
; Conditionals
|
||||
((sym_lit) @conditional
|
||||
(#any-of? @conditional
|
||||
"case" "cond" "cond->" "cond->>" "condp"))
|
||||
((sym_lit) @conditional
|
||||
(#any-of? @conditional
|
||||
"if" "if-let" "if-not" "if-some"))
|
||||
((sym_lit) @conditional
|
||||
(#any-of? @conditional
|
||||
"when" "when-first" "when-let" "when-not" "when-some"))
|
||||
|
||||
; Repeats
|
||||
((sym_lit) @repeat
|
||||
(#any-of? @repeat
|
||||
"doseq" "dotimes" "for" "loop" "recur" "while"))
|
||||
|
||||
; Exception
|
||||
((sym_lit) @exception
|
||||
(#any-of? @exception
|
||||
"throw" "try" "catch" "finally"))
|
||||
|
||||
; Includes
|
||||
((sym_lit) @include
|
||||
(#any-of? @include "ns" "import" "require" "use"))
|
||||
|
||||
; Builtin macros
|
||||
;; TODO: Do all these items belong here?
|
||||
((sym_lit) @function.macro
|
||||
(#any-of? @function.macro
|
||||
"." ".." "->" "->>" "amap" "areduce" "as->" "assert"
|
||||
"binding" "bound-fn" "delay" "do" "dosync"
|
||||
"doto" "extend-protocol" "extend-type"
|
||||
"gen-class" "gen-interface" "io!" "lazy-cat"
|
||||
"lazy-seq" "let" "letfn" "locking" "memfn" "monitor-enter"
|
||||
"monitor-exit" "proxy" "proxy-super" "pvalues"
|
||||
"refer-clojure" "reify" "set!" "some->" "some->>"
|
||||
"time" "unquote" "unquote-splicing" "var" "vswap!"
|
||||
"with-bindings" "with-in-str" "with-loading-context" "with-local-vars"
|
||||
"with-open" "with-out-str" "with-precision" "with-redefs"))
|
||||
|
||||
; All builtin functions
|
||||
; (->> (ns-publics *ns*)
|
||||
; (keep (fn [[s v]] (when-not (:macro (meta v)) s)))
|
||||
; sort
|
||||
; clojure.pprint/pprint))
|
||||
;; ...and then lots of manual filtering...
|
||||
((sym_lit) @function.builtin
|
||||
(#any-of? @function.builtin
|
||||
"->ArrayChunk" "->Eduction" "->Vec" "->VecNode" "->VecSeq"
|
||||
"-cache-protocol-fn" "-reset-methods" "PrintWriter-on"
|
||||
"StackTraceElement->vec" "Throwable->map" "accessor"
|
||||
"aclone" "add-classpath" "add-tap" "add-watch" "agent"
|
||||
"agent-error" "agent-errors" "aget" "alength" "alias"
|
||||
"all-ns" "alter" "alter-meta!" "alter-var-root" "ancestors"
|
||||
"any?" "apply" "array-map" "aset" "aset-boolean" "aset-byte"
|
||||
"aset-char" "aset-double" "aset-float" "aset-int"
|
||||
"aset-long" "aset-short" "assoc" "assoc!" "assoc-in"
|
||||
"associative?" "atom" "bases" "bean" "bigdec" "bigint" "biginteger"
|
||||
"bit-and" "bit-and-not" "bit-clear" "bit-flip" "bit-not" "bit-or"
|
||||
"bit-set" "bit-shift-left" "bit-shift-right" "bit-test"
|
||||
"bit-xor" "boolean" "boolean-array" "boolean?"
|
||||
"booleans" "bound-fn*" "bound?" "bounded-count"
|
||||
"butlast" "byte" "byte-array" "bytes" "bytes?"
|
||||
"cast" "cat" "char" "char-array" "char-escape-string"
|
||||
"char-name-string" "char?" "chars" "chunk" "chunk-append"
|
||||
"chunk-buffer" "chunk-cons" "chunk-first" "chunk-next"
|
||||
"chunk-rest" "chunked-seq?" "class" "class?"
|
||||
"clear-agent-errors" "clojure-version" "coll?"
|
||||
"commute" "comp" "comparator" "compare" "compare-and-set!"
|
||||
"compile" "complement" "completing" "concat" "conj"
|
||||
"conj!" "cons" "constantly" "construct-proxy" "contains?"
|
||||
"count" "counted?" "create-ns" "create-struct" "cycle"
|
||||
"dec" "dec'" "decimal?" "dedupe" "default-data-readers"
|
||||
"delay?" "deliver" "denominator" "deref" "derive"
|
||||
"descendants" "destructure" "disj" "disj!" "dissoc"
|
||||
"dissoc!" "distinct" "distinct?" "doall" "dorun" "double"
|
||||
"double-array" "eduction" "empty" "empty?" "ensure" "ensure-reduced"
|
||||
"enumeration-seq" "error-handler" "error-mode" "eval"
|
||||
"even?" "every-pred" "every?" "extend" "extenders" "extends?"
|
||||
"false?" "ffirst" "file-seq" "filter" "filterv" "find"
|
||||
"find-keyword" "find-ns" "find-protocol-impl"
|
||||
"find-protocol-method" "find-var" "first" "flatten"
|
||||
"float" "float-array" "float?" "floats" "flush" "fn?"
|
||||
"fnext" "fnil" "force" "format" "frequencies"
|
||||
"future-call" "future-cancel" "future-cancelled?"
|
||||
"future-done?" "future?" "gensym" "get" "get-in"
|
||||
"get-method" "get-proxy-class" "get-thread-bindings"
|
||||
"get-validator" "group-by" "halt-when" "hash"
|
||||
"hash-combine" "hash-map" "hash-ordered-coll" "hash-set"
|
||||
"hash-unordered-coll" "ident?" "identical?" "identity"
|
||||
"ifn?" "in-ns" "inc" "inc'" "indexed?" "init-proxy"
|
||||
"inst-ms" "inst-ms*" "inst?" "instance?" "int" "int-array"
|
||||
"int?" "integer?" "interleave" "intern" "interpose" "into"
|
||||
"into-array" "ints" "isa?" "iterate" "iterator-seq" "juxt"
|
||||
"keep" "keep-indexed" "key" "keys" "keyword" "keyword?"
|
||||
"last" "line-seq" "list" "list*" "list?" "load" "load-file"
|
||||
"load-reader" "load-string" "loaded-libs" "long" "long-array"
|
||||
"longs" "macroexpand" "macroexpand-1" "make-array" "make-hierarchy"
|
||||
"map" "map-entry?" "map-indexed" "map?" "mapcat" "mapv"
|
||||
"max" "max-key" "memoize" "merge" "merge-with" "meta"
|
||||
"method-sig" "methods" "min" "min-key" "mix-collection-hash"
|
||||
"mod" "munge" "name" "namespace" "namespace-munge" "nat-int?"
|
||||
"neg-int?" "neg?" "newline" "next" "nfirst" "nil?" "nnext"
|
||||
"not-any?" "not-empty" "not-every?" "ns-aliases"
|
||||
"ns-imports" "ns-interns" "ns-map" "ns-name" "ns-publics"
|
||||
"ns-refers" "ns-resolve" "ns-unalias" "ns-unmap" "nth"
|
||||
"nthnext" "nthrest" "num" "number?" "numerator" "object-array"
|
||||
"odd?" "parents" "partial" "partition" "partition-all"
|
||||
"partition-by" "pcalls" "peek" "persistent!" "pmap" "pop"
|
||||
"pop!" "pop-thread-bindings" "pos-int?" "pos?" "pr"
|
||||
"pr-str" "prefer-method" "prefers" "primitives-classnames"
|
||||
"print" "print-ctor" "print-dup" "print-method" "print-simple"
|
||||
"print-str" "printf" "println" "println-str" "prn" "prn-str"
|
||||
"promise" "proxy-call-with-super" "proxy-mappings" "proxy-name"
|
||||
"push-thread-bindings" "qualified-ident?" "qualified-keyword?"
|
||||
"qualified-symbol?" "quot" "rand" "rand-int" "rand-nth" "random-sample"
|
||||
"range" "ratio?" "rational?" "rationalize" "re-find" "re-groups"
|
||||
"re-matcher" "re-matches" "re-pattern" "re-seq" "read"
|
||||
"read+string" "read-line" "read-string" "reader-conditional"
|
||||
"reader-conditional?" "realized?" "record?" "reduce"
|
||||
"reduce-kv" "reduced" "reduced?" "reductions" "ref" "ref-history-count"
|
||||
"ref-max-history" "ref-min-history" "ref-set" "refer"
|
||||
"release-pending-sends" "rem" "remove" "remove-all-methods"
|
||||
"remove-method" "remove-ns" "remove-tap" "remove-watch"
|
||||
"repeat" "repeatedly" "replace" "replicate"
|
||||
"requiring-resolve" "reset!" "reset-meta!" "reset-vals!"
|
||||
"resolve" "rest" "restart-agent" "resultset-seq" "reverse"
|
||||
"reversible?" "rseq" "rsubseq" "run!" "satisfies?"
|
||||
"second" "select-keys" "send" "send-off" "send-via"
|
||||
"seq" "seq?" "seqable?" "seque" "sequence" "sequential?"
|
||||
"set" "set-agent-send-executor!" "set-agent-send-off-executor!"
|
||||
"set-error-handler!" "set-error-mode!" "set-validator!"
|
||||
"set?" "short" "short-array" "shorts" "shuffle"
|
||||
"shutdown-agents" "simple-ident?" "simple-keyword?"
|
||||
"simple-symbol?" "slurp" "some" "some-fn" "some?"
|
||||
"sort" "sort-by" "sorted-map" "sorted-map-by"
|
||||
"sorted-set" "sorted-set-by" "sorted?" "special-symbol?"
|
||||
"spit" "split-at" "split-with" "str" "string?"
|
||||
"struct" "struct-map" "subs" "subseq" "subvec" "supers"
|
||||
"swap!" "swap-vals!" "symbol" "symbol?" "tagged-literal"
|
||||
"tagged-literal?" "take" "take-last" "take-nth" "take-while"
|
||||
"tap>" "test" "the-ns" "thread-bound?" "to-array"
|
||||
"to-array-2d" "trampoline" "transduce" "transient"
|
||||
"tree-seq" "true?" "type" "unchecked-add" "unchecked-add-int"
|
||||
"unchecked-byte" "unchecked-char" "unchecked-dec"
|
||||
"unchecked-dec-int" "unchecked-divide-int" "unchecked-double"
|
||||
"unchecked-float" "unchecked-inc" "unchecked-inc-int"
|
||||
"unchecked-int" "unchecked-long" "unchecked-multiply"
|
||||
"unchecked-multiply-int" "unchecked-negate" "unchecked-negate-int"
|
||||
"unchecked-remainder-int" "unchecked-short" "unchecked-subtract"
|
||||
"unchecked-subtract-int" "underive" "unquote"
|
||||
"unquote-splicing" "unreduced" "unsigned-bit-shift-right"
|
||||
"update" "update-in" "update-proxy" "uri?" "uuid?"
|
||||
"val" "vals" "var-get" "var-set" "var?" "vary-meta" "vec"
|
||||
"vector" "vector-of" "vector?" "volatile!" "volatile?"
|
||||
"vreset!" "with-bindings*" "with-meta" "with-redefs-fn" "xml-seq"
|
||||
"zero?" "zipmap"
|
||||
;; earlier
|
||||
"drop" "drop-last" "drop-while"
|
||||
"double?" "doubles"
|
||||
"ex-data" "ex-info"
|
||||
;; 1.10
|
||||
"ex-cause" "ex-message"
|
||||
;; 1.11
|
||||
"NaN?" "abs" "infinite?" "iteration" "random-uuid"
|
||||
"parse-boolean" "parse-double" "parse-long" "parse-uuid"
|
||||
"seq-to-map-for-destructuring" "update-keys" "update-vals"
|
||||
;; 1.12
|
||||
"partitionv" "partitionv-all" "splitv-at"))
|
||||
|
||||
|
||||
|
||||
;; >> Context based highlighting
|
||||
|
||||
;; def-likes
|
||||
;; Correctly highlight docstrings
|
||||
;(list_lit
|
||||
;.
|
||||
;(sym_lit) @_keyword ; Don't really want to highlight twice
|
||||
;(#any-of? @_keyword
|
||||
;"def" "defonce" "defrecord" "defmacro" "definline"
|
||||
;"defmulti" "defmethod" "defstruct" "defprotocol"
|
||||
;"deftype")
|
||||
;.
|
||||
;(sym_lit)
|
||||
;.
|
||||
;;; TODO: Add @comment highlight
|
||||
;(str_lit)?
|
||||
;.
|
||||
;(_))
|
||||
|
||||
; Function definitions
|
||||
(list_lit
|
||||
.
|
||||
(sym_lit) @_keyword.function
|
||||
(#any-of? @_keyword.function "fn" "fn*" "defn" "defn-")
|
||||
.
|
||||
(sym_lit)? @function
|
||||
.
|
||||
;; TODO: Add @comment highlight
|
||||
(str_lit)?)
|
||||
;; TODO: Fix parameter highlighting
|
||||
;; I think there's a bug here in nvim-treesitter
|
||||
;; TODO: Reproduce bug and file ticket
|
||||
;.
|
||||
;[(vec_lit
|
||||
; (sym_lit)* @parameter)
|
||||
; (list_lit
|
||||
; (vec_lit
|
||||
; (sym_lit)* @parameter))])
|
||||
|
||||
;[((list_lit
|
||||
; (vec_lit
|
||||
; (sym_lit) @parameter)
|
||||
; (_)
|
||||
; +
|
||||
; ((vec_lit
|
||||
; (sym_lit) @parameter)
|
||||
; (_)))
|
||||
|
||||
|
||||
; Meta punctuation
|
||||
;; NOTE: When the above `Function definitions` query captures the
|
||||
;; the @function it also captures the child meta_lit
|
||||
;; We capture the meta_lit symbol (^) after so that the later
|
||||
;; highlighting overrides the former
|
||||
"^" @punctuation.special
|
||||
|
||||
;; namespaces
|
||||
(list_lit
|
||||
.
|
||||
(sym_lit) @_include
|
||||
(#eq? @_include "ns")
|
||||
.
|
||||
(sym_lit) @namespace)
|
||||
2
runtime/queries/clojure/injections.scm
Normal file
2
runtime/queries/clojure/injections.scm
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
1
runtime/queries/clojure/locals.scm
Normal file
1
runtime/queries/clojure/locals.scm
Normal file
|
|
@ -0,0 +1 @@
|
|||
; placeholder file to get incremental selection to work
|
||||
8
runtime/queries/cmake/folds.scm
Normal file
8
runtime/queries/cmake/folds.scm
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
[
|
||||
(if_condition)
|
||||
(foreach_loop)
|
||||
(while_loop)
|
||||
(function_def)
|
||||
(macro_def)
|
||||
(block_def)
|
||||
] @fold
|
||||
217
runtime/queries/cmake/highlights.scm
Normal file
217
runtime/queries/cmake/highlights.scm
Normal file
|
|
@ -0,0 +1,217 @@
|
|||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument (unquoted_argument)) @constant
|
||||
)
|
||||
(#lua-match? @constant "^[%u@][%u%d_]+$")
|
||||
)
|
||||
|
||||
[
|
||||
(quoted_argument)
|
||||
(bracket_argument)
|
||||
] @string
|
||||
|
||||
(variable_ref) @none
|
||||
(variable) @variable
|
||||
|
||||
[
|
||||
(bracket_comment)
|
||||
(line_comment)
|
||||
] @comment @spell
|
||||
|
||||
(normal_command (identifier) @function)
|
||||
|
||||
["ENV" "CACHE"] @storageclass
|
||||
["$" "{" "}" "<" ">"] @punctuation.special
|
||||
["(" ")"] @punctuation.bracket
|
||||
|
||||
[
|
||||
(function)
|
||||
(endfunction)
|
||||
(macro)
|
||||
(endmacro)
|
||||
] @keyword.function
|
||||
|
||||
[
|
||||
(if)
|
||||
(elseif)
|
||||
(else)
|
||||
(endif)
|
||||
] @conditional
|
||||
|
||||
[
|
||||
(foreach)
|
||||
(endforeach)
|
||||
(while)
|
||||
(endwhile)
|
||||
] @repeat
|
||||
|
||||
(normal_command
|
||||
(identifier) @repeat
|
||||
(#match? @repeat "\\c^(continue|break)$")
|
||||
)
|
||||
(normal_command
|
||||
(identifier) @keyword.return
|
||||
(#match? @keyword.return "\\c^return$")
|
||||
)
|
||||
|
||||
(function_command
|
||||
(function)
|
||||
(argument_list
|
||||
. (argument) @function
|
||||
(argument)* @parameter
|
||||
)
|
||||
)
|
||||
|
||||
(macro_command
|
||||
(macro)
|
||||
(argument_list
|
||||
. (argument) @function.macro
|
||||
(argument)* @parameter
|
||||
)
|
||||
)
|
||||
|
||||
(block_def
|
||||
(block_command
|
||||
(block) @function.builtin
|
||||
(argument_list
|
||||
(argument (unquoted_argument) @constant)
|
||||
)
|
||||
(#any-of? @constant "SCOPE_FOR" "POLICIES" "VARIABLES" "PROPAGATE")
|
||||
)
|
||||
(endblock_command (endblock) @function.builtin)
|
||||
)
|
||||
;
|
||||
((argument) @boolean
|
||||
(#match? @boolean "\\c^(1|on|yes|true|y|0|off|no|false|n|ignore|notfound|.*-notfound)$")
|
||||
)
|
||||
;
|
||||
(if_command
|
||||
(if)
|
||||
(argument_list
|
||||
(argument) @keyword.operator
|
||||
)
|
||||
(#any-of? @keyword.operator "NOT" "AND" "OR"
|
||||
"COMMAND" "POLICY" "TARGET" "TEST" "DEFINED" "IN_LIST"
|
||||
"EXISTS" "IS_NEWER_THAN" "IS_DIRECTORY" "IS_SYMLINK" "IS_ABSOLUTE"
|
||||
"MATCHES"
|
||||
"LESS" "GREATER" "EQUAL" "LESS_EQUAL" "GREATER_EQUAL"
|
||||
"STRLESS" "STRGREATER" "STREQUAL" "STRLESS_EQUAL" "STRGREATER_EQUAL"
|
||||
"VERSION_LESS" "VERSION_GREATER" "VERSION_EQUAL" "VERSION_LESS_EQUAL" "VERSION_GREATER_EQUAL"
|
||||
)
|
||||
)
|
||||
(elseif_command
|
||||
(elseif)
|
||||
(argument_list
|
||||
(argument) @keyword.operator
|
||||
)
|
||||
(#any-of? @keyword.operator "NOT" "AND" "OR"
|
||||
"COMMAND" "POLICY" "TARGET" "TEST" "DEFINED" "IN_LIST"
|
||||
"EXISTS" "IS_NEWER_THAN" "IS_DIRECTORY" "IS_SYMLINK" "IS_ABSOLUTE"
|
||||
"MATCHES"
|
||||
"LESS" "GREATER" "EQUAL" "LESS_EQUAL" "GREATER_EQUAL"
|
||||
"STRLESS" "STRGREATER" "STREQUAL" "STRLESS_EQUAL" "STRGREATER_EQUAL"
|
||||
"VERSION_LESS" "VERSION_GREATER" "VERSION_EQUAL" "VERSION_LESS_EQUAL" "VERSION_GREATER_EQUAL"
|
||||
)
|
||||
)
|
||||
|
||||
(normal_command
|
||||
(identifier) @function.builtin
|
||||
(#match? @function.builtin "\\c^(cmake_host_system_information|cmake_language|cmake_minimum_required|cmake_parse_arguments|cmake_path|cmake_policy|configure_file|execute_process|file|find_file|find_library|find_package|find_path|find_program|foreach|get_cmake_property|get_directory_property|get_filename_component|get_property|include|include_guard|list|macro|mark_as_advanced|math|message|option|separate_arguments|set|set_directory_properties|set_property|site_name|string|unset|variable_watch|add_compile_definitions|add_compile_options|add_custom_command|add_custom_target|add_definitions|add_dependencies|add_executable|add_library|add_link_options|add_subdirectory|add_test|aux_source_directory|build_command|create_test_sourcelist|define_property|enable_language|enable_testing|export|fltk_wrap_ui|get_source_file_property|get_target_property|get_test_property|include_directories|include_external_msproject|include_regular_expression|install|link_directories|link_libraries|load_cache|project|remove_definitions|set_source_files_properties|set_target_properties|set_tests_properties|source_group|target_compile_definitions|target_compile_features|target_compile_options|target_include_directories|target_link_directories|target_link_libraries|target_link_options|target_precompile_headers|target_sources|try_compile|try_run|ctest_build|ctest_configure|ctest_coverage|ctest_empty_binary_directory|ctest_memcheck|ctest_read_custom_files|ctest_run_script|ctest_sleep|ctest_start|ctest_submit|ctest_test|ctest_update|ctest_upload)$")
|
||||
)
|
||||
|
||||
(normal_command
|
||||
(identifier) @_function
|
||||
(argument_list
|
||||
. (argument) @variable
|
||||
)
|
||||
(#match? @_function "\\c^set$")
|
||||
)
|
||||
|
||||
(normal_command
|
||||
(identifier) @_function
|
||||
(#match? @_function "\\c^set$")
|
||||
(argument_list
|
||||
. (argument)
|
||||
(
|
||||
(argument) @_cache @storageclass
|
||||
.
|
||||
(argument) @_type @type
|
||||
(#any-of? @_cache "CACHE")
|
||||
(#any-of? @_type "BOOL" "FILEPATH" "PATH" "STRING" "INTERNAL")
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(normal_command
|
||||
(identifier) @_function
|
||||
(#match? @_function "\\c^unset$")
|
||||
(argument_list
|
||||
. (argument)
|
||||
(argument) @storageclass
|
||||
(#any-of? @storageclass "CACHE" "PARENT_SCOPE")
|
||||
)
|
||||
)
|
||||
|
||||
(normal_command
|
||||
(identifier) @_function
|
||||
(#match? @_function "\\c^list$")
|
||||
(argument_list
|
||||
. (argument) @constant
|
||||
(#any-of? @constant "LENGTH" "GET" "JOIN" "SUBLIST" "FIND")
|
||||
. (argument) @variable
|
||||
(argument) @variable .
|
||||
)
|
||||
)
|
||||
(normal_command
|
||||
(identifier) @_function
|
||||
(#match? @_function "\\c^list$")
|
||||
(argument_list
|
||||
. (argument) @constant
|
||||
. (argument) @variable
|
||||
(#any-of? @constant "APPEND" "FILTER" "INSERT"
|
||||
"POP_BACK" "POP_FRONT" "PREPEND"
|
||||
"REMOVE_ITEM" "REMOVE_AT" "REMOVE_DUPLICATES"
|
||||
"REVERSE" "SORT")
|
||||
)
|
||||
)
|
||||
(normal_command
|
||||
(identifier) @_function
|
||||
(#match? @_function "\\c^list$")
|
||||
(argument_list
|
||||
. (argument) @_transform @constant
|
||||
. (argument) @variable
|
||||
. (argument) @_action @constant
|
||||
(#eq? @_transform "TRANSFORM")
|
||||
(#any-of? @_action "APPEND" "PREPEND" "TOUPPER" "TOLOWER" "STRIP" "GENEX_STRIP" "REPLACE")
|
||||
)
|
||||
)
|
||||
(normal_command
|
||||
(identifier) @_function
|
||||
(#match? @_function "\\c^list$")
|
||||
(argument_list
|
||||
. (argument) @_transform @constant
|
||||
. (argument) @variable
|
||||
. (argument) @_action @constant
|
||||
. (argument)? @_selector @constant
|
||||
(#eq? @_transform "TRANSFORM")
|
||||
(#any-of? @_action "APPEND" "PREPEND" "TOUPPER" "TOLOWER" "STRIP" "GENEX_STRIP" "REPLACE")
|
||||
(#any-of? @_selector "AT" "FOR" "REGEX")
|
||||
)
|
||||
)
|
||||
(normal_command
|
||||
(identifier) @_function
|
||||
(#match? @_function "\\c^list$")
|
||||
(argument_list
|
||||
. (argument) @_transform @constant
|
||||
(argument) @constant .
|
||||
(argument) @variable
|
||||
(#eq? @_transform "TRANSFORM")
|
||||
(#eq? @constant "OUTPUT_VARIABLE")
|
||||
)
|
||||
)
|
||||
|
||||
(escape_sequence) @string.escape
|
||||
|
||||
((source_file . (line_comment) @preproc)
|
||||
(#lua-match? @preproc "^#!/"))
|
||||
25
runtime/queries/cmake/indents.scm
Normal file
25
runtime/queries/cmake/indents.scm
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
[
|
||||
(normal_command)
|
||||
(if_condition)
|
||||
(foreach_loop)
|
||||
(while_loop)
|
||||
(function_def)
|
||||
(macro_def)
|
||||
(block_def)
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
(elseif_command)
|
||||
(else_command)
|
||||
(endif_command)
|
||||
(endforeach_command)
|
||||
(endwhile_command)
|
||||
(endfunction_command)
|
||||
(endmacro_command)
|
||||
(endblock_command)
|
||||
] @indent.branch
|
||||
|
||||
(")" @indent.branch)
|
||||
(")" @indent.end)
|
||||
|
||||
(argument_list) @indent.auto
|
||||
44
runtime/queries/comment/highlights.scm
Normal file
44
runtime/queries/comment/highlights.scm
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
; TODO(clason): use @comment.{error,warning,hint,info,ok} -- cf. Helix
|
||||
(_) @spell
|
||||
|
||||
((tag
|
||||
(name) @text.todo @nospell
|
||||
("(" @punctuation.bracket (user) @constant ")" @punctuation.bracket)?
|
||||
":" @punctuation.delimiter)
|
||||
(#any-of? @text.todo "TODO" "WIP"))
|
||||
|
||||
("text" @text.todo @nospell
|
||||
(#any-of? @text.todo "TODO" "WIP"))
|
||||
|
||||
((tag
|
||||
(name) @text.note @nospell
|
||||
("(" @punctuation.bracket (user) @constant ")" @punctuation.bracket)?
|
||||
":" @punctuation.delimiter)
|
||||
(#any-of? @text.note "NOTE" "XXX" "INFO" "DOCS" "PERF" "TEST"))
|
||||
|
||||
("text" @text.note @nospell
|
||||
(#any-of? @text.note "NOTE" "XXX" "INFO" "DOCS" "PERF" "TEST"))
|
||||
|
||||
((tag
|
||||
(name) @text.warning @nospell
|
||||
("(" @punctuation.bracket (user) @constant ")" @punctuation.bracket)?
|
||||
":" @punctuation.delimiter)
|
||||
(#any-of? @text.warning "HACK" "WARNING" "WARN" "FIX"))
|
||||
|
||||
("text" @text.warning @nospell
|
||||
(#any-of? @text.warning "HACK" "WARNING" "WARN" "FIX"))
|
||||
|
||||
((tag
|
||||
(name) @text.danger @nospell
|
||||
("(" @punctuation.bracket (user) @constant ")" @punctuation.bracket)?
|
||||
":" @punctuation.delimiter)
|
||||
(#any-of? @text.danger "FIXME" "BUG" "ERROR"))
|
||||
|
||||
("text" @text.danger @nospell
|
||||
(#any-of? @text.danger "FIXME" "BUG" "ERROR"))
|
||||
|
||||
; Issue number (#123)
|
||||
("text" @number
|
||||
(#lua-match? @number "^#[0-9]+$"))
|
||||
|
||||
((uri) @text.uri @nospell)
|
||||
1
runtime/queries/commonlisp/folds.scm
Normal file
1
runtime/queries/commonlisp/folds.scm
Normal file
|
|
@ -0,0 +1 @@
|
|||
(source (list_lit) @fold)
|
||||
145
runtime/queries/commonlisp/highlights.scm
Normal file
145
runtime/queries/commonlisp/highlights.scm
Normal file
File diff suppressed because one or more lines are too long
72
runtime/queries/commonlisp/locals.scm
Normal file
72
runtime/queries/commonlisp/locals.scm
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
|
||||
(defun_header
|
||||
function_name: (sym_lit) @definition.function (#set! definition.function.scope "parent"))
|
||||
(defun_header
|
||||
lambda_list: (list_lit (sym_lit) @definition.parameter))
|
||||
|
||||
(defun_header
|
||||
keyword: (defun_keyword "defmethod")
|
||||
lambda_list: (list_lit (list_lit . (sym_lit) . (sym_lit) @definition.type)))
|
||||
(defun_header
|
||||
lambda_list: (list_lit (list_lit . (sym_lit) @definition.parameter . (_))))
|
||||
|
||||
(sym_lit) @reference
|
||||
|
||||
(defun) @scope
|
||||
|
||||
((list_lit . (sym_lit) @_defvar . (sym_lit) @definition.var)
|
||||
(#match? @_defvar "^(cl:)?(defvar|defparameter)$"))
|
||||
|
||||
(list_lit
|
||||
.
|
||||
(sym_lit) @_deftest
|
||||
.
|
||||
(sym_lit) @definition.function
|
||||
(#eq? @_deftest "deftest")) @scope
|
||||
|
||||
(list_lit
|
||||
.
|
||||
(sym_lit) @_deftest
|
||||
.
|
||||
(sym_lit) @definition.function
|
||||
(#eq? @_deftest "deftest")) @scope
|
||||
|
||||
(for_clause . (sym_lit) @definition.var)
|
||||
(with_clause . (sym_lit) @definition.var)
|
||||
(loop_macro) @scope
|
||||
|
||||
(list_lit
|
||||
.
|
||||
(sym_lit) @_let (#match? @_let "(cl:|cffi:)?(with-accessors|with-foreign-objects|let[*]?)")
|
||||
.
|
||||
(list_lit (list_lit . (sym_lit) @definition.var))) @scope
|
||||
|
||||
(list_lit
|
||||
.
|
||||
(sym_lit) @_let (#match? @_let "(cl:|alexandria:)?(with-gensyms|dotimes|with-foreign-object)")
|
||||
.
|
||||
(list_lit . (sym_lit) @definition.var)) @scope
|
||||
|
||||
(list_lit
|
||||
.
|
||||
(kwd_lit) @_import_from (#eq? @_import_from ":import-from")
|
||||
.
|
||||
(_)
|
||||
(kwd_lit (kwd_symbol) @definition.import))
|
||||
|
||||
(list_lit
|
||||
.
|
||||
(kwd_lit) @_import_from (#eq? @_import_from ":import-from")
|
||||
.
|
||||
(_)
|
||||
(sym_lit) @definition.import)
|
||||
|
||||
(list_lit
|
||||
.
|
||||
(kwd_lit) @_use (#eq? @_use ":use")
|
||||
(kwd_lit (kwd_symbol) @definition.import))
|
||||
|
||||
(list_lit
|
||||
.
|
||||
(kwd_lit) @_use (#eq? @_use ":use")
|
||||
(sym_lit) @definition.import)
|
||||
22
runtime/queries/cooklang/highlights.scm
Normal file
22
runtime/queries/cooklang/highlights.scm
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
(metadata) @comment
|
||||
|
||||
(ingredient
|
||||
"@" @tag
|
||||
(name)? @text.title
|
||||
(amount
|
||||
(quantity)? @number
|
||||
(units)? @tag.attribute)?)
|
||||
|
||||
(timer
|
||||
"~" @tag
|
||||
(name)? @text.title
|
||||
(amount
|
||||
(quantity)? @number
|
||||
(units)? @tag.attribute)?)
|
||||
|
||||
(cookware
|
||||
"#" @tag
|
||||
(name)? @text.title
|
||||
(amount
|
||||
(quantity)? @number
|
||||
(units)? @tag.attribute)?)
|
||||
5
runtime/queries/corn/folds.scm
Normal file
5
runtime/queries/corn/folds.scm
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
[
|
||||
(object)
|
||||
(array)
|
||||
(assign_block)
|
||||
] @fold
|
||||
22
runtime/queries/corn/highlights.scm
Normal file
22
runtime/queries/corn/highlights.scm
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
"let" @keyword
|
||||
"in" @keyword
|
||||
|
||||
[
|
||||
"{"
|
||||
"}"
|
||||
"["
|
||||
"]"
|
||||
] @punctuation.bracket
|
||||
|
||||
"." @punctuation.delimiter
|
||||
|
||||
(input) @constant
|
||||
(comment) @comment
|
||||
|
||||
(string) @string
|
||||
(integer) @number
|
||||
(float) @float
|
||||
(boolean) @boolean
|
||||
(null) @keyword
|
||||
|
||||
(ERROR) @error
|
||||
14
runtime/queries/corn/indents.scm
Normal file
14
runtime/queries/corn/indents.scm
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
[
|
||||
(assign_block "{")
|
||||
(object)
|
||||
(array)
|
||||
] @indent.begin
|
||||
|
||||
(assign_block "}" @indent.branch)
|
||||
(assign_block "}" @indent.end)
|
||||
|
||||
(object "}" @indent.branch)
|
||||
(object "}" @indent.end)
|
||||
|
||||
(array "]" @indent.branch)
|
||||
(array "]" @indent.end)
|
||||
16
runtime/queries/corn/locals.scm
Normal file
16
runtime/queries/corn/locals.scm
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
; scopes
|
||||
|
||||
[
|
||||
(object)
|
||||
(array)
|
||||
] @scope
|
||||
|
||||
; definitions
|
||||
|
||||
(assign_block
|
||||
(assignment
|
||||
(input)
|
||||
@definition.constant))
|
||||
|
||||
(value (input) @reference)
|
||||
|
||||
5
runtime/queries/cpon/folds.scm
Normal file
5
runtime/queries/cpon/folds.scm
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
[
|
||||
(meta_map)
|
||||
(map)
|
||||
(array)
|
||||
] @fold
|
||||
50
runtime/queries/cpon/highlights.scm
Normal file
50
runtime/queries/cpon/highlights.scm
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
; Literals
|
||||
|
||||
(string) @string
|
||||
(escape_sequence) @string.escape
|
||||
|
||||
(hex_blob
|
||||
"x" @character.special
|
||||
(_) @string)
|
||||
|
||||
(esc_blob
|
||||
"b" @character.special
|
||||
(_) @string)
|
||||
|
||||
(datetime
|
||||
"d" @character.special
|
||||
(_) @string.special)
|
||||
|
||||
(_ key: (_) @label)
|
||||
|
||||
(number) @number
|
||||
|
||||
(float) @float
|
||||
|
||||
(boolean) @boolean
|
||||
|
||||
(null) @constant.builtin
|
||||
|
||||
; Punctuation
|
||||
|
||||
[
|
||||
","
|
||||
":"
|
||||
] @punctuation.delimiter
|
||||
|
||||
[ "{" "}" ] @punctuation.bracket
|
||||
|
||||
[ "[" "]" ] @punctuation.bracket
|
||||
|
||||
[ "<" ">" ] @punctuation.bracket
|
||||
|
||||
(("\"" @conceal)
|
||||
(#set! conceal ""))
|
||||
|
||||
; Comments
|
||||
|
||||
(comment) @comment @spell
|
||||
|
||||
; Errors
|
||||
|
||||
(ERROR) @error
|
||||
17
runtime/queries/cpon/indents.scm
Normal file
17
runtime/queries/cpon/indents.scm
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
[
|
||||
(meta_map)
|
||||
(map)
|
||||
(imap)
|
||||
(array)
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
"]"
|
||||
"}"
|
||||
">"
|
||||
] @indent.end @indent.branch
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
(comment)
|
||||
] @indent.auto
|
||||
2
runtime/queries/cpon/injections.scm
Normal file
2
runtime/queries/cpon/injections.scm
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
7
runtime/queries/cpon/locals.scm
Normal file
7
runtime/queries/cpon/locals.scm
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
[
|
||||
(document)
|
||||
|
||||
(meta_map)
|
||||
(map)
|
||||
(array)
|
||||
] @scope
|
||||
14
runtime/queries/cpp/folds.scm
Normal file
14
runtime/queries/cpp/folds.scm
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
; inherits: c
|
||||
|
||||
[
|
||||
(for_range_loop)
|
||||
(class_specifier)
|
||||
(field_declaration
|
||||
type: (enum_specifier)
|
||||
default_value: (initializer_list))
|
||||
(template_declaration)
|
||||
(namespace_definition)
|
||||
(try_statement)
|
||||
(catch_clause)
|
||||
(lambda_expression)
|
||||
] @fold
|
||||
240
runtime/queries/cpp/highlights.scm
Normal file
240
runtime/queries/cpp/highlights.scm
Normal file
|
|
@ -0,0 +1,240 @@
|
|||
; inherits: c
|
||||
|
||||
((identifier) @field
|
||||
(#lua-match? @field "^m?_.*$"))
|
||||
|
||||
(parameter_declaration
|
||||
declarator: (reference_declarator) @parameter)
|
||||
|
||||
; function(Foo ...foo)
|
||||
(variadic_parameter_declaration
|
||||
declarator: (variadic_declarator
|
||||
(_) @parameter))
|
||||
; int foo = 0
|
||||
(optional_parameter_declaration
|
||||
declarator: (_) @parameter)
|
||||
|
||||
;(field_expression) @parameter ;; How to highlight this?
|
||||
|
||||
(((field_expression
|
||||
(field_identifier) @method)) @_parent
|
||||
(#has-parent? @_parent template_method function_declarator))
|
||||
|
||||
(field_declaration
|
||||
(field_identifier) @field)
|
||||
|
||||
(field_initializer
|
||||
(field_identifier) @property)
|
||||
|
||||
(function_declarator
|
||||
declarator: (field_identifier) @method)
|
||||
|
||||
(concept_definition
|
||||
name: (identifier) @type.definition)
|
||||
|
||||
(alias_declaration
|
||||
name: (type_identifier) @type.definition)
|
||||
|
||||
(auto) @type.builtin
|
||||
|
||||
(namespace_identifier) @namespace
|
||||
((namespace_identifier) @type
|
||||
(#lua-match? @type "^[%u]"))
|
||||
|
||||
(case_statement
|
||||
value: (qualified_identifier (identifier) @constant))
|
||||
|
||||
(using_declaration . "using" . "namespace" . [(qualified_identifier) (identifier)] @namespace)
|
||||
|
||||
(destructor_name
|
||||
(identifier) @method)
|
||||
|
||||
; functions
|
||||
(function_declarator
|
||||
(qualified_identifier
|
||||
(identifier) @function))
|
||||
(function_declarator
|
||||
(qualified_identifier
|
||||
(qualified_identifier
|
||||
(identifier) @function)))
|
||||
(function_declarator
|
||||
(qualified_identifier
|
||||
(qualified_identifier
|
||||
(qualified_identifier
|
||||
(identifier) @function))))
|
||||
((qualified_identifier
|
||||
(qualified_identifier
|
||||
(qualified_identifier
|
||||
(qualified_identifier
|
||||
(identifier) @function)))) @_parent
|
||||
(#has-ancestor? @_parent function_declarator))
|
||||
|
||||
(function_declarator
|
||||
(template_function
|
||||
(identifier) @function))
|
||||
|
||||
(operator_name) @function
|
||||
"operator" @function
|
||||
"static_assert" @function.builtin
|
||||
|
||||
(call_expression
|
||||
(qualified_identifier
|
||||
(identifier) @function.call))
|
||||
(call_expression
|
||||
(qualified_identifier
|
||||
(qualified_identifier
|
||||
(identifier) @function.call)))
|
||||
(call_expression
|
||||
(qualified_identifier
|
||||
(qualified_identifier
|
||||
(qualified_identifier
|
||||
(identifier) @function.call))))
|
||||
((qualified_identifier
|
||||
(qualified_identifier
|
||||
(qualified_identifier
|
||||
(qualified_identifier
|
||||
(identifier) @function.call)))) @_parent
|
||||
(#has-ancestor? @_parent call_expression))
|
||||
|
||||
(call_expression
|
||||
(template_function
|
||||
(identifier) @function.call))
|
||||
(call_expression
|
||||
(qualified_identifier
|
||||
(template_function
|
||||
(identifier) @function.call)))
|
||||
(call_expression
|
||||
(qualified_identifier
|
||||
(qualified_identifier
|
||||
(template_function
|
||||
(identifier) @function.call))))
|
||||
(call_expression
|
||||
(qualified_identifier
|
||||
(qualified_identifier
|
||||
(qualified_identifier
|
||||
(template_function
|
||||
(identifier) @function.call)))))
|
||||
((qualified_identifier
|
||||
(qualified_identifier
|
||||
(qualified_identifier
|
||||
(qualified_identifier
|
||||
(template_function
|
||||
(identifier) @function.call))))) @_parent
|
||||
(#has-ancestor? @_parent call_expression))
|
||||
|
||||
; methods
|
||||
(function_declarator
|
||||
(template_method
|
||||
(field_identifier) @method))
|
||||
(call_expression
|
||||
(field_expression
|
||||
(field_identifier) @method.call))
|
||||
|
||||
; constructors
|
||||
|
||||
((function_declarator
|
||||
(qualified_identifier
|
||||
(identifier) @constructor))
|
||||
(#lua-match? @constructor "^%u"))
|
||||
|
||||
((call_expression
|
||||
function: (identifier) @constructor)
|
||||
(#lua-match? @constructor "^%u"))
|
||||
((call_expression
|
||||
function: (qualified_identifier
|
||||
name: (identifier) @constructor))
|
||||
(#lua-match? @constructor "^%u"))
|
||||
|
||||
((call_expression
|
||||
function: (field_expression
|
||||
field: (field_identifier) @constructor))
|
||||
(#lua-match? @constructor "^%u"))
|
||||
|
||||
;; constructing a type in an initializer list: Constructor (): **SuperType (1)**
|
||||
((field_initializer
|
||||
(field_identifier) @constructor
|
||||
(argument_list))
|
||||
(#lua-match? @constructor "^%u"))
|
||||
|
||||
|
||||
; Constants
|
||||
|
||||
(this) @variable.builtin
|
||||
(null "nullptr" @constant.builtin)
|
||||
|
||||
(true) @boolean
|
||||
(false) @boolean
|
||||
|
||||
; Literals
|
||||
|
||||
(raw_string_literal) @string
|
||||
|
||||
; Keywords
|
||||
|
||||
[
|
||||
"try"
|
||||
"catch"
|
||||
"noexcept"
|
||||
"throw"
|
||||
] @exception
|
||||
|
||||
|
||||
[
|
||||
"class"
|
||||
"decltype"
|
||||
"explicit"
|
||||
"friend"
|
||||
"namespace"
|
||||
"override"
|
||||
"template"
|
||||
"typename"
|
||||
"using"
|
||||
"concept"
|
||||
"requires"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"co_await"
|
||||
] @keyword.coroutine
|
||||
|
||||
[
|
||||
"co_yield"
|
||||
"co_return"
|
||||
] @keyword.coroutine.return
|
||||
|
||||
[
|
||||
"public"
|
||||
"private"
|
||||
"protected"
|
||||
"virtual"
|
||||
"final"
|
||||
] @type.qualifier
|
||||
|
||||
[
|
||||
"new"
|
||||
"delete"
|
||||
|
||||
"xor"
|
||||
"bitand"
|
||||
"bitor"
|
||||
"compl"
|
||||
"not"
|
||||
"xor_eq"
|
||||
"and_eq"
|
||||
"or_eq"
|
||||
"not_eq"
|
||||
"and"
|
||||
"or"
|
||||
] @keyword.operator
|
||||
|
||||
"<=>" @operator
|
||||
|
||||
"::" @punctuation.delimiter
|
||||
|
||||
(template_argument_list
|
||||
["<" ">"] @punctuation.bracket)
|
||||
|
||||
(template_parameter_list
|
||||
["<" ">"] @punctuation.bracket)
|
||||
|
||||
(literal_suffix) @operator
|
||||
11
runtime/queries/cpp/indents.scm
Normal file
11
runtime/queries/cpp/indents.scm
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
; inherits: c
|
||||
|
||||
[
|
||||
(class_specifier)
|
||||
(condition_clause)
|
||||
] @indent.begin
|
||||
|
||||
((field_initializer_list) @indent.begin
|
||||
(#set! indent.start_at_same_line 1))
|
||||
(access_specifier) @indent.branch
|
||||
|
||||
13
runtime/queries/cpp/injections.scm
Normal file
13
runtime/queries/cpp/injections.scm
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
((preproc_arg) @injection.content
|
||||
(#set! injection.language "cpp"))
|
||||
|
||||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
|
||||
((comment) @injection.content
|
||||
(#lua-match? @injection.content "/[*][!<*][^a-zA-Z]")
|
||||
(#set! injection.language "doxygen"))
|
||||
|
||||
(raw_string_literal
|
||||
delimiter: (raw_string_delimiter) @injection.language
|
||||
(raw_string_content) @injection.content)
|
||||
75
runtime/queries/cpp/locals.scm
Normal file
75
runtime/queries/cpp/locals.scm
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
; inherits: c
|
||||
|
||||
;; Parameters
|
||||
(variadic_parameter_declaration
|
||||
declarator: (variadic_declarator
|
||||
(identifier) @definition.parameter))
|
||||
(optional_parameter_declaration
|
||||
declarator: (identifier) @definition.parameter)
|
||||
;; Class / struct definitions
|
||||
(class_specifier) @scope
|
||||
|
||||
(reference_declarator
|
||||
(identifier) @definition.var)
|
||||
|
||||
(variadic_declarator
|
||||
(identifier) @definition.var)
|
||||
|
||||
(struct_specifier
|
||||
name: (qualified_identifier
|
||||
name: (type_identifier) @definition.type))
|
||||
|
||||
(class_specifier
|
||||
name: (type_identifier) @definition.type)
|
||||
|
||||
(concept_definition
|
||||
name: (identifier) @definition.type)
|
||||
|
||||
(class_specifier
|
||||
name: (qualified_identifier
|
||||
name: (type_identifier) @definition.type))
|
||||
|
||||
(alias_declaration
|
||||
name: (type_identifier) @definition.type)
|
||||
|
||||
;template <typename T>
|
||||
(type_parameter_declaration
|
||||
(type_identifier) @definition.type)
|
||||
(template_declaration) @scope
|
||||
|
||||
;; Namespaces
|
||||
(namespace_definition
|
||||
name: (namespace_identifier) @definition.namespace
|
||||
body: (_) @scope)
|
||||
|
||||
(namespace_definition
|
||||
name: (nested_namespace_specifier) @definition.namespace
|
||||
body: (_) @scope)
|
||||
|
||||
((namespace_identifier) @reference
|
||||
(#set! reference.kind "namespace"))
|
||||
|
||||
;; Function definitions
|
||||
(template_function
|
||||
name: (identifier) @definition.function) @scope
|
||||
|
||||
(template_method
|
||||
name: (field_identifier) @definition.method) @scope
|
||||
|
||||
(function_declarator
|
||||
declarator: (qualified_identifier
|
||||
name: (identifier) @definition.function)) @scope
|
||||
|
||||
(field_declaration
|
||||
declarator: (function_declarator
|
||||
(field_identifier) @definition.method))
|
||||
|
||||
(lambda_expression) @scope
|
||||
|
||||
;; Control structures
|
||||
(try_statement
|
||||
body: (_) @scope)
|
||||
|
||||
(catch_clause) @scope
|
||||
|
||||
(requires_expression) @scope
|
||||
3
runtime/queries/css/folds.scm
Normal file
3
runtime/queries/css/folds.scm
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
[
|
||||
(rule_set)
|
||||
] @fold
|
||||
91
runtime/queries/css/highlights.scm
Normal file
91
runtime/queries/css/highlights.scm
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
[
|
||||
"@media"
|
||||
"@charset"
|
||||
"@namespace"
|
||||
"@supports"
|
||||
"@keyframes"
|
||||
(at_keyword)
|
||||
(to)
|
||||
(from)
|
||||
] @keyword
|
||||
|
||||
"@import" @include
|
||||
|
||||
(comment) @comment @spell
|
||||
|
||||
[
|
||||
(tag_name)
|
||||
(nesting_selector)
|
||||
(universal_selector)
|
||||
] @type
|
||||
|
||||
(function_name) @function
|
||||
|
||||
[
|
||||
"~"
|
||||
">"
|
||||
"+"
|
||||
"-"
|
||||
"*"
|
||||
"/"
|
||||
"="
|
||||
"^="
|
||||
"|="
|
||||
"~="
|
||||
"$="
|
||||
"*="
|
||||
"and"
|
||||
"or"
|
||||
"not"
|
||||
"only"
|
||||
] @operator
|
||||
|
||||
(important) @type.qualifier
|
||||
|
||||
(attribute_selector (plain_value) @string)
|
||||
(pseudo_element_selector "::" (tag_name) @property)
|
||||
(pseudo_class_selector (class_name) @property)
|
||||
|
||||
[
|
||||
(class_name)
|
||||
(id_name)
|
||||
(property_name)
|
||||
(feature_name)
|
||||
(attribute_name)
|
||||
] @property
|
||||
|
||||
(namespace_name) @namespace
|
||||
|
||||
((property_name) @type.definition
|
||||
(#lua-match? @type.definition "^[-][-]"))
|
||||
((plain_value) @type
|
||||
(#lua-match? @type "^[-][-]"))
|
||||
|
||||
[
|
||||
(string_value)
|
||||
(color_value)
|
||||
(unit)
|
||||
] @string
|
||||
|
||||
[
|
||||
(integer_value)
|
||||
(float_value)
|
||||
] @number
|
||||
|
||||
[
|
||||
"#"
|
||||
","
|
||||
"."
|
||||
":"
|
||||
"::"
|
||||
";"
|
||||
] @punctuation.delimiter
|
||||
|
||||
[
|
||||
"{"
|
||||
")"
|
||||
"("
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
(ERROR) @error
|
||||
9
runtime/queries/css/indents.scm
Normal file
9
runtime/queries/css/indents.scm
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
[
|
||||
(block)
|
||||
(declaration)
|
||||
] @indent.begin
|
||||
|
||||
(block ("}") @indent.branch)
|
||||
("}") @indent.dedent
|
||||
|
||||
(comment) @indent.ignore
|
||||
2
runtime/queries/css/injections.scm
Normal file
2
runtime/queries/css/injections.scm
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
3
runtime/queries/csv/highlights.scm
Normal file
3
runtime/queries/csv/highlights.scm
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
; inherits: tsv
|
||||
|
||||
"," @punctuation.delimiter
|
||||
1
runtime/queries/cuda/folds.scm
Normal file
1
runtime/queries/cuda/folds.scm
Normal file
|
|
@ -0,0 +1 @@
|
|||
; inherits: cpp
|
||||
13
runtime/queries/cuda/highlights.scm
Normal file
13
runtime/queries/cuda/highlights.scm
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
; inherits: cpp
|
||||
|
||||
[ "<<<" ">>>" ] @punctuation.bracket
|
||||
|
||||
[
|
||||
"__host__"
|
||||
"__device__"
|
||||
"__global__"
|
||||
"__forceinline__"
|
||||
"__noinline__"
|
||||
] @storageclass
|
||||
|
||||
"__launch_bounds__" @type.qualifier
|
||||
1
runtime/queries/cuda/indents.scm
Normal file
1
runtime/queries/cuda/indents.scm
Normal file
|
|
@ -0,0 +1 @@
|
|||
; inherits: cpp
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue