-
-
Notifications
You must be signed in to change notification settings - Fork 90
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
Don't work. #64
Comments
not working for me either, no errors, using the default set up. I am on a new version of NeoVim though.
|
Same here. |
Have you ran |
@YoungeonLee I have, but still the same. I'm trying to run on LunarVim.
|
@danilobjr Try adding
to your config. If that doesn't work, try running |
@YoungeonLee This works like a charm now. Thank you so much! 🎉 |
PS |
That worked, thanks man! |
Finally, I figured out how to make it work. Content of plugins.configs.treesitter
I enabled auto install lang parsers. I am on neovim 0.8 |
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. |
works well with html, how could i do it with jsx? |
Where do i have to put this line? |
Update! It works! But |
Yeah, this isn't working for me either. I followed the instructions exactly as they are in the readme and nothing happens. |
same here even tried this but nothing for PHP and TS files
|
it's sad, this plugin doesn't documented properly on how to install.. i need to find open ticket just to figure out on how to install it properly |
Many people, including myself, initially believe that simply configuring nvim-treesitter with the following code will make it work: autotag = {
enable = true
} However, to ensure it functions correctly, you also need to install the package using your Package Manager. In my case, using NvChad and Lazy, the configuration should be: {
"nvim-treesitter/nvim-treesitter",
opts = overrides.treesitter,
},
{
"windwp/nvim-ts-autotag",
dependencies = "nvim-treesitter/nvim-treesitter",
config = function ()
require('nvim-ts-autotag').setup({
-- your config
})
end,
lazy = true,
event = "VeryLazy"
}, It would be helpful to include this information in the documentation. |
For me, I have to disable |
I'm using lazy.nvim. I did a Screen.Recording.2023-04-24.at.09.53.43.movScreen.Recording.2023-04-24.at.09.55.30.movNote the different attempts by using
UPDATE: |
If my tests are correct, this PR #104 fixed the issue for I need to config it separately, this way:
Screen.Recording.2023-04-29.at.22.30.19.mov |
Turn out, it missing the tsx module for treesitting for my case, make sure you have it installed by :TSInstall tsx |
The plugin only seems to work when exiting insert mode with |
@hvquy001 if you would not mind, I would like to update README using your information. This will help in proper installation. I myself struggle with the installation process until found your comment. Thanks |
Thank you for posting this. I got this to work immediately with lazy.nvim using this config. |
Something this crucial should be documented imo... |
Hey there! I have How to enable it automatically? Thanks! Update: I discovered that it enables automatically when I open a file from NerdTree after starting nvim in a directory, rather than directly opening a path from the command line. It's possible to live with that, but I'd love to know whether it's possible to fix. :) |
This config worked for me by throwing it in my packer.lua: |
I'm facing the autotag issue in html, but it only happens when script tag is in the buffer, weird behavior. |
For me auto tag doesn't work in I have tried the proposed solution which worked for some here, but it doesn't work in my case. |
I am using lazy vim
|
Mine doesn't work yet, custom/plugins.lua ...
{
"windwp/nvim-ts-autotag",
ft = {
"javascript", "typescript", 'javascriptreact', 'typescriptreact'
},
config = function()
require('nvim-ts-autotag').setup()
end,
lazy = true,
event = "VeryLazy"
},
{
"nvim-treesitter/nvim-treesitter",
opts = function()
opts = require "plugins.configs.treesitter"
opts.ensure_installed = {
"lua", "javascript", "typescript", "jsx", "tsx", "css", "ts", "js"
}
return opts
end
}
... plugins/configs/treesitter.lua local options = {
ensure_installed = { "lua", "vim", "vimdoc" },
highlight = {
enable = true,
use_languagetree = true,
},
indent = { enable = true },
autotag = { enable = true },
}
return options Please help, Thanks. |
I managed to get it work inspired by #64 (comment) {
"nvim-treesitter/nvim-treesitter",
opts = {
auto_install = true,
autotag = {
enable = true,
filetypes = {
'html', 'javascript', 'typescript', 'svelte', 'vue', 'tsx', 'jsx', 'rescript',
'css', 'lua', 'xml', 'php', 'markdown'
},
},
indent = { enable = true },
ensure_installed = {
-- defaults
"vim",
"lua",
"vimdoc",
-- web dev
"html",
"css",
"javascript",
"typescript",
"tsx",
"astro",
"vue",
"svelte",
"markdown",
"markdown_inline",
"json",
"scss",
"yaml"
}
}
},
{
"windwp/nvim-ts-autotag",
dependencies = "nvim-treesitter/nvim-treesitter",
config = function ()
require('nvim-ts-autotag').setup()
end,
lazy = true,
event = "VeryLazy"
}, |
Mine isn't working with markdown, too. local status_ok, configs = pcall(require, "nvim-treesitter.configs")
if not status_ok then
return
end
local autotag_filetypes = {
'html', 'javascript', 'typescript', 'javascriptreact', 'typescriptreact', 'svelte', 'vue', 'tsx', 'jsx', 'rescript',
'xml',
'php',
'markdown',
'glimmer','handlebars','hbs'
}
configs.setup {
ensure_installed = { "c", "cpp", "lua", "python", "c_sharp", "typescript", "javascript", "markdown", "scss", "fish", "vim" },
sync_install = false,
ignore_install = { "" }, -- List of parsers to ignore installing
autopairs = {
enable = true,
},
autotag = {
enable = true,
filetypes = autotag_filetypes,
},
highlight = {
enable = true, -- false will disable the whole extension
disable = { "" }, -- list of language that will be disabled
additional_vim_regex_highlighting = false,
},
indent = { enable = true, disable = { "yaml" } },
rainbow = {
enable = true,
extended_mode = true, -- Also highlight non-bracket delimiters like html tags, boolean or table: lang -> boolean
max_file_lines = nil, -- Do not enable for files with more than n lines, int
}
} |
I am using vanilla NeoVim with lazy package manager, ans this does not work for me UPDATE: Works now, just TSInstall the parser for whatever filetype you want |
Hey folks, I highly encourage you to check out the new changes on This plugin will not work for certain filetypes unless you have their associated treesitter parser installed.
@windwp am I ok to close this issue? Been open since 2022 and the core solution is to install the correct parsers (or let |
We can close it. The old setting configuration will not work with the current version, so it's better to open a new issue. |
There's now a deprecation message when adding Correct usage is to add import require('nvim-ts-autotag').setup({
enable = true,
filetypes = { "html", "xml", "tsx" },
}) My full working setup: return {
"nvim-treesitter/nvim-treesitter",
event = { "BufReadPre", "BufNewFile" },
build = ":TSUpdate",
dependencies = {
"windwp/nvim-ts-autotag",
},
config = function()
-- import nvim-treesitter plugin
local treesitter = require("nvim-treesitter.configs")
require('nvim-ts-autotag').setup({
enable = true,
filetypes = { "html", "xml", "tsx" },
})
-- configure treesitter
treesitter.setup({ -- enable syntax highlighting
highlight = {
enable = true,
},
-- enable indentation
indent = { enable = true },
-- ensure these language parsers are installed
ensure_installed = {
"json", "html", -- add others here
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = "<C-space>",
node_incremental = "<C-space>",
scope_incremental = false,
node_decremental = "<bs>",
},
},
})
end,
} |
Install plugins in neovim + lua.
Create a file tree-sitter.lua and include in init.lua
In html file i can't rename html tag.
The text was updated successfully, but these errors were encountered: