chore: format queries

This commit is contained in:
Phạm Huy Hoàng 2024-01-21 22:05:44 +09:00
parent 76ca66db38
commit 77e298e4de
50 changed files with 143 additions and 146 deletions

View file

@ -57,8 +57,8 @@
(type_arguments
">" @punctuation.delimiter)
((field_access
object: (identifier) @type))
(field_access
object: (identifier) @type)
(field_access
field: (identifier) @property)

View file

@ -11,12 +11,12 @@
(import_statement
name:
(dotted_name
((python_identifier) @local.definition.import)))
(python_identifier) @local.definition.import))
(import_from_statement
name:
(dotted_name
((python_identifier) @local.definition.import)))
(python_identifier) @local.definition.import))
; Function with parameters, defines parameters
(parameters

View file

@ -232,10 +232,10 @@
(argument_list
(identifier) @variable.builtin))
((attribute_specifier
(attribute_specifier
(argument_list
(call_expression
function: (identifier) @variable.builtin))))
function: (identifier) @variable.builtin)))
((call_expression
function: (identifier) @function.builtin)

View file

@ -42,7 +42,7 @@
condition: (_) @indent.begin)
; Supports if without braces (but not both if-else without braces)
((if_statement
(if_statement
consequence:
(_
";" @indent.end) @_consequence
@ -55,7 +55,7 @@
(compound_statement) @indent.dedent)? @indent.dedent
(compound_statement)? @indent.dedent
(_)? @indent.dedent
])?) @indent.begin)
])?) @indent.begin
(else_clause
(_

View file

@ -19,8 +19,8 @@
(endblock_command)
] @indent.branch
(")" @indent.branch)
")" @indent.branch
(")" @indent.end)
")" @indent.end
(argument_list) @indent.auto

View file

@ -46,4 +46,4 @@
("text" @number
(#lua-match? @number "^#[0-9]+$"))
((uri) @string.special.url @nospell)
(uri) @string.special.url @nospell

View file

@ -47,7 +47,7 @@
">"
] @punctuation.bracket
(("\"" @string)
("\"" @string
(#set! conceal ""))
; Comments

View file

@ -16,8 +16,8 @@
declarator: (_) @variable.parameter)
;(field_expression) @variable.parameter ;; How to highlight this?
(((field_expression
(field_identifier) @function.method)) @_parent
((field_expression
(field_identifier) @function.method) @_parent
(#has-parent? @_parent template_method function_declarator))
(field_declaration

View file

@ -4,8 +4,8 @@
] @indent.begin
(block
("}") @indent.branch)
"}" @indent.branch)
("}") @indent.dedent
"}" @indent.dedent
(comment) @indent.ignore

View file

@ -123,7 +123,7 @@
((identifier) @type
(#lua-match? @type "^_?[%u].*[%l]")) ; catch Classes or IClasses not CLASSES
("Function" @type)
"Function" @type
; properties
(unconditional_assignable_selector

View file

@ -10,6 +10,6 @@
((link) @injection.content
(#set! injection.language "html"))
((code_block
(code_block
(code_block_language) @injection.language
(code_block_content) @injection.content))
(code_block_content) @injection.content)

View file

@ -65,11 +65,11 @@
"NOTATION" @keyword.directive
(Name) @label)
((NotationDecl
(NotationDecl
(ExternalID
(SystemLiteral
(URI) @string.special.url))
(#set! "priority" 105)))
(#set! "priority" 105))
; Attlist declaration
(AttlistDecl

View file

@ -283,11 +283,11 @@
"}"
] @punctuation.bracket
((template_substitution
(template_substitution
[
"${"
"}"
] @punctuation.special) @none)
] @punctuation.special) @none
; Keywords
;----------

View file

@ -7,8 +7,7 @@
; html(`...`), html`...`, sql(...) etc
(call_expression
function:
((identifier) @injection.language)
function: (identifier) @injection.language
arguments:
[
(arguments

View file

@ -28,11 +28,11 @@
(identifier) @local.definition.import)
(function_declaration
((identifier) @local.definition.function)
(identifier) @local.definition.function
(#set! definition.var.scope parent))
(method_definition
((property_identifier) @local.definition.function)
(property_identifier) @local.definition.function
(#set! definition.var.scope parent))
; References

View file

@ -176,7 +176,7 @@
; Non-String Sigils
(sigil
"~" @string.special
((sigil_name) @string.special) @_sigil_name
(sigil_name) @string.special @_sigil_name
quoted_start: _ @string.special
quoted_end: _ @string.special
((sigil_modifiers) @string.special)?
@ -185,7 +185,7 @@
; String Sigils
(sigil
"~" @string
((sigil_name) @string) @_sigil_name
(sigil_name) @string @_sigil_name
quoted_start: _ @string
(quoted_content) @string
quoted_end: _ @string
@ -217,7 +217,7 @@
(charlist)
(sigil
"~" @comment.documentation
((sigil_name) @comment.documentation)
(sigil_name) @comment.documentation
quoted_start: _ @comment.documentation
(quoted_content) @comment.documentation
quoted_end: _ @comment.documentation)

View file

@ -105,8 +105,8 @@
(#set! "definition.method.scope" "parent"))
; Enum
((enum_definition
(name) @local.definition.enum))
(enum_definition
(name) @local.definition.enum)
; Repeat
(for_statement

View file

@ -1,7 +1,7 @@
(dir_sep) @punctuation.delimiter
(quoted_pattern
("\"" @punctuation.special))
"\"" @punctuation.special)
(range_notation) @string.special
@ -18,7 +18,7 @@
(character_class) @constant
(class_range
("-" @operator))
"-" @operator)
[
(ansi_c_escape)

View file

@ -277,7 +277,7 @@
(pat_view
(exp_name
[
((variable) @function.call)
(variable) @function.call
(qualified_variable
(variable) @function.call)
]))
@ -293,14 +293,14 @@
; partially applied infix functions (sections) also get highlighted as operators
(exp_section_right
[
((variable) @operator)
(variable) @operator
(qualified_variable
(variable) @operator)
])
(exp_section_left
[
((variable) @operator)
(variable) @operator
(qualified_variable
(variable) @operator)
])
@ -310,7 +310,7 @@
(exp_infix
(exp_name
[
((variable) @function.call)
(variable) @function.call
(qualified_variable
((module) @module
(variable) @function.call))
@ -328,7 +328,7 @@
.
(exp_name
[
((variable) @variable)
(variable) @variable
(qualified_variable
(variable) @variable)
]))
@ -336,7 +336,7 @@
; function calls with infix operators
((exp_name
[
((variable) @function.call)
(variable) @function.call
(qualified_variable
(variable) @function.call)
])
@ -353,7 +353,7 @@
.
(exp_name
[
((variable) @function.call)
(variable) @function.call
(qualified_variable
(variable) @function.call)
]))
@ -364,7 +364,7 @@
; function composition, arrows, monadic composition (lhs)
((exp_name
[
((variable) @function)
(variable) @function
(qualified_variable
(variable) @function)
])
@ -381,7 +381,7 @@
.
(exp_name
[
((variable) @function)
(variable) @function
(qualified_variable
(variable) @function)
]))
@ -394,7 +394,7 @@
.
(exp_name
[
((variable) @function)
(variable) @function
(qualified_variable
(variable) @function)
])
@ -415,7 +415,7 @@
(exp_apply
(exp_name
[
((variable) @function.call)
(variable) @function.call
(qualified_variable
(variable) @function.call)
]))
@ -428,7 +428,7 @@
(exp_infix
(exp_name
[
((variable) @function.call)
(variable) @function.call
(qualified_variable
(variable) @function.call)
])
@ -444,7 +444,7 @@
.
(exp_name
[
((variable) @function.call)
(variable) @function.call
(qualified_variable
(variable) @function.call)
]))))
@ -455,7 +455,7 @@
.
(exp_name
[
((variable) @variable)
(variable) @variable
(qualified_variable
(variable) @variable)
]))
@ -493,9 +493,9 @@
; signatures that have a function type
; + functions that follow them
((signature
(signature
(variable) @function
(fun)))
(fun))
((signature
(variable) @_type
@ -505,10 +505,10 @@
(variable) @function)
(#eq? @function @_type))
((signature
(signature
(variable) @function
(context
(fun))))
(fun)))
((signature
(variable) @_type
@ -570,8 +570,8 @@
(quasiquote_body) @string)
(quasiquote
((_
(variable) @_name))
(_
(variable) @_name)
(#eq? @_name "qq")
(quasiquote_body) @string)
@ -613,7 +613,7 @@
(exp_field
field:
[
((variable) @variable.member)
(variable) @variable.member
(qualified_variable
(variable) @variable.member)
])

View file

@ -1,8 +1,8 @@
; -----------------------------------------------------------------------------
; General language injection
(quasiquote
((quoter) @injection.language)
((quasiquote_body) @injection.content))
(quoter) @injection.language
(quasiquote_body) @injection.content)
((comment) @injection.content
(#set! injection.language "comment"))
@ -21,28 +21,28 @@
(quasiquote
(quoter) @_name
(#any-of? @_name "cassius" "lucius")
((quasiquote_body) @injection.content)
(quasiquote_body) @injection.content
(#set! injection.language "css"))
; HTML: Text.Hamlet
(quasiquote
(quoter) @_name
(#any-of? @_name "shamlet" "xshamlet" "hamlet" "xhamlet" "ihamlet")
((quasiquote_body) @injection.content)
(quasiquote_body) @injection.content
(#set! injection.language "html"))
; JS: Text.Julius
(quasiquote
(quoter) @_name
(#any-of? @_name "js" "julius")
((quasiquote_body) @injection.content)
(quasiquote_body) @injection.content
(#set! injection.language "javascript"))
; TS: Text.TypeScript
(quasiquote
(quoter) @_name
(#any-of? @_name "tsc" "tscJSX")
((quasiquote_body) @injection.content)
(quasiquote_body) @injection.content
(#set! injection.language "typescript"))
; -----------------------------------------------------------------------------
@ -50,7 +50,7 @@
(quasiquote
(quoter) @_name
(#eq? @_name "hsx")
((quasiquote_body) @injection.content)
(quasiquote_body) @injection.content
(#set! injection.language "html"))
; -----------------------------------------------------------------------------
@ -58,7 +58,7 @@
(quasiquote
(quoter) @_name
(#eq? @_name "aesonQQ")
((quasiquote_body) @injection.content)
(quasiquote_body) @injection.content
(#set! injection.language "json"))
; -----------------------------------------------------------------------------
@ -67,10 +67,10 @@
(quasiquote
(quoter) @injection.language
(#eq? @injection.language "sql")
((quasiquote_body) @injection.content))
(quasiquote_body) @injection.content)
(quasiquote
(quoter) @_name
(#any-of? @_name "persistUpperCase" "persistLowerCase" "persistWith")
((quasiquote_body) @injection.content)
(quasiquote_body) @injection.content
(#set! injection.language "haskell_persistent"))

View file

@ -35,11 +35,11 @@
; <script type="mimetype-or-well-known-script-type">
(script_element
(start_tag
((attribute
(attribute
(attribute_name) @_attr
(#eq? @_attr "type")
(quoted_attribute_value
(attribute_value) @_type))))
(attribute_value) @_type)))
(raw_text) @injection.content
(#set-lang-from-mimetype! @_type))
@ -72,14 +72,14 @@
(_
(tag_name) @_tagname
(#eq? @_tagname "input")
((attribute
(attribute
(attribute_name) @_attr
[
(quoted_attribute_value
(attribute_value) @injection.content)
(attribute_value) @injection.content
]
(#eq? @_attr "pattern")))
(#eq? @_attr "pattern"))
(#set! injection.language "regex")))
; <input type="checkbox" onchange="this.closest('form').elements.output.value = this.checked">
@ -101,7 +101,7 @@
((attribute_name) @_name
(#lua-match? @_name "^%*"))
(quoted_attribute_value
((attribute_value) @injection.content))
(attribute_value) @injection.content)
(#set! injection.language "angular"))
(element

View file

@ -58,10 +58,10 @@
; baz(y) { y }
; }
(method_definition
([
[
(property_identifier)
(private_property_identifier)
] @local.definition.function)
] @local.definition.function
(#set! definition.var.scope parent))
; this.foo()

View file

@ -28,7 +28,7 @@
"false"
] @boolean
("null") @type.builtin
"null" @type.builtin
; Interpolation
[

View file

@ -28,7 +28,7 @@
"}"
] @punctuation.bracket
(("\"" @conceal)
("\"" @conceal
(#set! conceal ""))
(escape_sequence) @string.escape

View file

@ -38,9 +38,9 @@
; Handle the dot operator effectively - <My.Component>
(jsx_opening_element
((member_expression
(member_expression
(identifier) @tag
(property_identifier) @constructor)))
(property_identifier) @constructor))
(jsx_closing_element
((identifier) @constructor
@ -48,9 +48,9 @@
; Handle the dot operator effectively - </My.Component>
(jsx_closing_element
((member_expression
(member_expression
(identifier) @tag
(property_identifier) @constructor)))
(property_identifier) @constructor))
(jsx_self_closing_element
((identifier) @constructor
@ -58,8 +58,8 @@
; Handle the dot operator effectively - <My.Component />
(jsx_self_closing_element
((member_expression
(member_expression
(identifier) @tag
(property_identifier) @constructor)))
(property_identifier) @constructor))
(jsx_text) @none

View file

@ -5,7 +5,7 @@
] @indent.begin
(jsx_closing_element
(">" @indent.end))
">" @indent.end)
(jsx_self_closing_element
"/>" @indent.end)

View file

@ -92,22 +92,22 @@
(simple_identifier) @function)
(getter
("get") @function.builtin)
"get" @function.builtin)
(setter
("set") @function.builtin)
"set" @function.builtin)
(primary_constructor) @constructor
(secondary_constructor
("constructor") @constructor)
"constructor" @constructor)
(constructor_invocation
(user_type
(type_identifier) @constructor))
(anonymous_initializer
("init") @constructor)
"init" @constructor)
(parameter
(simple_identifier) @variable.parameter)
@ -182,7 +182,7 @@
; - "[abc]?".toRegex()
(call_expression
(navigation_expression
((string_literal) @string.regexp)
(string_literal) @string.regexp
(navigation_suffix
((simple_identifier) @_function
(#eq? @_function "toRegex")))))

View file

@ -45,7 +45,7 @@
(bare_symbol
(macro
((macro_id) @type.definition)))
(macro_id) @type.definition))
(bare_symbol
(identifier) @type.definition)

View file

@ -193,7 +193,7 @@
command: _ @module
authors:
(curly_group_author_list
((author)+ @markup.heading.1)))
(author)+ @markup.heading.1))
(chapter
command: _ @module

View file

@ -25,7 +25,7 @@
(check_out)
] @markup.raw
((account) @variable.member)
(account) @variable.member
"include" @keyword.import

View file

@ -629,7 +629,7 @@
; NOTE: needs to be after @type
; generic types when declaring
((generic_parameter_list
(generic_parameter_list
(parameter_declaration
(symbol_declaration_list
(symbol_declaration
@ -638,7 +638,7 @@
(identifier) @variable.parameter
(accent_quoted
(identifier) @variable.parameter)
])))))
]))))
; for loop variables
(for

View file

@ -244,12 +244,12 @@
(comment) @comment
([
[
"=>"
","
";"
"->"
] @punctuation.delimiter)
] @punctuation.delimiter
([
"["

View file

@ -1,17 +1,17 @@
((comment) @injection.content
(#set! injection.language "phpdoc"))
((heredoc
(heredoc
(heredoc_body) @injection.content
(heredoc_end) @injection.language
(#set! injection.include-children)
(#downcase! @injection.language)))
(#downcase! @injection.language))
((nowdoc
(nowdoc
(nowdoc_body) @injection.content
(heredoc_end) @injection.language
(#set! injection.include-children)
(#downcase! @injection.language)))
(#downcase! @injection.language))
; regex
((function_call_expression

View file

@ -24,12 +24,12 @@
(import_statement
name:
(dotted_name
((identifier) @local.definition.import)))
(identifier) @local.definition.import))
(import_from_statement
name:
(dotted_name
((identifier) @local.definition.import)))
(identifier) @local.definition.import))
; Function with parameters, defines parameters
(parameters

View file

@ -24,9 +24,9 @@
(identifier) @variable.builtin)
(#eq? @variable.builtin "self"))
((dollar
(dollar
_
(identifier) @variable.member))
(identifier) @variable.member)
; Parameters
(formal_parameters
@ -158,6 +158,6 @@
(call
function:
((dollar
(dollar
_
(identifier) @function.method.call)))
(identifier) @function.method.call))

View file

@ -12,8 +12,8 @@
"for"
] @indent.begin
((binary
operator: (special)) @indent.begin)
(binary
operator: (special)) @indent.begin
[
"}"

View file

@ -19,8 +19,7 @@
(#set! injection.language "comment"))
((macro_invocation
macro:
((identifier) @injection.language)
macro: (identifier) @injection.language
(token_tree) @injection.content)
(#any-of? @injection.language "html" "json"))

View file

@ -60,8 +60,8 @@
(import_declaration
path: (identifier) @module)
((stable_identifier
(identifier) @module))
(stable_identifier
(identifier) @module)
((import_declaration
path: (identifier) @type)
@ -74,8 +74,8 @@
(export_declaration
path: (identifier) @module)
((stable_identifier
(identifier) @module))
(stable_identifier
(identifier) @module)
((export_declaration
path: (identifier) @type)
@ -274,7 +274,7 @@
; `case` is a conditional keyword in case_block
(case_block
(case_clause
("case") @keyword.conditional))
"case" @keyword.conditional))
(operator_identifier) @operator

View file

@ -15,8 +15,7 @@
name: (identifier) @local.definition.function)
(function_definition
name:
((identifier) @local.definition.function)
name: (identifier) @local.definition.function
(#set! definition.var.scope parent))
(parameter

View file

@ -24,11 +24,11 @@
(term
alias: (identifier) @variable)
((term
(term
value:
(cast
name: (keyword_cast) @function.call
parameter: (literal)?)))
parameter: (literal)?))
(literal) @string

View file

@ -35,8 +35,8 @@
] @indent.begin
; @something(...)
((modifiers
(attribute) @indent.begin))
(modifiers
(attribute) @indent.begin)
(function_declaration
(modifiers

View file

@ -15,8 +15,8 @@
(anon_function) @local.scope
((function_statement
(function_name) @local.definition.function) @local.scope)
(function_statement
(function_name) @local.definition.function) @local.scope
(program) @local.scope

View file

@ -96,10 +96,10 @@
"await" @keyword.coroutine
(pcal_with
("=") @keyword)
"=" @keyword)
(pcal_process
("=") @keyword)
"=" @keyword)
[
"if"
@ -119,9 +119,9 @@
(pcal_end_with)
] @keyword.repeat
("return") @keyword.return
"return" @keyword.return
("print") @function.macro
"print" @function.macro
; Literals
(binary_number
@ -188,11 +188,11 @@
(bound_prefix_op
symbol: (_) @operator)
((prefix_op_symbol) @operator)
(prefix_op_symbol) @operator
((infix_op_symbol) @operator)
(infix_op_symbol) @operator
((postfix_op_symbol) @operator)
(postfix_op_symbol) @operator
(function_definition
name: (identifier) @function)
@ -236,7 +236,7 @@
(pcal_with
(identifier) @variable.parameter)
((".")
("."
.
(identifier) @attribute)

View file

@ -150,17 +150,17 @@
; References
(identifier_ref) @local.reference
((prefix_op_symbol) @local.reference)
(prefix_op_symbol) @local.reference
(bound_prefix_op
symbol: (_) @local.reference)
((infix_op_symbol) @local.reference)
(infix_op_symbol) @local.reference
(bound_infix_op
symbol: (_) @local.reference)
((postfix_op_symbol) @local.reference)
(postfix_op_symbol) @local.reference
(bound_postfix_op
symbol: (_) @local.reference)

View file

@ -50,8 +50,8 @@
"type"
(import_clause
(named_imports
((import_specifier
name: (identifier) @type)))))
(import_specifier
name: (identifier) @type))))
(template_literal_type) @string

View file

@ -183,9 +183,9 @@
"instanceable"))
; Common attribute metadata
((layer_offset
(layer_offset
(identifier) @keyword
(#any-of? @keyword "offset" "scale")))
(#any-of? @keyword "offset" "scale"))
; Docstrings in USD
(metadata

View file

@ -1,5 +1,5 @@
((function_declaration
name: (identifier) @local.definition.function)) ;@function
(function_declaration
name: (identifier) @local.definition.function) ;@function
(var_declaration
var_list:
@ -7,8 +7,8 @@
(reference_expression
(identifier) @local.definition.var)))
((function_declaration
name: (identifier) @local.definition.function))
(function_declaration
name: (identifier) @local.definition.function)
(const_declaration
(const_definition

View file

@ -12,7 +12,7 @@
; TODO: When nvim-treesitter has postcss and less parsers, use @injection.language and @injection.content instead
; <script lang="scss">
((style_element
(style_element
(start_tag
(attribute
(attribute_name) @_lang
@ -21,7 +21,7 @@
(raw_text) @injection.content
(#eq? @_lang "lang")
(#any-of? @_scss "less" "postcss")
(#set! injection.language "scss")))
(#set! injection.language "scss"))
; <script lang="js">
((script_element
@ -49,7 +49,7 @@
; <script lang="tsx">
; <script lang="jsx">
((script_element
(script_element
(start_tag
(attribute
(attribute_name) @_attr
@ -57,7 +57,7 @@
(attribute_value) @injection.language)))
(#eq? @_attr "lang")
(#any-of? @injection.language "tsx" "jsx")
(raw_text) @injection.content))
(raw_text) @injection.content)
((interpolation
(raw_text) @injection.content)

View file

@ -14,7 +14,7 @@
(function_declaration
(import_path
((identifier) @function.)))
(identifier) @function.))
(import_path
(identifier) @module

View file

@ -6,9 +6,9 @@
(AsmExpr)
(ErrorSetDecl)
(LINESTRING)
([
[
(IfPrefix)
(WhilePrefix)
(ForPrefix)
])
]
] @fold