windwp / nvim-ts-autotag

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

Doesn't work #123

Closed s1nistr4 closed 10 months ago

s1nistr4 commented 1 year ago

I follow the instructions in the readme, as well as have treesitter installed, then I try renaming tags and nothing happens.

zytact commented 1 year ago

Do you have treesitter parser for html installed?

bepnos commented 1 year ago

Same here downloaded it using Packer, show up on PackerSync as properly installed. Added the lines in my treesitter.lua file yet it does not work on any html files I open.

wambldor commented 1 year ago

Unfortunately, the plugin does not work for me either. I use NvChad, so the lazy.nvim, and the following configuration for treesitter and nvim-ts-autoclose:

 {
    "nvim-treesitter/nvim-treesitter",
    opts = {
      ensure_installed = {
        -- defaults
        "vim",
        "lua",
        "markdown",

        "html",
        "css",
        "javascript",
        "typescript",
        "json",
        "c_sharp",
        "sql",
        "yaml",
        "xml",
        "tsx",
      },
      autotag = {
        enable = true
      },
    },
  },
  {
    "windwp/nvim-ts-autotag",
    dependencies = "nvim-treesitter/nvim-treesitter",
    event = "VeryLazy",
    config = function()
      require("nvim-ts-autotag").setup()
    end,
  },

When I run :TSModuleInfo autotag is enabled.

Especially important to me would be the automatic closing of xml tags.

harrismcc commented 1 year ago

@wambldor I was also having issues, but I fixed them. I think you need to add it to the dependencies array like:

{
   "nvim-treesitter/nvim-treesitter",
   dependencies = { 
      "windwp/nvim-ts-autotag"
   },
   opts = {
     ensure_installed = {
       -- defaults
       "vim",
       "lua",
       "markdown",

       "html",
       "css",
       "javascript",
       "typescript",
       "json",
       "c_sharp",
       "sql",
       "yaml",
       "xml",
       "tsx",
     },
     autotag = {
       enable = true
     },
   },
 }
hinell commented 1 year ago

Works for me in html and tsx/jsx files.

Renmaing tag back from <xyz> to <div> works with quirks....

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