mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-18 11:20:07 -04:00
refactor(format): drop extra indentation for field
This commit is contained in:
parent
c28396de30
commit
722617e672
140 changed files with 2146 additions and 2766 deletions
|
|
@ -55,27 +55,23 @@
|
|||
function: (identifier) @function.call)
|
||||
|
||||
(call_expression
|
||||
function:
|
||||
(scoped_identifier
|
||||
(identifier) @function.call .))
|
||||
function: (scoped_identifier
|
||||
(identifier) @function.call .))
|
||||
|
||||
(call_expression
|
||||
function:
|
||||
(field_expression
|
||||
field: (field_identifier) @function.call))
|
||||
function: (field_expression
|
||||
field: (field_identifier) @function.call))
|
||||
|
||||
(generic_function
|
||||
function: (identifier) @function.call)
|
||||
|
||||
(generic_function
|
||||
function:
|
||||
(scoped_identifier
|
||||
name: (identifier) @function.call))
|
||||
function: (scoped_identifier
|
||||
name: (identifier) @function.call))
|
||||
|
||||
(generic_function
|
||||
function:
|
||||
(field_expression
|
||||
field: (field_identifier) @function.call))
|
||||
function: (field_expression
|
||||
field: (field_identifier) @function.call))
|
||||
|
||||
; Assume other uppercase names are enum constructors
|
||||
((field_identifier) @constant
|
||||
|
|
@ -136,9 +132,8 @@
|
|||
path: (identifier) @module)
|
||||
|
||||
(scoped_use_list
|
||||
path:
|
||||
(scoped_identifier
|
||||
(identifier) @module))
|
||||
path: (scoped_identifier
|
||||
(identifier) @module))
|
||||
|
||||
(use_list
|
||||
(scoped_identifier
|
||||
|
|
@ -156,24 +151,21 @@
|
|||
|
||||
; Correct enum constructors
|
||||
(call_expression
|
||||
function:
|
||||
(scoped_identifier
|
||||
"::"
|
||||
name: (identifier) @constant)
|
||||
function: (scoped_identifier
|
||||
"::"
|
||||
name: (identifier) @constant)
|
||||
(#lua-match? @constant "^[A-Z]"))
|
||||
|
||||
; Assume uppercase names in a match arm are constants.
|
||||
((match_arm
|
||||
pattern:
|
||||
(match_pattern
|
||||
(identifier) @constant))
|
||||
pattern: (match_pattern
|
||||
(identifier) @constant))
|
||||
(#lua-match? @constant "^[A-Z]"))
|
||||
|
||||
((match_arm
|
||||
pattern:
|
||||
(match_pattern
|
||||
(scoped_identifier
|
||||
name: (identifier) @constant)))
|
||||
pattern: (match_pattern
|
||||
(scoped_identifier
|
||||
name: (identifier) @constant)))
|
||||
(#lua-match? @constant "^[A-Z]"))
|
||||
|
||||
((identifier) @constant.builtin
|
||||
|
|
@ -210,9 +202,8 @@
|
|||
macro: (identifier) @function.macro)
|
||||
|
||||
(macro_invocation
|
||||
macro:
|
||||
(scoped_identifier
|
||||
(identifier) @function.macro .))
|
||||
macro: (scoped_identifier
|
||||
(identifier) @function.macro .))
|
||||
|
||||
; Literals
|
||||
[
|
||||
|
|
|
|||
|
|
@ -55,42 +55,35 @@
|
|||
"}" @indent.end)
|
||||
|
||||
(enum_item
|
||||
body:
|
||||
(enum_variant_list
|
||||
"}" @indent.end))
|
||||
body: (enum_variant_list
|
||||
"}" @indent.end))
|
||||
|
||||
(impl_item
|
||||
body:
|
||||
(declaration_list
|
||||
"}" @indent.end))
|
||||
body: (declaration_list
|
||||
"}" @indent.end))
|
||||
|
||||
(match_expression
|
||||
body:
|
||||
(match_block
|
||||
"}" @indent.end))
|
||||
body: (match_block
|
||||
"}" @indent.end))
|
||||
|
||||
(mod_item
|
||||
body:
|
||||
(declaration_list
|
||||
"}" @indent.end))
|
||||
body: (declaration_list
|
||||
"}" @indent.end))
|
||||
|
||||
(struct_item
|
||||
body:
|
||||
(field_declaration_list
|
||||
"}" @indent.end))
|
||||
body: (field_declaration_list
|
||||
"}" @indent.end))
|
||||
|
||||
(struct_expression
|
||||
body:
|
||||
(field_initializer_list
|
||||
"}" @indent.end))
|
||||
body: (field_initializer_list
|
||||
"}" @indent.end))
|
||||
|
||||
(struct_pattern
|
||||
"}" @indent.end)
|
||||
|
||||
(trait_item
|
||||
body:
|
||||
(declaration_list
|
||||
"}" @indent.end))
|
||||
body: (declaration_list
|
||||
"}" @indent.end))
|
||||
|
||||
(impl_item
|
||||
(where_clause) @indent.dedent)
|
||||
|
|
|
|||
|
|
@ -1,22 +1,20 @@
|
|||
(macro_invocation
|
||||
macro:
|
||||
[
|
||||
(scoped_identifier
|
||||
name: (_) @_macro_name)
|
||||
(identifier) @_macro_name
|
||||
]
|
||||
macro: [
|
||||
(scoped_identifier
|
||||
name: (_) @_macro_name)
|
||||
(identifier) @_macro_name
|
||||
]
|
||||
(token_tree) @injection.content
|
||||
(#not-eq? @_macro_name "slint")
|
||||
(#set! injection.language "rust")
|
||||
(#set! injection.include-children))
|
||||
|
||||
(macro_invocation
|
||||
macro:
|
||||
[
|
||||
(scoped_identifier
|
||||
name: (_) @_macro_name)
|
||||
(identifier) @_macro_name
|
||||
]
|
||||
macro: [
|
||||
(scoped_identifier
|
||||
name: (_) @_macro_name)
|
||||
(identifier) @_macro_name
|
||||
]
|
||||
(token_tree) @injection.content
|
||||
(#eq? @_macro_name "slint")
|
||||
(#offset! @injection.content 0 1 0 -1)
|
||||
|
|
@ -45,57 +43,47 @@
|
|||
(#any-of? @injection.language "html" "json"))
|
||||
|
||||
(call_expression
|
||||
function:
|
||||
(scoped_identifier
|
||||
path: (identifier) @_regex
|
||||
(#any-of? @_regex "Regex" "ByteRegexBuilder")
|
||||
name: (identifier) @_new
|
||||
(#eq? @_new "new"))
|
||||
arguments:
|
||||
(arguments
|
||||
(raw_string_literal) @injection.content)
|
||||
function: (scoped_identifier
|
||||
path: (identifier) @_regex
|
||||
(#any-of? @_regex "Regex" "ByteRegexBuilder")
|
||||
name: (identifier) @_new
|
||||
(#eq? @_new "new"))
|
||||
arguments: (arguments
|
||||
(raw_string_literal) @injection.content)
|
||||
(#set! injection.language "regex"))
|
||||
|
||||
(call_expression
|
||||
function:
|
||||
(scoped_identifier
|
||||
path:
|
||||
(scoped_identifier
|
||||
(identifier) @_regex
|
||||
(#any-of? @_regex "Regex" "ByteRegexBuilder") .)
|
||||
name: (identifier) @_new
|
||||
(#eq? @_new "new"))
|
||||
arguments:
|
||||
(arguments
|
||||
(raw_string_literal) @injection.content)
|
||||
function: (scoped_identifier
|
||||
path: (scoped_identifier
|
||||
(identifier) @_regex
|
||||
(#any-of? @_regex "Regex" "ByteRegexBuilder") .)
|
||||
name: (identifier) @_new
|
||||
(#eq? @_new "new"))
|
||||
arguments: (arguments
|
||||
(raw_string_literal) @injection.content)
|
||||
(#set! injection.language "regex"))
|
||||
|
||||
(call_expression
|
||||
function:
|
||||
(scoped_identifier
|
||||
path: (identifier) @_regex
|
||||
(#any-of? @_regex "RegexSet" "RegexSetBuilder")
|
||||
name: (identifier) @_new
|
||||
(#eq? @_new "new"))
|
||||
arguments:
|
||||
(arguments
|
||||
(array_expression
|
||||
(raw_string_literal) @injection.content))
|
||||
function: (scoped_identifier
|
||||
path: (identifier) @_regex
|
||||
(#any-of? @_regex "RegexSet" "RegexSetBuilder")
|
||||
name: (identifier) @_new
|
||||
(#eq? @_new "new"))
|
||||
arguments: (arguments
|
||||
(array_expression
|
||||
(raw_string_literal) @injection.content))
|
||||
(#set! injection.language "regex"))
|
||||
|
||||
(call_expression
|
||||
function:
|
||||
(scoped_identifier
|
||||
path:
|
||||
(scoped_identifier
|
||||
(identifier) @_regex
|
||||
(#any-of? @_regex "RegexSet" "RegexSetBuilder") .)
|
||||
name: (identifier) @_new
|
||||
(#eq? @_new "new"))
|
||||
arguments:
|
||||
(arguments
|
||||
(array_expression
|
||||
(raw_string_literal) @injection.content))
|
||||
function: (scoped_identifier
|
||||
path: (scoped_identifier
|
||||
(identifier) @_regex
|
||||
(#any-of? @_regex "RegexSet" "RegexSetBuilder") .)
|
||||
name: (identifier) @_new
|
||||
(#eq? @_new "new"))
|
||||
arguments: (arguments
|
||||
(array_expression
|
||||
(raw_string_literal) @injection.content))
|
||||
(#set! injection.language "regex"))
|
||||
|
||||
((block_comment) @injection.content
|
||||
|
|
|
|||
|
|
@ -3,9 +3,8 @@
|
|||
name: (identifier) @local.definition.import)
|
||||
|
||||
(use_declaration
|
||||
argument:
|
||||
(scoped_identifier
|
||||
name: (identifier) @local.definition.import))
|
||||
argument: (scoped_identifier
|
||||
name: (identifier) @local.definition.import))
|
||||
|
||||
(use_as_clause
|
||||
alias: (identifier) @local.definition.import)
|
||||
|
|
@ -19,9 +18,8 @@
|
|||
|
||||
(function_item
|
||||
name: (identifier) @local.definition.method
|
||||
parameters:
|
||||
(parameters
|
||||
(self_parameter)))
|
||||
parameters: (parameters
|
||||
(self_parameter)))
|
||||
|
||||
; Variables
|
||||
(parameter
|
||||
|
|
@ -37,9 +35,8 @@
|
|||
(identifier) @local.definition.var)
|
||||
|
||||
(let_condition
|
||||
pattern:
|
||||
(_
|
||||
(identifier) @local.definition.var))
|
||||
pattern: (_
|
||||
(identifier) @local.definition.var))
|
||||
|
||||
(tuple_struct_pattern
|
||||
(identifier) @local.definition.var)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue