lsp-tailwindcss icon indicating copy to clipboard operation
lsp-tailwindcss copied to clipboard

Support tailwind4

Open elge70 opened this issue 11 months ago • 1 comments

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.

elge70 avatar Feb 05 '25 04:02 elge70

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.

jarreds avatar Mar 11 '25 23:03 jarreds

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 version 0.12.6 would not work with v4
  • And the versions can be viewed at https://marketplace.visualstudio.com/items?itemName=bradlc.vscode-tailwindcss

ryuheechul avatar Mar 20 '25 06:03 ryuheechul

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.

elge70 avatar Mar 22 '25 16:03 elge70

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.

artemkovalyov avatar Apr 10 '25 17:04 artemkovalyov

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))

Maduki-tech avatar Sep 29 '25 21:09 Maduki-tech