mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-04 04:20:09 -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
|
|
@ -35,9 +35,8 @@
|
|||
|
||||
((assignment
|
||||
left: (identifier) @type.definition
|
||||
right:
|
||||
(call
|
||||
function: (identifier) @_func))
|
||||
right: (call
|
||||
function: (identifier) @_func))
|
||||
(#any-of? @_func "TypeVar" "NewType"))
|
||||
|
||||
; Function calls
|
||||
|
|
@ -45,18 +44,16 @@
|
|||
function: (identifier) @function.call)
|
||||
|
||||
(call
|
||||
function:
|
||||
(attribute
|
||||
attribute: (identifier) @function.method.call))
|
||||
function: (attribute
|
||||
attribute: (identifier) @function.method.call))
|
||||
|
||||
((call
|
||||
function: (identifier) @constructor)
|
||||
(#lua-match? @constructor "^%u"))
|
||||
|
||||
((call
|
||||
function:
|
||||
(attribute
|
||||
attribute: (identifier) @constructor))
|
||||
function: (attribute
|
||||
attribute: (identifier) @constructor))
|
||||
(#lua-match? @constructor "^%u"))
|
||||
|
||||
; Decorators
|
||||
|
|
@ -109,10 +106,9 @@
|
|||
|
||||
((call
|
||||
function: (identifier) @_isinstance
|
||||
arguments:
|
||||
(argument_list
|
||||
(_)
|
||||
(identifier) @type))
|
||||
arguments: (argument_list
|
||||
(_)
|
||||
(identifier) @type))
|
||||
(#eq? @_isinstance "isinstance"))
|
||||
|
||||
; Normal parameters
|
||||
|
|
@ -211,18 +207,16 @@
|
|||
(string) @string.documentation @spell))
|
||||
|
||||
(class_definition
|
||||
body:
|
||||
(block
|
||||
.
|
||||
(expression_statement
|
||||
(string) @string.documentation @spell)))
|
||||
body: (block
|
||||
.
|
||||
(expression_statement
|
||||
(string) @string.documentation @spell)))
|
||||
|
||||
(function_definition
|
||||
body:
|
||||
(block
|
||||
.
|
||||
(expression_statement
|
||||
(string) @string.documentation @spell)))
|
||||
body: (block
|
||||
.
|
||||
(expression_statement
|
||||
(string) @string.documentation @spell)))
|
||||
|
||||
; Tokens
|
||||
[
|
||||
|
|
@ -378,32 +372,27 @@
|
|||
name: (identifier) @type)
|
||||
|
||||
(class_definition
|
||||
body:
|
||||
(block
|
||||
(function_definition
|
||||
name: (identifier) @function.method)))
|
||||
body: (block
|
||||
(function_definition
|
||||
name: (identifier) @function.method)))
|
||||
|
||||
(class_definition
|
||||
superclasses:
|
||||
(argument_list
|
||||
(identifier) @type))
|
||||
superclasses: (argument_list
|
||||
(identifier) @type))
|
||||
|
||||
((class_definition
|
||||
body:
|
||||
(block
|
||||
(expression_statement
|
||||
(assignment
|
||||
left: (identifier) @variable.member))))
|
||||
body: (block
|
||||
(expression_statement
|
||||
(assignment
|
||||
left: (identifier) @variable.member))))
|
||||
(#lua-match? @variable.member "^[%l_].*$"))
|
||||
|
||||
((class_definition
|
||||
body:
|
||||
(block
|
||||
(expression_statement
|
||||
(assignment
|
||||
left:
|
||||
(_
|
||||
(identifier) @variable.member)))))
|
||||
body: (block
|
||||
(expression_statement
|
||||
(assignment
|
||||
left: (_
|
||||
(identifier) @variable.member)))))
|
||||
(#lua-match? @variable.member "^[%l_].*$"))
|
||||
|
||||
((class_definition
|
||||
|
|
@ -434,12 +423,10 @@
|
|||
|
||||
; Regex from the `re` module
|
||||
(call
|
||||
function:
|
||||
(attribute
|
||||
object: (identifier) @_re)
|
||||
arguments:
|
||||
(argument_list
|
||||
.
|
||||
(string
|
||||
(string_content) @string.regexp))
|
||||
function: (attribute
|
||||
object: (identifier) @_re)
|
||||
arguments: (argument_list
|
||||
.
|
||||
(string
|
||||
(string_content) @string.regexp))
|
||||
(#eq? @_re "re"))
|
||||
|
|
|
|||
|
|
@ -164,9 +164,8 @@
|
|||
(attribute
|
||||
attribute: (_) @indent.end)
|
||||
(call
|
||||
arguments:
|
||||
(_
|
||||
")" @indent.end))
|
||||
arguments: (_
|
||||
")" @indent.end))
|
||||
"return" @indent.end
|
||||
] .)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,19 +1,16 @@
|
|||
(call
|
||||
function:
|
||||
(attribute
|
||||
object: (identifier) @_re)
|
||||
arguments:
|
||||
(argument_list
|
||||
.
|
||||
(string
|
||||
(string_content) @injection.content))
|
||||
function: (attribute
|
||||
object: (identifier) @_re)
|
||||
arguments: (argument_list
|
||||
.
|
||||
(string
|
||||
(string_content) @injection.content))
|
||||
(#eq? @_re "re")
|
||||
(#set! injection.language "regex"))
|
||||
|
||||
((binary_operator
|
||||
left:
|
||||
(string
|
||||
(string_content) @injection.content)
|
||||
left: (string
|
||||
(string_content) @injection.content)
|
||||
operator: "%")
|
||||
(#set! injection.language "printf"))
|
||||
|
||||
|
|
|
|||
|
|
@ -2,34 +2,29 @@
|
|||
(module) @local.scope
|
||||
|
||||
(class_definition
|
||||
body:
|
||||
(block
|
||||
(expression_statement
|
||||
(assignment
|
||||
left: (identifier) @local.definition.field)))) @local.scope
|
||||
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
|
||||
body: (block
|
||||
(expression_statement
|
||||
(assignment
|
||||
left: (_
|
||||
(identifier) @local.definition.field))))) @local.scope
|
||||
|
||||
; Imports
|
||||
(aliased_import
|
||||
alias: (identifier) @local.definition.import)
|
||||
|
||||
(import_statement
|
||||
name:
|
||||
(dotted_name
|
||||
(identifier) @local.definition.import))
|
||||
name: (dotted_name
|
||||
(identifier) @local.definition.import))
|
||||
|
||||
(import_from_statement
|
||||
name:
|
||||
(dotted_name
|
||||
(identifier) @local.definition.import))
|
||||
name: (dotted_name
|
||||
(identifier) @local.definition.import))
|
||||
|
||||
; Function with parameters, defines parameters
|
||||
(parameters
|
||||
|
|
@ -64,22 +59,19 @@
|
|||
(#set! definition.type.scope "parent"))
|
||||
|
||||
(class_definition
|
||||
body:
|
||||
(block
|
||||
(function_definition
|
||||
name: (identifier) @local.definition.method)))
|
||||
body: (block
|
||||
(function_definition
|
||||
name: (identifier) @local.definition.method)))
|
||||
|
||||
; Loops
|
||||
; not a scope!
|
||||
(for_statement
|
||||
left:
|
||||
(pattern_list
|
||||
(identifier) @local.definition.var))
|
||||
left: (pattern_list
|
||||
(identifier) @local.definition.var))
|
||||
|
||||
(for_statement
|
||||
left:
|
||||
(tuple_pattern
|
||||
(identifier) @local.definition.var))
|
||||
left: (tuple_pattern
|
||||
(identifier) @local.definition.var))
|
||||
|
||||
(for_statement
|
||||
left: (identifier) @local.definition.var)
|
||||
|
|
@ -91,14 +83,12 @@
|
|||
left: (identifier) @local.definition.var)
|
||||
|
||||
(for_in_clause
|
||||
left:
|
||||
(tuple_pattern
|
||||
(identifier) @local.definition.var))
|
||||
left: (tuple_pattern
|
||||
(identifier) @local.definition.var))
|
||||
|
||||
(for_in_clause
|
||||
left:
|
||||
(pattern_list
|
||||
(identifier) @local.definition.var))
|
||||
left: (pattern_list
|
||||
(identifier) @local.definition.var))
|
||||
|
||||
(dictionary_comprehension) @local.scope
|
||||
|
||||
|
|
@ -111,20 +101,17 @@
|
|||
left: (identifier) @local.definition.var)
|
||||
|
||||
(assignment
|
||||
left:
|
||||
(pattern_list
|
||||
(identifier) @local.definition.var))
|
||||
left: (pattern_list
|
||||
(identifier) @local.definition.var))
|
||||
|
||||
(assignment
|
||||
left:
|
||||
(tuple_pattern
|
||||
(identifier) @local.definition.var))
|
||||
left: (tuple_pattern
|
||||
(identifier) @local.definition.var))
|
||||
|
||||
(assignment
|
||||
left:
|
||||
(attribute
|
||||
(identifier)
|
||||
(identifier) @local.definition.field))
|
||||
left: (attribute
|
||||
(identifier)
|
||||
(identifier) @local.definition.field))
|
||||
|
||||
; Walrus operator x := 1
|
||||
(named_expression
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue