mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
fix(format): handle list with 300 nodes
This commit is contained in:
parent
e9602f4119
commit
5f950cdcb8
5 changed files with 7 additions and 23 deletions
|
|
@ -277,9 +277,9 @@
|
|||
))
|
||||
|
||||
; Builtin Funcs
|
||||
; format-ignore
|
||||
(call
|
||||
(identifier) @function.builtin
|
||||
; format-ignore
|
||||
(#any-of? @function.builtin
|
||||
; @GlobalScope
|
||||
"abs" "absf" "absi" "acos" "asin" "atan" "atan2" "bezier_derivative"
|
||||
|
|
|
|||
|
|
@ -165,8 +165,7 @@
|
|||
"background"
|
||||
"rounded"
|
||||
"butt"
|
||||
]*
|
||||
@attribute)
|
||||
]* @attribute)
|
||||
|
||||
; (t_canvas)
|
||||
; (t_cgm)
|
||||
|
|
@ -288,7 +287,6 @@
|
|||
] @variable.member
|
||||
|
||||
; Workaround because formatter cannot handle 300 list nodes
|
||||
; format-ignore
|
||||
[
|
||||
(angles)
|
||||
(clip)
|
||||
|
|
|
|||
|
|
@ -74,8 +74,7 @@
|
|||
; ":::="
|
||||
"?="
|
||||
"!="
|
||||
]?
|
||||
@operator
|
||||
]? @operator
|
||||
"endef" @keyword)
|
||||
|
||||
(variable_assignment
|
||||
|
|
|
|||
|
|
@ -116,8 +116,7 @@
|
|||
[
|
||||
"end"
|
||||
"endfunction"
|
||||
]?
|
||||
@keyword.function)
|
||||
]? @keyword.function)
|
||||
|
||||
(function_signature
|
||||
name: (identifier) @function)
|
||||
|
|
|
|||
|
|
@ -106,25 +106,19 @@ local format_queries = [[
|
|||
;; Only starts indent if 2 or more elements
|
||||
(list
|
||||
"[" @format.indent.begin
|
||||
.
|
||||
(_)
|
||||
.
|
||||
(_)
|
||||
"]" @format.indent.dedent)
|
||||
;; Otherwise, remove brackets
|
||||
(list
|
||||
"[" @format.remove
|
||||
"[" @format.remove @format.cancel-append
|
||||
.
|
||||
(_) @format.cancel-append
|
||||
.
|
||||
"]" @format.remove)
|
||||
;; [ ... ] @capture1 @capture2
|
||||
(list
|
||||
(capture) @format.prepend-space)
|
||||
;; Append newlines for nodes inside the list
|
||||
(list
|
||||
(_) @format.append-newline
|
||||
(#not-has-type? @format.append-newline capture))
|
||||
(#not-has-type? @format.append-newline capture quantifier))
|
||||
|
||||
;; (_), "_" and _ handler
|
||||
;; Start indents if it's one of these patterns
|
||||
|
|
@ -176,9 +170,6 @@ local format_queries = [[
|
|||
(anonymous_node)
|
||||
"."
|
||||
] @format.append-newline)
|
||||
(named_node
|
||||
(list
|
||||
"[" . (_) @format.append-newline . "]"))
|
||||
|
||||
;; Collapse closing parentheses
|
||||
(named_node
|
||||
|
|
@ -192,10 +183,7 @@ local format_queries = [[
|
|||
(#not-has-type? @format.cancel-append comment))
|
||||
|
||||
;; All captures should be separated with a space
|
||||
(named_node
|
||||
(capture) @format.prepend-space)
|
||||
(anonymous_node
|
||||
(capture) @format.prepend-space)
|
||||
(capture) @format.prepend-space
|
||||
|
||||
;; Workaround to just use the string's content
|
||||
(anonymous_node (identifier) @format.keep)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue