Search code examples
pythondjangotailwind-csspostcssnvim-lspconfig

Tailwindcss LSP for Neovim root_dir issue


I am having an issue with the Tailwind LSP in Neovim 0.5 where the language server running however I get no intellisense when defining a class. I am working on a django project and tailwind is all setup with the following structure.
.
├── .git/
├── .venv/
├── node_modules/
├── src/
└── static/
├── package.json
├── postcss.config.js
└── tailwind.config.js

I have set the "root_dir" setting in the tailwind lsp setup to:

lsp.util.root_pattern('tailwind.config.js') or
lsp.util.root_pattern('tailwind.config.js', '.git', 'postcss.config.js')

etc, but with no success.

The only way I can get intellisense is if I place a html file right in the root next to the tailwind.config.js and edit it.

Has anyone else come across this and might know where I am going wrong.

Appreciate any help, thanks


Solution

  • Turns out TailwindCSS lsp wasn't recognising the htmldjango filetype so once I added the following to the setup it worked:

    init_options = { userLanguages = { htmldjango = "html" }