leafOfTree / svelte-mode

Emacs major mode for Svelte.
GNU Lesser General Public License v3.0
83 stars 5 forks source link

Eglot doesn't understand svelte-mode #12

Open zenMaya opened 2 years ago

zenMaya commented 2 years ago

Depending on the current cursor position, eglot assumes that it is in either svelte-mode, javascript-mode or css-mode

Would there be a possibility, that svelte mode would report to eglot always as svelte mode? So it doesn't try to run the wrong server on the file.

KamWithK commented 1 month ago

I haven't been able to get it to work either, although it doesn't switch modes like you described (maybe you set it up differently)

I added to my config:

(use-package svelte-mode)

(use-package eglot
  :after yasnippet
  :config
  (add-to-list 'eglot-server-programs '(svelte-mode . ("svelteserver" "--stdio")))
  :hook (prog-mode . eglot-ensure)
  )

But I don't get any syntax highlighting for TS src blocks: image

HTML seems to work fine, CSS has syntax highlighting but gives some unknown rule underlines

shackra commented 3 weeks ago

yeah, I'm experiencing this and it is really annoying :(

leafOfTree commented 3 weeks ago

Hi, there. Thanks for your feedback.

Please note typescript-mode needs to be installed to highlight ts block.

I'm not familiar with eglot and haven't got time to check it yet. So please let me know if installing typescript-mode fixes the issue, or if it doesn't work with eglot.

leafOfTree commented 3 weeks ago

svelteserver seems to use ts/js/scss rules to check svelte blocks. As the below screenshot shows, it detects errors of different blocks at the same time It may integrate those servers or rules, but I don't think there are different servers switching.

image

I tried below config to enable eglot on svelte files.

npm i -g svelte-language-server
;; Add to init.el
(add-hook 'svelte-mode-hook 'eglot-ensure)

;; If needed, add the server configuration
(use-package eglot
  :config
  (add-to-list 'eglot-server-programs
           '(svelte-mode . ("svelteserver" "--stdio"))))
KamWithK commented 3 weeks ago

Hi, there. Thanks for your feedback.

Please note typescript-mode needs to be installed to highlight ts block.

I'm not familiar with eglot and haven't got time to check it yet. So please let me know if installing typescript-mode fixes the issue, or if it doesn't work with eglot.

For me this was the problem

I thought it would've used the tree sitter typescript mode but it did not

shackra commented 3 weeks ago

I have typescript-ts-mode required in my configuration and despite that the block won't be highlighted. Maybe svelte-mode miss the compatibility with typescript-ts-mode?

El lunes 04 de noviembre del 2024, Kamron Bhavnagri escribió:

Hi, there. Thanks for your feedback.

Please note typescript-mode needs to be installed to highlight ts block.

I'm not familiar with eglot and haven't got time to check it yet. So please let me know if installing typescript-mode fixes the issue, or if it doesn't work with eglot.

For me this was the problem

I thought it would've used the tree sitter typescript mode but it did not

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.

-- Jorge Araya

Contacto: Telegram: t.me/shackra · Signal: Shackra.28

leafOfTree commented 2 weeks ago

I see. It seems not easy to use the new tree sitter typescript-ts-mode in the regular svelte-mode.

We probably need a new svelte-ts-mode to totally make use of tree sitter

For reference