merrickluo / lsp-tailwindcss

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

can add support of eglot? #18

Closed Lenic closed 3 years ago

Lenic commented 3 years ago

lsp-mode use too much memery, can you add the support?

merrickluo commented 3 years ago

Usually, eglot can directly use the server by adding the server startup command to eglot-server-programs. I tried to set it up, But it has some limitations.

  1. it can only bind to a major-mode
  2. no add-on mode
  3. tailwindcss-intellisense need some configuration to work, and it's harder to do in eglot.

I'll try if I can get it to work, but it's basically configuration for eglot, so it's not suitable to put in the package, but maybe I'll mention it in README.

merrickluo commented 3 years ago

Turns out it's quite easy, simply add this to your config

(add-to-list 'eglot-server-programs '((web-mode :language-id "html") . ("tailwindcss-language-server"))

After installing the language server with npm npm install -g @tailwindcss/language-server

Just be careful about the language-id, it must be something that tailwindcss-language-server recognize, or nothing will appear. You should be able to set it up with other major-mode too, but there can only be one running in a buffer.