Yeah. So I have basic stuffs set up for html, css, javascript things like treesitter for each language syntaxes, lsp servers like html-lsp, blackd, css-lsp, isort, prettierd, pyright, ruff, mypy, typescript-language-server installed in Mason, configured and run through null-ls.nvim or lspconfig.nvim.
But if I open up a Django template html file, I noticed that the filetype was not automatically changed to a htmldjango, and had to :TSInstall htmldjango to install treesitter parser for htmldjango files, and there was no formatter or lsp specifically for Django template html files: prettierd would break Django htmls.
So I want to ask basically how to set up Neovim for Django projects?
I tried installing django-plus.vim plugin which didn’t help.
To answer my own question, install djlint to format & lint htmldjango files.
Neovim automatically detects htmldjango file type and associated treesitter parser should be downloaded by nvim-treesitter plugin automatically. If this is not the case, :TSInstall htmldjango should install treesitter parser.
Also setup ftplugin for htmldjango if necessary.
Thanks for this. But I’m experiencing an issue where my html-lsp isn’t working in htmldjango files. So I’m not getting any completion from the lsp. I’ve added htmldjango as a filetype and it shows that html is attached to the buffer but no suggestions.
I found a workaround using friendly-snippets and extending htmldjango files using html snippets but when doing this I get double snippets like for example I get 2 div suggestions and 2 html5 suggestions and so on