emacs-lsp / lsp-mode

Emacs client/library for the Language Server Protocol
https://emacs-lsp.github.io/lsp-mode
GNU General Public License v3.0
4.81k stars 892 forks source link

Volar language server does not start for fresh Vue project #3559

Open ItsHoff opened 2 years ago

ItsHoff commented 2 years ago

Thank you for the bug report

Bug description

Volar language server does not start for a fresh Vue project.

Steps to reproduce

  1. Create a fresh Vue project npm init vue@latest
  2. Open a Vue file (for example, src/App.vue)

Expected behavior

Volar server is started, or Volar offered in the list of servers that can be installed.

Which Language Server did you use?

lsp-volar

OS

Windows

Error callstack

N/A

Anything else?

It seems that lsp-volar--activate-p expects to find lsp-workspace-root (https://github.com/emacs-lsp/lsp-mode/blob/358b5df8df10b4837193af78c2e72df2c381b1fa/clients/lsp-volar.el#L118-L128), which in this case is nil. If the project root is added using lsp-workspace-folders-add then Volar starts as expected.

yyoncho commented 2 years ago

That is a known limitation, we should restructure lsp-mode to pick project root before checking if there is server matching the current file.

dirodriguezm commented 2 years ago

@yyoncho Is there a workaround for this limitation ?

yyoncho commented 2 years ago

@dirodriguezm the workaround is in the report description - use lsp-workspace-folders-add before opening the project