Closed shaeinst closed 2 years ago
I also have the same experience with @shket-228
Confirming that the issue still persists, it'd be good to reopen the issue. Or should I create a new one?
are you sure guys? try as following config
-- enable html parser in htmldjango file
local import_parsers, parsers = pcall(require, 'nvim-treesitter.parsers')
if import_parsers then
local parsername = parsers.filetype_to_parsername
parsername.htmldjango = 'html'
end
local import_tag, autotag = pcall(require, "nvim-ts-autotag")
if not import_tag then return end
autotag.setup({
autotag = {
enable = true,
},
filetypes = {
'html', 'htmldjango',
},
})
@shaeinst Thanks a lot, enabling html parser for htmldjango
filetype did the trick.
I think nvim-treesitter should do this by default. Will try opening an issue there, thanks again.
I'm still having problems.
I already have filetypes = { 'htmldjango', 'html', ... } in nvim-treesitter config.
I tried both lua require"nvim-treesitter.parsers".filetype_to_parsername.htmldjango = 'html'
and lua vim.treesitter.language.register("html", "htmldjango")
but none of these worked.
Only way I could get autotag to work is to set ft=html
but this would cause LSPs to fail.
for neovim >= 0.9
-- safely import tree-sitter
local treesitter_imported_ok, treesitter = pcall(require, 'nvim-treesitter.configs')
if not treesitter_imported_ok then return end
local register = vim.treesitter.language.register
register('html', 'htmldjango') -- enable html parser in htmldjango file
local import_tag, autotag = pcall(require, "nvim-ts-autotag")
if not import_tag then return end
autotag.setup({
autotag = {
enable = true,
},
filetypes = {
'html', 'htmldjango',
},
})
@shaeinst , don't you lose syntax highlighting for the templating aspects of the htmldjango file?
Does this have a fix yet?
I am still facing the same issue. I tried all the solutions mentioned above in this thread. None of them worked.
Not sure what exactly this entails since I don't have much experience in Lua, but:
After hacking around for a little while I've found that removing "htmldjango" from the HBS_TAG.filetypes
seems to do the trick. Perhaps it's overwriting the definition in HTML_TAG
?
https://github.com/windwp/nvim-ts-autotag/blob/531f48334c422222aebc888fd36e7d109cb354cd/lua/nvim-ts-autotag/internal.lua#L69 It was last changed in this commit: https://github.com/windwp/nvim-ts-autotag/commit/25698e4033cd6cd3745454bfc837dd670eba0480 and I can't find the reason why.
Dunno if we should file this as a bug or if this has a reason to exist, but for the time being, to enable django support you can just remove it on line 69 of lua/nvim-ts-autotag/internal.lua
.
@an4s911 @comiluv @shk3t @shaeinst you might find this helpful.
i still cannot get this working, i have tried all of the above and nothing. If anybody has fixed please post
Still have this problem (nvim v0.7). Have
filetypes = { "htmldjango", ...
in config files. It seems to be trying to do something, considering mode indicator blinking. I really love this plugin, but this issue makes me disappointed.