windwp / nvim-ts-autotag

Use treesitter to auto close and auto rename html tag
MIT License
1.62k stars 86 forks source link

Renaming and auto-indent doesn't work for non-HTML tags #130

Closed jarimayenburg closed 10 months ago

jarimayenburg commented 1 year ago

It seems that renaming and auto-indenting on doesn't work for tags other than the standard HTML tags (<div>, <input>, <h1>, etc). This is only the case if the parent element isn't a standard HTML tag or if it's the root element of the document.

So this works

<html>
    <body>
      <banana> <--- renaming this one works
      </banana>
    </body>
</html>

This doesn't

<banana> <--- renaming this one doesn't work
</banana>

This could very well be caused by my workaround for XML files (#129). Is anyone aware of another way to get Treesitter to work for XML files? Or should we just wait for the XML parser to arrive? (nvim-treesitter/nvim-treesitter#5194)

jarimayenburg commented 1 year ago

There are also some cases with proper HTML where renames fail. In both HTML and XML files.

<html>
    <head></head>
    <body>
        <div>  <--- renaming this one works fine
            <div>  <--- renaming this one doesn't work
            </div>
        </div>
    </body>
</html>

This is a case with just HTML in a HTML file, so my workaround for the XML parser doesn't apply here. Makes me think it might not have anything to do with that workaround after all.

stale[bot] commented 11 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.