fix(ts): remove unused files
This commit is contained in:
@@ -1,66 +0,0 @@
|
|||||||
local log = require("log")
|
|
||||||
|
|
||||||
local languages = {
|
|
||||||
"bash",
|
|
||||||
"zsh",
|
|
||||||
"python",
|
|
||||||
"c",
|
|
||||||
"cpp",
|
|
||||||
"lua",
|
|
||||||
"luadoc",
|
|
||||||
"vim",
|
|
||||||
"vimdoc",
|
|
||||||
"php",
|
|
||||||
"rust",
|
|
||||||
"comment",
|
|
||||||
"gitcommit",
|
|
||||||
"xml",
|
|
||||||
"sql",
|
|
||||||
"html",
|
|
||||||
"json",
|
|
||||||
"gotmpl",
|
|
||||||
"markdown",
|
|
||||||
"go",
|
|
||||||
"svelte",
|
|
||||||
"scss",
|
|
||||||
"tsx",
|
|
||||||
"typescript",
|
|
||||||
"yaml",
|
|
||||||
}
|
|
||||||
|
|
||||||
local ts = require("nvim-treesitter")
|
|
||||||
ts.setup({
|
|
||||||
install_dir = string.format("%s/nvim-treesitter", vim.fn.stdpath("data")),
|
|
||||||
})
|
|
||||||
ts.install(languages):await(function(err)
|
|
||||||
if err then
|
|
||||||
log.error("Error: %s", err)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
---@diagnostic disable-next-line: redefined-local
|
|
||||||
ts.update():await(function(err)
|
|
||||||
if err then
|
|
||||||
log.error("Error: %s", err)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local filetypes = {}
|
|
||||||
for _, lang in ipairs(languages) do
|
|
||||||
for _, ft in ipairs(vim.treesitter.language.get_filetypes(lang)) do
|
|
||||||
if not vim.list_contains(filetypes, ft) then
|
|
||||||
table.insert(filetypes, ft)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd("FileType", {
|
|
||||||
pattern = filetypes,
|
|
||||||
callback = function()
|
|
||||||
vim.treesitter.start()
|
|
||||||
vim.wo.foldmethod = "expr"
|
|
||||||
vim.wo.foldexpr = "v:lua.vim.treesitter.foldexpr()"
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end)
|
|
||||||
end)
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
[
|
|
||||||
(if_statement)
|
|
||||||
(for_statement)
|
|
||||||
(while_statement)
|
|
||||||
(case_statement)
|
|
||||||
(function_definition)
|
|
||||||
(compound_statement)
|
|
||||||
(subshell)
|
|
||||||
(command_substitution)
|
|
||||||
(do_group)
|
|
||||||
(case_item)
|
|
||||||
] @indent.begin
|
|
||||||
|
|
||||||
[
|
|
||||||
"fi"
|
|
||||||
"done"
|
|
||||||
"esac"
|
|
||||||
"}"
|
|
||||||
")"
|
|
||||||
"then"
|
|
||||||
"do"
|
|
||||||
(elif_clause)
|
|
||||||
(else_clause)
|
|
||||||
] @indent.branch
|
|
||||||
|
|
||||||
[
|
|
||||||
"fi"
|
|
||||||
"done"
|
|
||||||
"esac"
|
|
||||||
"}"
|
|
||||||
")"
|
|
||||||
] @indent.end
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
; Scopes
|
|
||||||
(function_definition) @local.scope
|
|
||||||
|
|
||||||
; Definitions
|
|
||||||
(variable_assignment
|
|
||||||
name: (variable_name) @local.definition.var)
|
|
||||||
|
|
||||||
(function_definition
|
|
||||||
name: (word) @local.definition.function)
|
|
||||||
|
|
||||||
; References
|
|
||||||
(variable_name) @local.reference
|
|
||||||
|
|
||||||
(word) @local.reference
|
|
||||||
@@ -1,99 +0,0 @@
|
|||||||
[
|
|
||||||
(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-kind-eq? @_body "compound_statement"))
|
|
||||||
|
|
||||||
(while_statement
|
|
||||||
condition: (_) @indent.begin)
|
|
||||||
|
|
||||||
((while_statement
|
|
||||||
body: (_) @_body) @indent.begin
|
|
||||||
(#not-kind-eq? @_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-kind-eq? @_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
|
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
; Functions definitions
|
|
||||||
(function_declarator
|
|
||||||
declarator: (identifier) @local.definition.function)
|
|
||||||
|
|
||||||
(preproc_function_def
|
|
||||||
name: (identifier) @local.definition.macro) @local.scope
|
|
||||||
|
|
||||||
(preproc_def
|
|
||||||
name: (identifier) @local.definition.macro)
|
|
||||||
|
|
||||||
(pointer_declarator
|
|
||||||
declarator: (identifier) @local.definition.var)
|
|
||||||
|
|
||||||
(parameter_declaration
|
|
||||||
declarator: (identifier) @local.definition.parameter)
|
|
||||||
|
|
||||||
(init_declarator
|
|
||||||
declarator: (identifier) @local.definition.var)
|
|
||||||
|
|
||||||
(array_declarator
|
|
||||||
declarator: (identifier) @local.definition.var)
|
|
||||||
|
|
||||||
(declaration
|
|
||||||
declarator: (identifier) @local.definition.var)
|
|
||||||
|
|
||||||
(enum_specifier
|
|
||||||
name: (_) @local.definition.type
|
|
||||||
(enumerator_list
|
|
||||||
(enumerator
|
|
||||||
name: (identifier) @local.definition.var)))
|
|
||||||
|
|
||||||
; Type / Struct / Enum
|
|
||||||
(field_declaration
|
|
||||||
declarator: (field_identifier) @local.definition.field)
|
|
||||||
|
|
||||||
(type_definition
|
|
||||||
declarator: (type_identifier) @local.definition.type)
|
|
||||||
|
|
||||||
(struct_specifier
|
|
||||||
name: (type_identifier) @local.definition.type)
|
|
||||||
|
|
||||||
; goto
|
|
||||||
(labeled_statement
|
|
||||||
(statement_identifier) @local.definition)
|
|
||||||
|
|
||||||
; References
|
|
||||||
(identifier) @local.reference
|
|
||||||
|
|
||||||
((field_identifier) @local.reference
|
|
||||||
(#set! reference.kind "field"))
|
|
||||||
|
|
||||||
((type_identifier) @local.reference
|
|
||||||
(#set! reference.kind "type"))
|
|
||||||
|
|
||||||
(goto_statement
|
|
||||||
(statement_identifier) @local.reference)
|
|
||||||
|
|
||||||
; Scope
|
|
||||||
[
|
|
||||||
(for_statement)
|
|
||||||
(if_statement)
|
|
||||||
(while_statement)
|
|
||||||
(translation_unit)
|
|
||||||
(function_definition)
|
|
||||||
(compound_statement) ; a block in curly braces
|
|
||||||
(struct_specifier)
|
|
||||||
] @local.scope
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
[
|
|
||||||
(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
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
; inherits: c
|
|
||||||
|
|
||||||
(condition_clause) @indent.begin
|
|
||||||
|
|
||||||
((field_initializer_list) @indent.begin
|
|
||||||
(#set! indent.start_at_same_line 1))
|
|
||||||
|
|
||||||
(access_specifier) @indent.branch
|
|
||||||
@@ -1,78 +0,0 @@
|
|||||||
; inherits: c
|
|
||||||
|
|
||||||
; Parameters
|
|
||||||
(variadic_parameter_declaration
|
|
||||||
declarator: (variadic_declarator
|
|
||||||
(identifier) @local.definition.parameter))
|
|
||||||
|
|
||||||
(optional_parameter_declaration
|
|
||||||
declarator: (identifier) @local.definition.parameter)
|
|
||||||
|
|
||||||
; Class / struct definitions
|
|
||||||
(class_specifier) @local.scope
|
|
||||||
|
|
||||||
(reference_declarator
|
|
||||||
(identifier) @local.definition.var)
|
|
||||||
|
|
||||||
(variadic_declarator
|
|
||||||
(identifier) @local.definition.var)
|
|
||||||
|
|
||||||
(struct_specifier
|
|
||||||
name: (qualified_identifier
|
|
||||||
name: (type_identifier) @local.definition.type))
|
|
||||||
|
|
||||||
(class_specifier
|
|
||||||
name: (type_identifier) @local.definition.type)
|
|
||||||
|
|
||||||
(concept_definition
|
|
||||||
name: (identifier) @local.definition.type)
|
|
||||||
|
|
||||||
(class_specifier
|
|
||||||
name: (qualified_identifier
|
|
||||||
name: (type_identifier) @local.definition.type))
|
|
||||||
|
|
||||||
(alias_declaration
|
|
||||||
name: (type_identifier) @local.definition.type)
|
|
||||||
|
|
||||||
;template <typename T>
|
|
||||||
(type_parameter_declaration
|
|
||||||
(type_identifier) @local.definition.type)
|
|
||||||
|
|
||||||
(template_declaration) @local.scope
|
|
||||||
|
|
||||||
; Namespaces
|
|
||||||
(namespace_definition
|
|
||||||
name: (namespace_identifier) @local.definition.namespace
|
|
||||||
body: (_) @local.scope)
|
|
||||||
|
|
||||||
(namespace_definition
|
|
||||||
name: (nested_namespace_specifier) @local.definition.namespace
|
|
||||||
body: (_) @local.scope)
|
|
||||||
|
|
||||||
((namespace_identifier) @local.reference
|
|
||||||
(#set! reference.kind "namespace"))
|
|
||||||
|
|
||||||
; Function definitions
|
|
||||||
(template_function
|
|
||||||
name: (identifier) @local.definition.function) @local.scope
|
|
||||||
|
|
||||||
(template_method
|
|
||||||
name: (field_identifier) @local.definition.method) @local.scope
|
|
||||||
|
|
||||||
(function_declarator
|
|
||||||
declarator: (qualified_identifier
|
|
||||||
name: (identifier) @local.definition.function)) @local.scope
|
|
||||||
|
|
||||||
(field_declaration
|
|
||||||
declarator: (function_declarator
|
|
||||||
(field_identifier) @local.definition.method))
|
|
||||||
|
|
||||||
(lambda_expression) @local.scope
|
|
||||||
|
|
||||||
; Control structures
|
|
||||||
(try_statement
|
|
||||||
body: (_) @local.scope)
|
|
||||||
|
|
||||||
(catch_clause) @local.scope
|
|
||||||
|
|
||||||
(requires_expression) @local.scope
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
[
|
|
||||||
(block)
|
|
||||||
(declaration)
|
|
||||||
] @indent.begin
|
|
||||||
|
|
||||||
(block
|
|
||||||
"}" @indent.branch)
|
|
||||||
|
|
||||||
"}" @indent.dedent
|
|
||||||
|
|
||||||
(comment) @indent.ignore
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
(elementdecl
|
|
||||||
(Name) @local.definition.type)
|
|
||||||
|
|
||||||
(elementdecl
|
|
||||||
(contentspec
|
|
||||||
(children
|
|
||||||
(Name) @local.reference)))
|
|
||||||
|
|
||||||
(AttlistDecl
|
|
||||||
.
|
|
||||||
(Name) @local.reference)
|
|
||||||
@@ -1,82 +0,0 @@
|
|||||||
[
|
|
||||||
(arguments)
|
|
||||||
(array)
|
|
||||||
(binary_expression)
|
|
||||||
(class_body)
|
|
||||||
(export_clause)
|
|
||||||
(formal_parameters)
|
|
||||||
(named_imports)
|
|
||||||
(object)
|
|
||||||
(object_pattern)
|
|
||||||
(parenthesized_expression)
|
|
||||||
(return_statement)
|
|
||||||
(statement_block)
|
|
||||||
(switch_case)
|
|
||||||
(switch_default)
|
|
||||||
(switch_statement)
|
|
||||||
(template_substitution)
|
|
||||||
(ternary_expression)
|
|
||||||
] @indent.begin
|
|
||||||
|
|
||||||
(arguments
|
|
||||||
(call_expression) @indent.begin)
|
|
||||||
|
|
||||||
(binary_expression
|
|
||||||
(call_expression) @indent.begin)
|
|
||||||
|
|
||||||
(expression_statement
|
|
||||||
(call_expression) @indent.begin)
|
|
||||||
|
|
||||||
(arrow_function
|
|
||||||
body: (_) @_body
|
|
||||||
(#not-kind-eq? @_body "statement_block")) @indent.begin
|
|
||||||
|
|
||||||
(assignment_expression
|
|
||||||
right: (_) @_right
|
|
||||||
(#not-kind-eq? @_right "arrow_function")) @indent.begin
|
|
||||||
|
|
||||||
(variable_declarator
|
|
||||||
value: (_) @_value
|
|
||||||
(#not-kind-eq? @_value "arrow_function" "call_expression")) @indent.begin
|
|
||||||
|
|
||||||
(arguments
|
|
||||||
")" @indent.end)
|
|
||||||
|
|
||||||
(object
|
|
||||||
"}" @indent.end)
|
|
||||||
|
|
||||||
(statement_block
|
|
||||||
"}" @indent.end)
|
|
||||||
|
|
||||||
[
|
|
||||||
(arguments
|
|
||||||
(object))
|
|
||||||
")"
|
|
||||||
"}"
|
|
||||||
"]"
|
|
||||||
] @indent.branch
|
|
||||||
|
|
||||||
(statement_block
|
|
||||||
"{" @indent.branch)
|
|
||||||
|
|
||||||
((parenthesized_expression
|
|
||||||
"("
|
|
||||||
(_)
|
|
||||||
")" @indent.end) @_outer
|
|
||||||
(#not-has-parent? @_outer if_statement))
|
|
||||||
|
|
||||||
[
|
|
||||||
"}"
|
|
||||||
"]"
|
|
||||||
] @indent.end
|
|
||||||
|
|
||||||
(template_string) @indent.ignore
|
|
||||||
|
|
||||||
[
|
|
||||||
(comment)
|
|
||||||
(ERROR)
|
|
||||||
] @indent.auto
|
|
||||||
|
|
||||||
(if_statement
|
|
||||||
consequence: (_) @indent.dedent
|
|
||||||
(#not-kind-eq? @indent.dedent statement_block)) @indent.begin
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
; Scopes
|
|
||||||
;-------
|
|
||||||
(statement_block) @local.scope
|
|
||||||
|
|
||||||
(function_expression) @local.scope
|
|
||||||
|
|
||||||
(arrow_function) @local.scope
|
|
||||||
|
|
||||||
(function_declaration) @local.scope
|
|
||||||
|
|
||||||
(method_definition) @local.scope
|
|
||||||
|
|
||||||
(for_statement) @local.scope
|
|
||||||
|
|
||||||
(for_in_statement) @local.scope
|
|
||||||
|
|
||||||
(catch_clause) @local.scope
|
|
||||||
|
|
||||||
; Definitions
|
|
||||||
;------------
|
|
||||||
(variable_declarator
|
|
||||||
name: (identifier) @local.definition.var)
|
|
||||||
|
|
||||||
(variable_declarator
|
|
||||||
name: (object_pattern
|
|
||||||
(shorthand_property_identifier_pattern) @local.definition.var))
|
|
||||||
|
|
||||||
(variable_declarator
|
|
||||||
(object_pattern
|
|
||||||
(pair_pattern
|
|
||||||
(identifier) @local.definition.var)))
|
|
||||||
|
|
||||||
(import_specifier
|
|
||||||
(identifier) @local.definition.import)
|
|
||||||
|
|
||||||
(namespace_import
|
|
||||||
(identifier) @local.definition.import)
|
|
||||||
|
|
||||||
(function_declaration
|
|
||||||
(identifier) @local.definition.function
|
|
||||||
(#set! definition.var.scope parent))
|
|
||||||
|
|
||||||
(method_definition
|
|
||||||
(property_identifier) @local.definition.function
|
|
||||||
(#set! definition.var.scope parent))
|
|
||||||
|
|
||||||
; References
|
|
||||||
;------------
|
|
||||||
(identifier) @local.reference
|
|
||||||
|
|
||||||
(shorthand_property_identifier) @local.reference
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
[
|
|
||||||
(import_declaration)
|
|
||||||
(const_declaration)
|
|
||||||
(var_declaration)
|
|
||||||
(type_declaration)
|
|
||||||
(func_literal)
|
|
||||||
(literal_value)
|
|
||||||
(expression_case)
|
|
||||||
(communication_case)
|
|
||||||
(type_case)
|
|
||||||
(default_case)
|
|
||||||
(block)
|
|
||||||
(call_expression)
|
|
||||||
(parameter_list)
|
|
||||||
(field_declaration_list)
|
|
||||||
(interface_type)
|
|
||||||
] @indent.begin
|
|
||||||
|
|
||||||
(literal_value
|
|
||||||
"}" @indent.branch)
|
|
||||||
|
|
||||||
(block
|
|
||||||
"}" @indent.branch)
|
|
||||||
|
|
||||||
(field_declaration_list
|
|
||||||
"}" @indent.branch)
|
|
||||||
|
|
||||||
(interface_type
|
|
||||||
"}" @indent.branch)
|
|
||||||
|
|
||||||
(const_declaration
|
|
||||||
")" @indent.branch)
|
|
||||||
|
|
||||||
(import_spec_list
|
|
||||||
")" @indent.branch)
|
|
||||||
|
|
||||||
(var_spec_list
|
|
||||||
")" @indent.branch)
|
|
||||||
|
|
||||||
[
|
|
||||||
"}"
|
|
||||||
")"
|
|
||||||
] @indent.end
|
|
||||||
|
|
||||||
(parameter_list
|
|
||||||
")" @indent.branch)
|
|
||||||
|
|
||||||
(comment) @indent.ignore
|
|
||||||
@@ -1,88 +0,0 @@
|
|||||||
((function_declaration
|
|
||||||
name: (identifier) @local.definition.function) ; @function
|
|
||||||
)
|
|
||||||
|
|
||||||
((method_declaration
|
|
||||||
name: (field_identifier) @local.definition.method) ; @function.method
|
|
||||||
)
|
|
||||||
|
|
||||||
(short_var_declaration
|
|
||||||
left: (expression_list
|
|
||||||
(identifier) @local.definition.var))
|
|
||||||
|
|
||||||
(var_spec
|
|
||||||
name: (identifier) @local.definition.var)
|
|
||||||
|
|
||||||
(parameter_declaration
|
|
||||||
(identifier) @local.definition.var)
|
|
||||||
|
|
||||||
(variadic_parameter_declaration
|
|
||||||
(identifier) @local.definition.var)
|
|
||||||
|
|
||||||
(for_statement
|
|
||||||
(range_clause
|
|
||||||
left: (expression_list
|
|
||||||
(identifier) @local.definition.var)))
|
|
||||||
|
|
||||||
(const_declaration
|
|
||||||
(const_spec
|
|
||||||
name: (identifier) @local.definition.var))
|
|
||||||
|
|
||||||
(type_declaration
|
|
||||||
(type_spec
|
|
||||||
name: (type_identifier) @local.definition.type))
|
|
||||||
|
|
||||||
; reference
|
|
||||||
(identifier) @local.reference
|
|
||||||
|
|
||||||
(type_identifier) @local.reference
|
|
||||||
|
|
||||||
(field_identifier) @local.reference
|
|
||||||
|
|
||||||
((package_identifier) @local.reference
|
|
||||||
(#set! reference.kind "namespace"))
|
|
||||||
|
|
||||||
(package_clause
|
|
||||||
(package_identifier) @local.definition.namespace)
|
|
||||||
|
|
||||||
(import_spec_list
|
|
||||||
(import_spec
|
|
||||||
name: (package_identifier) @local.definition.namespace))
|
|
||||||
|
|
||||||
; Call references
|
|
||||||
((call_expression
|
|
||||||
function: (identifier) @local.reference)
|
|
||||||
(#set! reference.kind "call"))
|
|
||||||
|
|
||||||
((call_expression
|
|
||||||
function: (selector_expression
|
|
||||||
field: (field_identifier) @local.reference))
|
|
||||||
(#set! reference.kind "call"))
|
|
||||||
|
|
||||||
((call_expression
|
|
||||||
function: (parenthesized_expression
|
|
||||||
(identifier) @local.reference))
|
|
||||||
(#set! reference.kind "call"))
|
|
||||||
|
|
||||||
((call_expression
|
|
||||||
function: (parenthesized_expression
|
|
||||||
(selector_expression
|
|
||||||
field: (field_identifier) @local.reference)))
|
|
||||||
(#set! reference.kind "call"))
|
|
||||||
|
|
||||||
; Scopes
|
|
||||||
(func_literal) @local.scope
|
|
||||||
|
|
||||||
(source_file) @local.scope
|
|
||||||
|
|
||||||
(function_declaration) @local.scope
|
|
||||||
|
|
||||||
(if_statement) @local.scope
|
|
||||||
|
|
||||||
(block) @local.scope
|
|
||||||
|
|
||||||
(expression_switch_statement) @local.scope
|
|
||||||
|
|
||||||
(for_statement) @local.scope
|
|
||||||
|
|
||||||
(method_declaration) @local.scope
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
[
|
|
||||||
(if_action)
|
|
||||||
(range_action)
|
|
||||||
(block_action)
|
|
||||||
(with_action)
|
|
||||||
(define_action)
|
|
||||||
] @local.scope
|
|
||||||
|
|
||||||
(variable_definition
|
|
||||||
variable: (variable) @local.definition.var)
|
|
||||||
|
|
||||||
(variable) @local.reference
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
; inherits: html_tags
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
(element) @local.scope
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
((element
|
|
||||||
(start_tag
|
|
||||||
(tag_name) @_not_void_element))
|
|
||||||
(#not-any-of? @_not_void_element
|
|
||||||
"area" "base" "basefont" "bgsound" "br" "col" "command" "embed" "frame" "hr" "image" "img"
|
|
||||||
"input" "isindex" "keygen" "link" "menuitem" "meta" "nextid" "param" "source" "track" "wbr")) @indent.begin
|
|
||||||
|
|
||||||
(element
|
|
||||||
(self_closing_tag)) @indent.begin
|
|
||||||
|
|
||||||
((start_tag
|
|
||||||
(tag_name) @_void_element)
|
|
||||||
(#any-of? @_void_element
|
|
||||||
"area" "base" "basefont" "bgsound" "br" "col" "command" "embed" "frame" "hr" "image" "img"
|
|
||||||
"input" "isindex" "keygen" "link" "menuitem" "meta" "nextid" "param" "source" "track" "wbr")) @indent.begin
|
|
||||||
|
|
||||||
; These are the nodes that will be captured when we do `normal o`
|
|
||||||
; But last element has already been ended, so capturing this
|
|
||||||
; to mark end of last element
|
|
||||||
(element
|
|
||||||
(end_tag
|
|
||||||
">" @indent.end))
|
|
||||||
|
|
||||||
(element
|
|
||||||
(self_closing_tag
|
|
||||||
"/>" @indent.end))
|
|
||||||
|
|
||||||
; Script/style elements aren't indented, so only branch the end tag of other elements
|
|
||||||
(element
|
|
||||||
(end_tag) @indent.branch)
|
|
||||||
|
|
||||||
[
|
|
||||||
">"
|
|
||||||
"/>"
|
|
||||||
] @indent.branch
|
|
||||||
|
|
||||||
(comment) @indent.ignore
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
[
|
|
||||||
(object)
|
|
||||||
(array)
|
|
||||||
] @indent.begin
|
|
||||||
|
|
||||||
[
|
|
||||||
"}"
|
|
||||||
"]"
|
|
||||||
] @indent.branch
|
|
||||||
|
|
||||||
(comment) @indent.ignore
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
[
|
|
||||||
(object)
|
|
||||||
(array)
|
|
||||||
] @local.scope
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
[
|
|
||||||
(jsx_element)
|
|
||||||
(jsx_self_closing_element)
|
|
||||||
(jsx_expression)
|
|
||||||
] @indent.begin
|
|
||||||
|
|
||||||
(jsx_closing_element
|
|
||||||
">" @indent.end)
|
|
||||||
|
|
||||||
(jsx_self_closing_element
|
|
||||||
"/>" @indent.end)
|
|
||||||
|
|
||||||
[
|
|
||||||
(jsx_closing_element)
|
|
||||||
">"
|
|
||||||
] @indent.branch
|
|
||||||
|
|
||||||
; <button
|
|
||||||
; />
|
|
||||||
(jsx_self_closing_element
|
|
||||||
"/>" @indent.branch)
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
; inherits: php_only
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
; inherits: php_only
|
|
||||||
@@ -1,68 +0,0 @@
|
|||||||
[
|
|
||||||
(array_creation_expression)
|
|
||||||
(parenthesized_expression)
|
|
||||||
(compound_statement)
|
|
||||||
(declaration_list)
|
|
||||||
(member_call_expression)
|
|
||||||
(binary_expression)
|
|
||||||
(return_statement)
|
|
||||||
(arguments)
|
|
||||||
(formal_parameters)
|
|
||||||
(enum_declaration_list)
|
|
||||||
(switch_block)
|
|
||||||
(match_block)
|
|
||||||
(case_statement)
|
|
||||||
(default_statement)
|
|
||||||
(property_hook_list)
|
|
||||||
] @indent.begin
|
|
||||||
|
|
||||||
(return_statement
|
|
||||||
[
|
|
||||||
(object_creation_expression)
|
|
||||||
(anonymous_function)
|
|
||||||
(arrow_function)
|
|
||||||
(match_expression)
|
|
||||||
]) @indent.dedent
|
|
||||||
|
|
||||||
[
|
|
||||||
")"
|
|
||||||
"}"
|
|
||||||
"]"
|
|
||||||
] @indent.branch
|
|
||||||
|
|
||||||
(comment) @indent.auto
|
|
||||||
|
|
||||||
(arguments
|
|
||||||
")" @indent.end)
|
|
||||||
|
|
||||||
(formal_parameters
|
|
||||||
")" @indent.end)
|
|
||||||
|
|
||||||
(compound_statement
|
|
||||||
"}" @indent.end)
|
|
||||||
|
|
||||||
(declaration_list
|
|
||||||
"}" @indent.end)
|
|
||||||
|
|
||||||
(enum_declaration_list
|
|
||||||
"}" @indent.end)
|
|
||||||
|
|
||||||
(return_statement
|
|
||||||
";" @indent.end)
|
|
||||||
|
|
||||||
(property_hook_list
|
|
||||||
"}" @indent.end)
|
|
||||||
|
|
||||||
(ERROR
|
|
||||||
"(" @indent.align
|
|
||||||
.
|
|
||||||
(_)
|
|
||||||
(#set! indent.open_delimiter "(")
|
|
||||||
(#set! indent.close_delimiter ")"))
|
|
||||||
|
|
||||||
(ERROR
|
|
||||||
"[" @indent.align
|
|
||||||
.
|
|
||||||
(_)
|
|
||||||
(#set! indent.open_delimiter "[")
|
|
||||||
(#set! indent.close_delimiter "]"))
|
|
||||||
@@ -1,84 +0,0 @@
|
|||||||
; Scopes
|
|
||||||
;-------
|
|
||||||
((class_declaration
|
|
||||||
name: (name) @local.definition.type) @local.scope
|
|
||||||
(#set! definition.type.scope "parent"))
|
|
||||||
|
|
||||||
((method_declaration
|
|
||||||
name: (name) @local.definition.method) @local.scope
|
|
||||||
(#set! definition.method.scope "parent"))
|
|
||||||
|
|
||||||
((function_definition
|
|
||||||
name: (name) @local.definition.function) @local.scope
|
|
||||||
(#set! definition.function.scope "parent"))
|
|
||||||
|
|
||||||
(anonymous_function
|
|
||||||
(anonymous_function_use_clause
|
|
||||||
(variable_name
|
|
||||||
(name) @local.definition.var))) @local.scope
|
|
||||||
|
|
||||||
; Definitions
|
|
||||||
;------------
|
|
||||||
(simple_parameter
|
|
||||||
(variable_name
|
|
||||||
(name) @local.definition.var))
|
|
||||||
|
|
||||||
(foreach_statement
|
|
||||||
(pair
|
|
||||||
(variable_name
|
|
||||||
(name) @local.definition.var)))
|
|
||||||
|
|
||||||
(foreach_statement
|
|
||||||
(variable_name
|
|
||||||
(name) @local.reference
|
|
||||||
(#set! reference.kind "var"))
|
|
||||||
(variable_name
|
|
||||||
(name) @local.definition.var))
|
|
||||||
|
|
||||||
(property_declaration
|
|
||||||
(property_element
|
|
||||||
(variable_name
|
|
||||||
(name) @local.definition.field)))
|
|
||||||
|
|
||||||
(namespace_use_clause
|
|
||||||
(qualified_name
|
|
||||||
(name) @local.definition.type))
|
|
||||||
|
|
||||||
; References
|
|
||||||
;------------
|
|
||||||
(named_type
|
|
||||||
(name) @local.reference
|
|
||||||
(#set! reference.kind "type"))
|
|
||||||
|
|
||||||
(named_type
|
|
||||||
(qualified_name) @local.reference
|
|
||||||
(#set! reference.kind "type"))
|
|
||||||
|
|
||||||
(variable_name
|
|
||||||
(name) @local.reference
|
|
||||||
(#set! reference.kind "var"))
|
|
||||||
|
|
||||||
(member_access_expression
|
|
||||||
name: (name) @local.reference
|
|
||||||
(#set! reference.kind "field"))
|
|
||||||
|
|
||||||
(member_call_expression
|
|
||||||
name: (name) @local.reference
|
|
||||||
(#set! reference.kind "method"))
|
|
||||||
|
|
||||||
(function_call_expression
|
|
||||||
function: (qualified_name
|
|
||||||
(name) @local.reference
|
|
||||||
(#set! reference.kind "function")))
|
|
||||||
|
|
||||||
(object_creation_expression
|
|
||||||
(qualified_name
|
|
||||||
(name) @local.reference
|
|
||||||
(#set! reference.kind "type")))
|
|
||||||
|
|
||||||
(scoped_call_expression
|
|
||||||
scope: (qualified_name
|
|
||||||
(name) @local.reference
|
|
||||||
(#set! reference.kind "type"))
|
|
||||||
name: (name) @local.reference
|
|
||||||
(#set! reference.kind "method"))
|
|
||||||
@@ -1,216 +0,0 @@
|
|||||||
; Modified from nvim-treesitter (https://github.com/nvim-treesitter/nvim-treesitter)
|
|
||||||
; Modifications Copyright 2026 Oscar Wallberg
|
|
||||||
; Licensed under Apache-2.0
|
|
||||||
|
|
||||||
[
|
|
||||||
(import_from_statement)
|
|
||||||
(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 "}"))
|
|
||||||
|
|
||||||
((parenthesized_expression) @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"
|
|
||||||
.
|
|
||||||
":"
|
|
||||||
(#set! indent.immediate 1)) @indent.begin
|
|
||||||
|
|
||||||
(ERROR
|
|
||||||
"try"
|
|
||||||
.
|
|
||||||
":"
|
|
||||||
(ERROR
|
|
||||||
(block
|
|
||||||
(identifier) @_except @indent.branch))
|
|
||||||
(#eq? @_except "except"))
|
|
||||||
|
|
||||||
((function_definition) @indent.begin
|
|
||||||
(#set! indent.immediate 1))
|
|
||||||
|
|
||||||
((class_definition) @indent.begin
|
|
||||||
(#set! indent.immediate 1))
|
|
||||||
|
|
||||||
((with_statement) @indent.begin
|
|
||||||
(#set! indent.immediate 1))
|
|
||||||
|
|
||||||
((match_statement) @indent.begin
|
|
||||||
(#set! indent.immediate 1))
|
|
||||||
|
|
||||||
((case_clause) @indent.begin
|
|
||||||
(#set! indent.immediate 1))
|
|
||||||
|
|
||||||
; if (cond1
|
|
||||||
; or cond2
|
|
||||||
; or cond3):
|
|
||||||
; pass
|
|
||||||
;
|
|
||||||
(if_statement
|
|
||||||
condition: (parenthesized_expression) @indent.align
|
|
||||||
(#lua-match? @indent.align "^%([^\n]")
|
|
||||||
(#set! indent.open_delimiter "(")
|
|
||||||
(#set! indent.close_delimiter ")")
|
|
||||||
(#set! indent.avoid_last_matching_next 1))
|
|
||||||
|
|
||||||
; while (
|
|
||||||
; cond1
|
|
||||||
; or cond2
|
|
||||||
; or cond3):
|
|
||||||
; pass
|
|
||||||
;
|
|
||||||
(while_statement
|
|
||||||
condition: (parenthesized_expression) @indent.align
|
|
||||||
(#lua-match? @indent.align "[^\n ]%)$")
|
|
||||||
(#set! indent.open_delimiter "(")
|
|
||||||
(#set! indent.close_delimiter ")")
|
|
||||||
(#set! indent.avoid_last_matching_next 1))
|
|
||||||
|
|
||||||
; if (
|
|
||||||
; cond1
|
|
||||||
; or cond2
|
|
||||||
; or cond3):
|
|
||||||
; pass
|
|
||||||
;
|
|
||||||
(if_statement
|
|
||||||
condition: (parenthesized_expression) @indent.align
|
|
||||||
(#lua-match? @indent.align "[^\n ]%)$")
|
|
||||||
(#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 ")"))
|
|
||||||
|
|
||||||
((parameters) @indent.align
|
|
||||||
(#lua-match? @indent.align "[^\n ]%)$")
|
|
||||||
(#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"))
|
|
||||||
|
|
||||||
(generator_expression
|
|
||||||
")" @indent.end)
|
|
||||||
|
|
||||||
(list_comprehension
|
|
||||||
"]" @indent.end)
|
|
||||||
|
|
||||||
(set_comprehension
|
|
||||||
"}" @indent.end)
|
|
||||||
|
|
||||||
(dictionary_comprehension
|
|
||||||
"}" @indent.end)
|
|
||||||
|
|
||||||
(tuple_pattern
|
|
||||||
")" @indent.end)
|
|
||||||
|
|
||||||
(list_pattern
|
|
||||||
"]" @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
|
|
||||||
@@ -1,124 +0,0 @@
|
|||||||
; Program structure
|
|
||||||
(module) @local.scope
|
|
||||||
|
|
||||||
(class_definition
|
|
||||||
body: (block
|
|
||||||
(expression_statement
|
|
||||||
(assignment
|
|
||||||
left: (identifier) @local.definition.field)))) @local.scope
|
|
||||||
|
|
||||||
(class_definition
|
|
||||||
body: (block
|
|
||||||
(expression_statement
|
|
||||||
(assignment
|
|
||||||
left: (_
|
|
||||||
(identifier) @local.definition.field))))) @local.scope
|
|
||||||
|
|
||||||
; Imports
|
|
||||||
(aliased_import
|
|
||||||
alias: (identifier) @local.definition.import) @local.scope
|
|
||||||
|
|
||||||
(import_statement
|
|
||||||
name: (dotted_name
|
|
||||||
(identifier) @local.definition.import)) @local.scope
|
|
||||||
|
|
||||||
(import_from_statement
|
|
||||||
name: (dotted_name
|
|
||||||
(identifier) @local.definition.import)) @local.scope
|
|
||||||
|
|
||||||
; Function with parameters, defines parameters
|
|
||||||
(parameters
|
|
||||||
(identifier) @local.definition.parameter)
|
|
||||||
|
|
||||||
(default_parameter
|
|
||||||
(identifier) @local.definition.parameter)
|
|
||||||
|
|
||||||
(typed_parameter
|
|
||||||
(identifier) @local.definition.parameter)
|
|
||||||
|
|
||||||
(typed_default_parameter
|
|
||||||
(identifier) @local.definition.parameter)
|
|
||||||
|
|
||||||
; *args parameter
|
|
||||||
(parameters
|
|
||||||
(list_splat_pattern
|
|
||||||
(identifier) @local.definition.parameter))
|
|
||||||
|
|
||||||
; **kwargs parameter
|
|
||||||
(parameters
|
|
||||||
(dictionary_splat_pattern
|
|
||||||
(identifier) @local.definition.parameter))
|
|
||||||
|
|
||||||
; Function defines function and scope
|
|
||||||
((function_definition
|
|
||||||
name: (identifier) @local.definition.function) @local.scope
|
|
||||||
(#set! definition.function.scope "parent"))
|
|
||||||
|
|
||||||
((class_definition
|
|
||||||
name: (identifier) @local.definition.type) @local.scope
|
|
||||||
(#set! definition.type.scope "parent"))
|
|
||||||
|
|
||||||
(class_definition
|
|
||||||
body: (block
|
|
||||||
(function_definition
|
|
||||||
name: (identifier) @local.definition.method)))
|
|
||||||
|
|
||||||
; Loops
|
|
||||||
; not a scope!
|
|
||||||
(for_statement
|
|
||||||
left: (pattern_list
|
|
||||||
(identifier) @local.definition.var))
|
|
||||||
|
|
||||||
(for_statement
|
|
||||||
left: (tuple_pattern
|
|
||||||
(identifier) @local.definition.var))
|
|
||||||
|
|
||||||
(for_statement
|
|
||||||
left: (identifier) @local.definition.var)
|
|
||||||
|
|
||||||
; not a scope!
|
|
||||||
;(while_statement) @local.scope
|
|
||||||
; for in list comprehension
|
|
||||||
(for_in_clause
|
|
||||||
left: (identifier) @local.definition.var)
|
|
||||||
|
|
||||||
(for_in_clause
|
|
||||||
left: (tuple_pattern
|
|
||||||
(identifier) @local.definition.var))
|
|
||||||
|
|
||||||
(for_in_clause
|
|
||||||
left: (pattern_list
|
|
||||||
(identifier) @local.definition.var))
|
|
||||||
|
|
||||||
(dictionary_comprehension) @local.scope
|
|
||||||
|
|
||||||
(list_comprehension) @local.scope
|
|
||||||
|
|
||||||
(set_comprehension) @local.scope
|
|
||||||
|
|
||||||
; Assignments
|
|
||||||
(assignment
|
|
||||||
left: (identifier) @local.definition.var)
|
|
||||||
|
|
||||||
(assignment
|
|
||||||
left: (pattern_list
|
|
||||||
(identifier) @local.definition.var))
|
|
||||||
|
|
||||||
(assignment
|
|
||||||
left: (tuple_pattern
|
|
||||||
(identifier) @local.definition.var))
|
|
||||||
|
|
||||||
(assignment
|
|
||||||
left: (attribute
|
|
||||||
(identifier)
|
|
||||||
(identifier) @local.definition.field))
|
|
||||||
|
|
||||||
; Walrus operator x := 1
|
|
||||||
(named_expression
|
|
||||||
(identifier) @local.definition.var)
|
|
||||||
|
|
||||||
(as_pattern
|
|
||||||
alias: (as_pattern_target) @local.definition.var)
|
|
||||||
|
|
||||||
; REFERENCES
|
|
||||||
(identifier) @local.reference
|
|
||||||
@@ -1,133 +0,0 @@
|
|||||||
[
|
|
||||||
(mod_item)
|
|
||||||
(struct_item)
|
|
||||||
(enum_item)
|
|
||||||
(impl_item)
|
|
||||||
(struct_expression)
|
|
||||||
(struct_pattern)
|
|
||||||
(tuple_struct_pattern)
|
|
||||||
(tuple_expression)
|
|
||||||
(tuple_type)
|
|
||||||
(tuple_pattern)
|
|
||||||
(match_block)
|
|
||||||
(call_expression)
|
|
||||||
(assignment_expression)
|
|
||||||
(arguments)
|
|
||||||
(block)
|
|
||||||
(where_clause)
|
|
||||||
(use_list)
|
|
||||||
(array_expression)
|
|
||||||
(ordered_field_declaration_list)
|
|
||||||
(field_declaration_list)
|
|
||||||
(enum_variant_list)
|
|
||||||
(parameters)
|
|
||||||
(token_tree)
|
|
||||||
(token_repetition)
|
|
||||||
(macro_definition)
|
|
||||||
] @indent.begin
|
|
||||||
|
|
||||||
(trait_item
|
|
||||||
body: (_) @indent.begin)
|
|
||||||
|
|
||||||
(string_literal
|
|
||||||
(escape_sequence)) @indent.begin
|
|
||||||
|
|
||||||
; Typing in "(" inside macro definitions breaks the tree entirely
|
|
||||||
; Making macro_definition becoming errors
|
|
||||||
; Offset this by adding back one indent for start of macro rules
|
|
||||||
(ERROR
|
|
||||||
.
|
|
||||||
"macro_rules!"
|
|
||||||
[
|
|
||||||
"("
|
|
||||||
"{"
|
|
||||||
"["
|
|
||||||
] @indent.begin
|
|
||||||
(#set! indent.immediate)
|
|
||||||
(#set! indent.start_at_same_line))
|
|
||||||
|
|
||||||
(macro_definition
|
|
||||||
[
|
|
||||||
")"
|
|
||||||
"}"
|
|
||||||
"]"
|
|
||||||
] @indent.end)
|
|
||||||
|
|
||||||
(trait_item
|
|
||||||
body: (_) @indent.begin)
|
|
||||||
|
|
||||||
(string_literal
|
|
||||||
(escape_sequence)) @indent.begin
|
|
||||||
|
|
||||||
(block
|
|
||||||
"}" @indent.end)
|
|
||||||
|
|
||||||
(enum_item
|
|
||||||
body: (enum_variant_list
|
|
||||||
"}" @indent.end))
|
|
||||||
|
|
||||||
(impl_item
|
|
||||||
body: (declaration_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))
|
|
||||||
|
|
||||||
(struct_expression
|
|
||||||
body: (field_initializer_list
|
|
||||||
"}" @indent.end))
|
|
||||||
|
|
||||||
(struct_pattern
|
|
||||||
"}" @indent.end)
|
|
||||||
|
|
||||||
(tuple_struct_pattern
|
|
||||||
")" @indent.end)
|
|
||||||
|
|
||||||
; Typing in "(" inside macro definitions breaks the tree entirely
|
|
||||||
; Making macro_definition becoming errors
|
|
||||||
; Offset this by adding back one indent for start of macro rules
|
|
||||||
(ERROR
|
|
||||||
.
|
|
||||||
"macro_rules!"
|
|
||||||
"(" @indent.begin
|
|
||||||
(#set! indent.immediate)
|
|
||||||
(#set! indent.start_at_same_line))
|
|
||||||
|
|
||||||
(tuple_type
|
|
||||||
")" @indent.end)
|
|
||||||
|
|
||||||
(tuple_pattern
|
|
||||||
")" @indent.end)
|
|
||||||
|
|
||||||
(trait_item
|
|
||||||
body: (declaration_list
|
|
||||||
"}" @indent.end))
|
|
||||||
|
|
||||||
(impl_item
|
|
||||||
(where_clause) @indent.dedent)
|
|
||||||
|
|
||||||
[
|
|
||||||
"where"
|
|
||||||
")"
|
|
||||||
"]"
|
|
||||||
"}"
|
|
||||||
] @indent.branch
|
|
||||||
|
|
||||||
(impl_item
|
|
||||||
(declaration_list) @indent.branch)
|
|
||||||
|
|
||||||
[
|
|
||||||
(line_comment)
|
|
||||||
(string_literal)
|
|
||||||
] @indent.ignore
|
|
||||||
|
|
||||||
(raw_string_literal) @indent.auto
|
|
||||||
@@ -1,98 +0,0 @@
|
|||||||
; Imports
|
|
||||||
(extern_crate_declaration
|
|
||||||
name: (identifier) @local.definition.import)
|
|
||||||
|
|
||||||
(use_declaration
|
|
||||||
argument: (scoped_identifier
|
|
||||||
name: (identifier) @local.definition.import))
|
|
||||||
|
|
||||||
(use_as_clause
|
|
||||||
alias: (identifier) @local.definition.import)
|
|
||||||
|
|
||||||
(use_list
|
|
||||||
(identifier) @local.definition.import) ; use std::process::{Child, Command, Stdio};
|
|
||||||
|
|
||||||
; Functions
|
|
||||||
(function_item
|
|
||||||
name: (identifier) @local.definition.function)
|
|
||||||
|
|
||||||
(function_item
|
|
||||||
name: (identifier) @local.definition.method
|
|
||||||
parameters: (parameters
|
|
||||||
(self_parameter)))
|
|
||||||
|
|
||||||
; Variables
|
|
||||||
(parameter
|
|
||||||
pattern: (identifier) @local.definition.var)
|
|
||||||
|
|
||||||
(let_declaration
|
|
||||||
pattern: (identifier) @local.definition.var)
|
|
||||||
|
|
||||||
(const_item
|
|
||||||
name: (identifier) @local.definition.var)
|
|
||||||
|
|
||||||
(tuple_pattern
|
|
||||||
(identifier) @local.definition.var)
|
|
||||||
|
|
||||||
(let_condition
|
|
||||||
pattern: (_
|
|
||||||
(identifier) @local.definition.var))
|
|
||||||
|
|
||||||
(tuple_struct_pattern
|
|
||||||
(identifier) @local.definition.var)
|
|
||||||
|
|
||||||
(closure_parameters
|
|
||||||
(identifier) @local.definition.var)
|
|
||||||
|
|
||||||
(self_parameter
|
|
||||||
(self) @local.definition.var)
|
|
||||||
|
|
||||||
(for_expression
|
|
||||||
pattern: (identifier) @local.definition.var)
|
|
||||||
|
|
||||||
; Types
|
|
||||||
(struct_item
|
|
||||||
name: (type_identifier) @local.definition.type)
|
|
||||||
|
|
||||||
(enum_item
|
|
||||||
name: (type_identifier) @local.definition.type)
|
|
||||||
|
|
||||||
; Fields
|
|
||||||
(field_declaration
|
|
||||||
name: (field_identifier) @local.definition.field)
|
|
||||||
|
|
||||||
(enum_variant
|
|
||||||
name: (identifier) @local.definition.field)
|
|
||||||
|
|
||||||
; References
|
|
||||||
(identifier) @local.reference
|
|
||||||
|
|
||||||
((type_identifier) @local.reference
|
|
||||||
(#set! reference.kind "type"))
|
|
||||||
|
|
||||||
((field_identifier) @local.reference
|
|
||||||
(#set! reference.kind "field"))
|
|
||||||
|
|
||||||
; Macros
|
|
||||||
(macro_definition
|
|
||||||
name: (identifier) @local.definition.macro)
|
|
||||||
|
|
||||||
; Module
|
|
||||||
(mod_item
|
|
||||||
name: (identifier) @local.definition.namespace)
|
|
||||||
|
|
||||||
; Scopes
|
|
||||||
[
|
|
||||||
(block)
|
|
||||||
(function_item)
|
|
||||||
(closure_expression)
|
|
||||||
(while_expression)
|
|
||||||
(for_expression)
|
|
||||||
(loop_expression)
|
|
||||||
(if_expression)
|
|
||||||
(match_expression)
|
|
||||||
(match_arm)
|
|
||||||
(struct_item)
|
|
||||||
(enum_item)
|
|
||||||
(impl_item)
|
|
||||||
] @local.scope
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
; inherits: css
|
|
||||||
|
|
||||||
[
|
|
||||||
(mixin_statement)
|
|
||||||
(while_statement)
|
|
||||||
(each_statement)
|
|
||||||
] @indent.begin
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
[
|
|
||||||
(select)
|
|
||||||
(cte)
|
|
||||||
(column_definitions)
|
|
||||||
(case)
|
|
||||||
(subquery)
|
|
||||||
(insert)
|
|
||||||
(when_clause)
|
|
||||||
] @indent.begin
|
|
||||||
|
|
||||||
(block
|
|
||||||
(keyword_begin)) @indent.begin
|
|
||||||
|
|
||||||
(column_definitions
|
|
||||||
")" @indent.branch)
|
|
||||||
|
|
||||||
(subquery
|
|
||||||
")" @indent.branch)
|
|
||||||
|
|
||||||
(cte
|
|
||||||
")" @indent.branch)
|
|
||||||
|
|
||||||
[
|
|
||||||
(keyword_end)
|
|
||||||
(keyword_values)
|
|
||||||
(keyword_into)
|
|
||||||
] @indent.branch
|
|
||||||
|
|
||||||
(keyword_end) @indent.end
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
; inherits: html
|
|
||||||
|
|
||||||
[
|
|
||||||
(if_statement)
|
|
||||||
(each_statement)
|
|
||||||
(await_statement)
|
|
||||||
(key_statement)
|
|
||||||
(snippet_statement)
|
|
||||||
] @indent.begin
|
|
||||||
|
|
||||||
(if_end
|
|
||||||
"}" @indent.end)
|
|
||||||
|
|
||||||
(each_end
|
|
||||||
"}" @indent.end)
|
|
||||||
|
|
||||||
(await_end
|
|
||||||
"}" @indent.end)
|
|
||||||
|
|
||||||
(key_end
|
|
||||||
"}" @indent.end)
|
|
||||||
|
|
||||||
(snippet_end
|
|
||||||
"}" @indent.end)
|
|
||||||
|
|
||||||
[
|
|
||||||
(if_end)
|
|
||||||
(else_if_block)
|
|
||||||
(else_block)
|
|
||||||
(each_end)
|
|
||||||
(await_end)
|
|
||||||
(key_end)
|
|
||||||
(snippet_end)
|
|
||||||
] @indent.branch
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
; inherits: html
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
; inherits: ecma
|
|
||||||
|
|
||||||
[
|
|
||||||
(enum_declaration)
|
|
||||||
(interface_declaration)
|
|
||||||
(object_type)
|
|
||||||
] @indent.begin
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
; inherits: ecma
|
|
||||||
|
|
||||||
(required_parameter
|
|
||||||
(identifier) @local.definition)
|
|
||||||
|
|
||||||
(optional_parameter
|
|
||||||
(identifier) @local.definition)
|
|
||||||
|
|
||||||
; x => x
|
|
||||||
(arrow_function
|
|
||||||
parameter: (identifier) @local.definition.parameter)
|
|
||||||
|
|
||||||
; ({ a }) => null
|
|
||||||
(required_parameter
|
|
||||||
(object_pattern
|
|
||||||
(shorthand_property_identifier_pattern) @local.definition.parameter))
|
|
||||||
|
|
||||||
; ({ a: b }) => null
|
|
||||||
(required_parameter
|
|
||||||
(object_pattern
|
|
||||||
(pair_pattern
|
|
||||||
value: (identifier) @local.definition.parameter)))
|
|
||||||
|
|
||||||
; ([ a ]) => null
|
|
||||||
(required_parameter
|
|
||||||
(array_pattern
|
|
||||||
(identifier) @local.definition.parameter))
|
|
||||||
|
|
||||||
(required_parameter
|
|
||||||
(rest_pattern
|
|
||||||
(identifier) @local.definition.parameter))
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
(element) @indent.begin
|
|
||||||
|
|
||||||
[
|
|
||||||
(Attribute)
|
|
||||||
(AttlistDecl)
|
|
||||||
(contentspec)
|
|
||||||
] @indent.align
|
|
||||||
|
|
||||||
(ETag) @indent.branch
|
|
||||||
|
|
||||||
(doctypedecl) @indent.ignore
|
|
||||||
|
|
||||||
[
|
|
||||||
(Comment)
|
|
||||||
(ERROR)
|
|
||||||
] @indent.auto
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
; tags
|
|
||||||
(elementdecl
|
|
||||||
(Name) @local.definition.type)
|
|
||||||
|
|
||||||
(elementdecl
|
|
||||||
(contentspec
|
|
||||||
(children
|
|
||||||
(Name) @local.reference)))
|
|
||||||
|
|
||||||
(AttlistDecl
|
|
||||||
.
|
|
||||||
(Name) @local.reference)
|
|
||||||
|
|
||||||
(STag
|
|
||||||
(Name) @local.reference)
|
|
||||||
|
|
||||||
(ETag
|
|
||||||
(Name) @local.reference)
|
|
||||||
|
|
||||||
(EmptyElemTag
|
|
||||||
(Name) @local.reference)
|
|
||||||
|
|
||||||
; attributes
|
|
||||||
(AttDef
|
|
||||||
(Name) @local.definition.field)
|
|
||||||
|
|
||||||
(Attribute
|
|
||||||
(Name) @local.reference)
|
|
||||||
|
|
||||||
; entities
|
|
||||||
(GEDecl
|
|
||||||
(Name) @local.definition.macro)
|
|
||||||
|
|
||||||
(EntityRef
|
|
||||||
(Name) @local.reference)
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
[
|
|
||||||
(block_mapping_pair
|
|
||||||
value: (block_node))
|
|
||||||
(block_sequence_item)
|
|
||||||
] @indent.begin
|
|
||||||
|
|
||||||
(ERROR) @indent.auto
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
[
|
|
||||||
(stream)
|
|
||||||
(document)
|
|
||||||
(block_node)
|
|
||||||
] @local.scope
|
|
||||||
|
|
||||||
(anchor_name) @local.definition
|
|
||||||
|
|
||||||
(alias_name) @local.reference
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
; Scopes
|
|
||||||
(function_definition) @local.scope
|
|
||||||
|
|
||||||
; Definitions
|
|
||||||
(variable_assignment
|
|
||||||
name: (variable_name) @local.definition.var)
|
|
||||||
|
|
||||||
(function_definition
|
|
||||||
name: (word) @local.definition.function)
|
|
||||||
|
|
||||||
; References
|
|
||||||
(variable_name) @local.reference
|
|
||||||
|
|
||||||
(word) @local.reference
|
|
||||||
Reference in New Issue
Block a user