windwp / nvim-ts-autotag

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

bug: Autocompletion with slash bug with tsx. #125

Closed chaozwn closed 8 months ago

chaozwn commented 1 year ago

with autocomplete always return /div>.

https://github.com/windwp/nvim-ts-autotag/assets/51357674/ea34e54c-d84b-4cc7-834b-2583e5754afb

Naught0 commented 1 year ago

I have this problem as well. It appears doing a self-closing tag e.g. <br /> will result in an attempt to close the closest parent tag. In your case, that is div.

This is an example of what happens when I try to close <Input />:

image

E: seems #124 reports the same

Callumk7 commented 1 year ago

I have this issue as well.

Callumk7 commented 1 year ago

For the time being, you can disable the close on slash functionality in your treesitter config.

  autotag = {
    enable = true,
    enable_close_on_slash = false,
  },
bkerz commented 1 year ago

I have this issue too. Callum7's solution worked perfectly for me, but I just want to mention I tried to fix it in the same way using

                require "nvim-ts-autotag".setup {
                    autotag = {
                        enable = true,
                        enable_rename = true,
                        enable_close_on_slash = false,
                    }
                }

But it seems this config wasn't read, only the treesitter config. Don't know if this is an issue as well, but I'll leave it here.

meronogbai commented 11 months ago

Callum7's solution worked for me too. Shouldn't that option be set to false by default?

stale[bot] commented 9 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.

bartels commented 9 months ago

This bug still exists. Disabling the feature with enable_close_on_slash = false is the current workaround