Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't close tags in XML #163

Closed
jonathanmorris180 opened this issue Mar 1, 2024 · 8 comments
Closed

Doesn't close tags in XML #163

jonathanmorris180 opened this issue Mar 1, 2024 · 8 comments

Comments

@jonathanmorris180
Copy link

Thanks for your work on this plugin!

I've been trying to get the auto-closing to work for xml files (this is important for Java projects since working with the POM can be a pain otherwise) but it doesn't seem to work. Here is my nvim-treesitter config.

Please let me know if more info is needed.

@TXPGhost
Copy link

TXPGhost commented Mar 2, 2024

Having the same issue. Works for HTML but not XML.

@PriceHiller
Copy link
Collaborator

The XML treesitter parser had its starting and end tags changed recently it seems.

The new start and end tags for XML are STag and ETag.

This patch fixes the auto closing at least:

diff --git a/lua/nvim-ts-autotag/internal.lua b/lua/nvim-ts-autotag/internal.lua
index 89bea74..25a3b46 100644
--- a/lua/nvim-ts-autotag/internal.lua
+++ b/lua/nvim-ts-autotag/internal.lua
@@ -34,10 +34,10 @@ local HTML_TAG = {
         'php',
         'xml',
     },
-    start_tag_pattern      = { 'start_tag' },
-    start_name_tag_pattern = { 'tag_name' },
-    end_tag_pattern        = { 'end_tag' },
-    end_name_tag_pattern   = { 'tag_name' },
+    start_tag_pattern      = { 'start_tag', 'STag' },
+    start_name_tag_pattern = { 'tag_name', 'Name' },
+    end_tag_pattern        = { 'end_tag', 'ETag' },
+    end_name_tag_pattern   = { 'tag_name', 'Name' },
     close_tag_pattern      = { 'erroneous_end_tag' },
     close_name_tag_pattern = { 'erroneous_end_tag_name' },
     element_tag            = { 'element' },

Not sure if there's anything else missing from the new TS stuff, I haven't checked yet. If someone wants to PR this feel free -- otherwise I'll PR this later today or tomorrow.

Copy link

stale bot commented May 4, 2024

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.

@stale stale bot added the wontfix This will not be worked on label May 4, 2024
@jonathanmorris180
Copy link
Author

@PriceHiller will you be able to get the above PR merged?

@PriceHiller
Copy link
Collaborator

@PriceHiller will you be able to get the above PR merged?

If my PR is looked at, then yes. As far as I can tell my patch works as expected.

I'll ping on the PR to windwp. He may have missed this/lacked time to really look.

If it doesn't get looked at then I'll probably end up maintaining some small patches and whatnot on my fork as I encounter bugs.

@PriceHiller
Copy link
Collaborator

Unfortunately it appears @windwp hasn't responded to my ping in a week in any way.

For anyone interested (like @jonathanmorris180), I'll be maintaining a fork over @ https://github.com/PriceHiller/nvim-ts-autotag/ with some of the PRs open here merged later today until such a time where @windwp is able to continue working on this plugin.

I hope they're doing ok. Once (or if) they come back, I'll look into merging my fork back here. Please ping me when you're back @windwp, the plugin kicks ass and life sometimes hits hard. No problem if you're gone for a bit, it's a free plugin after all 😉.

@PriceHiller
Copy link
Collaborator

Will be closed by #173

@PriceHiller
Copy link
Collaborator

Resolved by #173. Please do not use my fork anymore -- this repository is still being maintained by windwp and I am also now a maintainer assisting them.

If XML tags still don't work, ping me and I'll reopen and investigate, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants