merrickluo / lsp-tailwindcss

the lsp-mode client for tailwindcss
GNU General Public License v3.0
180 stars 21 forks source link

Not work on newest lsp-mode in web-mode on emacs 29.1.90 (older version lsp-mode works) #62

Closed zw963 closed 5 months ago

zw963 commented 8 months ago

Please check following logs.

LSP :: There are no language servers supporting current mode `web-mode' registered with `lsp-mode'.
This issue might be caused by:
1. The language you are trying to use does not have built-in support in `lsp-mode'. You must install the required support manually. Examples of this are `lsp-java' or `lsp-metals'.
2. The language server that you expect to run is not configured to run for major mode `web-mode'. You may check that by checking the `:major-modes' that are passed to `lsp-register-client'.
3. `lsp-mode' doesn't have any integration for the language behind `web-mode'. Refer to https://emacs-lsp.github.io/lsp-mode/page/languages and https://langserver.org/ .
4. You are over `tramp'. In this case follow https://emacs-lsp.github.io/lsp-mode/page/remote/.
5. You have disabled the `lsp-mode' clients for that file. (Check `lsp-enabled-clients' and `lsp-disabled-clients').
You can customize `lsp-warn-no-matched-clients' to disable this message.

my minimum config:

(require 'dap-ui)
(require 'dap-mouse)
(require 'lsp-mode)
(require 'lsp-ui)
(require 'web-mode)
(add-to-list 'lsp-language-id-configuration '("\\.ecr$" . "html"))
(require 'lsp-tailwindcss)
(setq lsp-tailwindcss-add-on-mode t)

Then, after start emacs, open a html file use .ecr extension name, then run lsp, get above error messages.

lsp-mode version

lsp-mode latest master: 0f5723f9a web-mode latest master 848fce9 emacs 29.1.90

zw963 commented 8 months ago

BTW: at the same time, the lsp builtin support mode, e.g. ruby mode with ruby-syntax-tree, so i consider there is something broken in lsp-tailwindcss, thanks

polhuang commented 7 months ago

Hey there,

If that is the only config that you have, then you might not have lsp-mode configured to run when in web-mode. You may need to write a hook that initiates lsp-mode when in web-mode, i.e. (add-hook 'web-mode-hook #'lsp-deferred)

zw963 commented 7 months ago

You may need to write a hook that initiates lsp-mode when in web-mode, i.e. (add-hook 'web-mode-hook #'lsp-deferred)

I run lsp manually instead.

dgutov commented 5 months ago

Try to call M-x lsp-workspace-folders-add first.

zw963 commented 5 months ago

Try to call M-x lsp-workspace-folders-add first.

Thanks for help, if i run lsp manually when opened a ???.erb file use above configuration, i get following lsp candiates selection(check screenshot)

image

I assume there should be a candidate name same as the server-id tailwindcss which defined in lsp-tailwindcss.el, right? so, i disable above lsp candiates, use this:

(setq lsp-disabled-clients '(html-ls emmet-ls semgrep-ls))

then restart emacs and open same erb file, get following message:

LSP :: There are no language servers supporting current mode `web-mode' registered with `lsp-mode'.
This issue might be caused by:
1. The language you are trying to use does not have built-in support in `lsp-mode'. You must install the required support manually. Examples of this are `lsp-java' or `lsp-metals'.
2. The language server that you expect to run is not configured to run for major mode `web-mode'. You may check that by checking the `:major-modes' that are passed to `lsp-register-client'.
3. `lsp-mode' doesn't have any integration for the language behind `web-mode'. Refer to https://emacs-lsp.github.io/lsp-mode/page/languages and https://langserver.org/ .
4. You are over `tramp'. In this case follow https://emacs-lsp.github.io/lsp-mode/page/remote/.
5. You have disabled the `lsp-mode' clients for that file. (Check `lsp-enabled-clients' and `lsp-disabled-clients').
You can customize `lsp-warn-no-matched-clients' to disable this message.

lsp-workspace-folders-add not help, because i can enable emmet-ls successful, but, can't found lsp-tailwindcss get registered. but, i remember tailwindcss candidates available before.

dgutov commented 5 months ago

@zw963 Do you have the latest lsp-tailwindcss and lsp-mode installed? I had to update the latter before the option to install the tailwind server appeared.

And lsp-tailwindcss needs to be loaded (require-d), of course.

zw963 commented 5 months ago

@zw963 Do you have the latest lsp-tailwindcss and lsp-mode installed? I had to update the latter before the option to install the tailwind server appeared.

And lsp-tailwindcss needs to be loaded (require-d), of course.

Yes, lsp-tailwindcss use latest master b363042, lsp-mode is same too.

Although, there is a concern, i never use any package manager, so, just copy latest code into local directory, then require it manually.

And lsp-tailwindcss needs to be loaded (require-d), of course.

Yes, i can saw those variable defined in lsp-tailwindcss.el

lsp-tailwindcss-major-modes is a variable defined in ‘lsp-tailwindcss.el’.

Its value is
(rjsx-mode web-mode html-mode css-mode typescript-mode typescript-tsx-mode tsx-ts-mode)

I can saw lsp-tailwindcss add into lsp-client-packaegs too.

lsp-client-packages is a variable defined in ‘lsp-mode.el’.

Its value is
(ccls  ... lsp-tailwindcss ...)
dgutov commented 5 months ago

Do you also have a config file in the workspace root that is recognized by this package?

See the definition of lsp-tailwindcss--has-config-file for the detection logic.

zw963 commented 5 months ago

Do you also have a config file in the workspace root that is recognized by this package?

See the definition of lsp-tailwindcss--has-config-file for the detection logic.

Oops, i forget add tailwindcss config for my test project, i thought this is the reason tailwindcss can't star.

See the definition of lsp-tailwindcss--has-config-file for the detection logic.

Yes, it return nil, tried on another project, it works, thanks!