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 does not start if `vue` is listed in `devDependencies` #3449

Open maxminoS opened 2 years ago

maxminoS commented 2 years ago

Thank you for the bug report

Bug description

The Volar language server for Vue does not open .vue files if vue is not listed in dependencies in package.json. It does not take into account that, while abnormal, vue can also be listed in devDependencies.

Steps to reproduce

Open .vue file when vue is listed in devDependencies

Expected behavior

Volar language servers should start

Which Language Server did you use?

eslint and volar (volar-html, volar-api, volar-doc)

OS

MacOS

Error callstack

No response

Anything else?

I have checked that this error occurs at the function lsp-volar--vue-project-p, with the help of @yyoncho . Possible solutions would be to either add devDependencies detection onto the function, check whether or not Vue exists in node_modules/, use .vue extension, or somehow leverage all of these methods to determine whether or not to start it.

sdvcrx commented 2 years ago

A simple workaround perhaps is creating a .volarrc file at the project root:

https://emacs-lsp.github.io/lsp-mode/page/lsp-volar/#lsp-volar-activate-file

BenKrocke commented 1 year ago

The same issue applies when vue is not present in the devDeps or deps, but instead as a subDep of a package like Nuxt.

Do we know if there is any reason to why it specifically looks for Vue in the package.json instead of taking a likeness to the lsp-vetur detection?