HTML file shows weird behavior in Django

i have a Django project as

django-project
├─ django-project
├─ app
│  └─ templates
│     └─ app
│        └─ index.html
└─ templates
   └─ base.html

when i open django-project/templates/base.html, everything work fine as expected but whenever i open django-project/app/templates/app/index.html , filetype get detected as htmldjango. And TREESITTER, LSP, SNIPPETS… won’t start.

may be TREESITTER, LSP(html), luasnip have no idea of htmldjango filetype?

1 Like

currently i am using nvchad, and i can understand your problem i have set filetypes to htmldjango in the plugins file, so the html lsp is starting but the it’s only providing the code snippets of django and not html which is very annoying while writing html.

any luck with this? I’m having the same problem

Hopefully it’s not too late.
You need to configure luasnip to treat htmldjango filetype as html filetype.
Here is my config:

require("luasnip").filetype_extend("htmldjango", { "html" })

For more details, you can see my repo dotfiles/nvim/lua/nhatpc/plugins/completion.lua at 8c062af8deb91d4a5deb5dd327b9d3ac9656c356 · PCNhat/dotfiles · GitHub