Closed ycmjason closed 1 month ago
I think my change will make <input>
to be considered as opening tag too and indent the lines after. Not sure if it is my change that introduces the problem tho.
@ycmjason Very possible, that's why I still don't fix this issue.
There are several tags might be affected by this.
Self-closing tag and <p>
without closing tag ...etc
@othree that's true.
Any ideas how we can solve this?
I will try to fix this again. In my memory, last time I want to fix this is trying to use the indent tag list. But I forgot the detail now.
One quick workaround is by setting the variable html_indent_inctags
.
ex:
let g:html_indent_inctags = 'custom,ele'
Buffer variable also works too.
I see. But the custom tags varies in each project and there are probably a lot of different components in a single project. The tag will end up growing indefinitely. I am not a big fan of this solution.
Instead can we assume all tags will indent lines except for void elements? Void elements basically are just <area>
, <base>
, <br>
, <col>
, <command>
, <embed>
, <hr>
, <img>
, <input>
, <keygen>
, <link>
, <meta>
, <param>
, <source>
, <track>
, <wbr>
?
I don't fully understand how the indent/html.vim works, but it looks like it first check if it is a custom element? Perhaps we should first check if it is void element?
Self-closing tags like these:
<my-awesome-component />
will be treated as open tags and indent the lines following it.I have added to the regex to ignore these tags.