Fixup format (#5934)

* fix(format): newline between top-level field defs

* fixup: newline between node and comment

* fixup: optimize pattern
This commit is contained in:
Phạm Huy Hoàng 2024-01-20 18:47:56 +09:00 committed by GitHub
parent f5a839d1e8
commit d198a75e2c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
35 changed files with 47 additions and 3 deletions

View file

@ -52,10 +52,7 @@ local format_queries = [[
;; Preserve inline comments
(program
. (_)
(_) @_comment
.
(comment) @format.prepend-newline
(#not-has-type? @_comment comment)
(#is-start-of-line? @format.prepend-newline))
(program
. (_)
@ -77,7 +74,9 @@ local format_queries = [[
(grouping)
(named_node)
(anonymous_node)
(field_definition)
] @format.prepend-newline)
(program
(comment) @_comment
.
@ -86,6 +85,8 @@ local format_queries = [[
(grouping)
(named_node)
(anonymous_node)
(field_definition)
(comment)
] @format.cancel-prepend
(#is-start-of-line? @_comment))
;; }}}