Closed stradicat closed 4 months ago
It looks like an upstream issue? https://github.com/emacs-lsp/lsp-mode/issues/4254
As a workaround, I fiddled with my PATH
variables in .zshrc
, and reimported them into .spacemacs.env
, so lsp
detects nvm
and makes ts-ls
work.
Since it's an upstream issue, I'm closing this. Thanks for the heads-up! I'll follow your referenced issue.
Edit: I'll reopen it to add more feedback, in case macOS behaves a bit differently from Linux.
Hi @stradicat,
1) Do you get a message in the lsp-log buffer with something like
Typescript specified through user setting ignored due to invalid path ..completely_wrong_path..
?
If you get this information, I would suggest to close this issue and report your PATH problem to the linked issue, since you also consider it to be not a spacemacs but upstream one.
2) For the nvm installation it looks like you have to update the .spacemacs.env anyway, unless you find a package which would manage the node PATH for you, so basically you did solve your problem. But I suspect that the LSP is probably using the globally installed typescript
and not the one from .emacs.d/.cache/...
.
Hey @alexey0308,
I am indeed getting the error on 1. :
[lspserver] Typescript specified through user setting ignored due to invalid path "/Users/my_user/Projects/Project_Dir/lib/tsserver.js"
In the end, changing the order of the PATH
exports in .zshrc
to be picked up by Emacs in .spacemacs.env
kind of made lsp
pick up typescript
(probably the global install).
I've also had problems with vue-semantic-server
and rust-analyzer
, which were apparently resolved with the PATH
reorder.
I guess I'm closing the issue. Thanks again for looking into it.
@stradicat
I am facing the same problem could you share what you .zshrc and .spacemacs.env change in here, it will help making it clear about what you change, thanks ya.
Description :octocat:
Whenever I load a javascript project, I see this message and
lsp
fails to autocomplete or syntax-check:As
lsp
backend for thejavascript
layer, I'm usingts-ls
as recommended.Node is installed via NVM, and its path is already both in
~/.zshrc
and~/.spacemacs.env
;node
is available:NVM's
bin
location was already picked up inspacemacs.env
:Inside Emacs, the
typescript
package is installed bylsp-install-server
alongtypescript-language-server
when choosingts-ls
as backend (expected, correct behaviour), and both are stored by default under~/.emacs.d/.cache/lsp/npm/
.For comparison, installing
javascript-language-server
brings some basic autocompletion and syntax-checking, although it's deprecated already.I've removed every
lsp
language server under~/.emacs.d/.cache/lsp
to freshly installts-ls
.For reference, here are my user session's globally installed node modules, in case any of them could interfere:
Reproduction guide :beetle:
.js
file from a projectTAB
to bring up completion pop-up.Observed behaviour: :eyes: :broken_heart: No completion or syntax-checking
Expected behaviour: :heart: :smile: Auto-completion and syntax-checking
System Info :computer: