Support tailwind4
Currently lsp-tailwindcss does not works with tailwind v4. It is not starting language server when tailwind v4 is used. Also lsp-tailwindcss-server-version variable could be updated to the latest version of lsp-server.
Here's a config working w/ v4 on my machine:
(use-package lsp-tailwindcss
:ensure t
:straight '(lsp-tailwindcss :type git :host github :repo "merrickluo/lsp-tailwindcss")
:after lsp-mode
:init
(setq lsp-tailwindcss-add-on-mode t
lsp-tailwindcss-server-version "0.14.8"
lsp-tailwindcss-skip-config-check t))
lsp-tailwindcss-skip-config-check was needed in my env because the config file is no longer necessary in v4.
I was wondering why it wasn't working until I saw the answer above, thanks!
edit:
lsp-tailwindcss-server-version "0.14.8"was also important as the current default version0.12.6would not work with v4- And the versions can be viewed at https://marketplace.visualstudio.com/items?itemName=bradlc.vscode-tailwindcss
Avoiding the config check is not a good idea.We can check if Tailwind is installed by running:
npm list --depth=0 tailwindcss
- If the version is less than 4, proceed to check the config files.
- If the version is 4 or greater, skip the config file check and start without it.
- If Tailwind is not installed, do not start the server.
With all the hacks, it works for me only on HTML files but not svelte files as it used to before. They are in the same project, but apparently configuration applies somehow different. Interesting if this project is still actively maintained to hope for any updates.
Is this still the case? I can not get it runnign without this config
(use-package lsp-tailwindcss :ensure t :straight '(lsp-tailwindcss :type git :host github :repo "merrickluo/lsp-tailwindcss") :after lsp-mode :init (setq lsp-tailwindcss-add-on-mode t lsp-tailwindcss-server-version "0.14.8" lsp-tailwindcss-skip-config-check t))