mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-11 07:50:07 -04:00
fix(html_tags): stop indenting void elements
This commit is contained in:
parent
ead283734b
commit
bbc67f736e
1 changed files with 8 additions and 6 deletions
|
|
@ -1,17 +1,19 @@
|
||||||
[
|
[
|
||||||
((element
|
((element
|
||||||
(start_tag
|
(start_tag
|
||||||
(tag_name) @_not_special))
|
(tag_name) @_not_void_element))
|
||||||
(#not-any-of? @_not_special "meta" "link"))
|
(#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"))
|
||||||
(element
|
(element
|
||||||
(self_closing_tag))
|
(self_closing_tag))
|
||||||
] @indent.begin
|
] @indent.begin
|
||||||
|
|
||||||
; These tags are usually written one-lined and doesn't use self-closing tags so special-cased them
|
|
||||||
; but add indent to the tag to make sure attributes inside them are still indented if written multi-lined
|
|
||||||
((start_tag
|
((start_tag
|
||||||
(tag_name) @_special)
|
(tag_name) @_void_element)
|
||||||
(#any-of? @_special "meta" "link")) @indent.begin
|
(#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`
|
; These are the nodes that will be captured when we do `normal o`
|
||||||
; But last element has already been ended, so capturing this
|
; But last element has already been ended, so capturing this
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue