Open daut opened 10 months ago
You may fix this out if you do M-: (lsp-package-ensure 'typescript nil nil) RET
@yyoncho thanks for trying to help!
Unfortunately this didn't resolve the issue. I can see typescript present inside ~/.emacs.d/var/lsp/server/npm
but still seeing the same error.
As a temporary workaround I was able to place typescript folder inside project's node_modules
folder, but would like to find a way to resolve the issue without having to install typescript for each project.
would something like this work?
(lsp-register-custom-settings '(("typescript.tsdk" "/opt/homebrew/lib/node_modules/typescript" t)
I also got bothered by the same problem and spent a couple of hours locating the problem.
Firstly, the typescript
dependency is defined as follows:
(lsp-dependency 'typescript
'(:system "tsserver")
'(:npm :package "typescript"
:path "tsserver"))
This means that it first attempts to find the tsserver
binary in the system
. If it exists, the path to it is returned.
If it doesn't exist, it then returns the tsserver
installed in lsp-server-install-dir
.
In Doom Emacs or OP @Daut's configuration, node_modules/.bin
is added to $PATH
. This causes (lsp-package-path 'typescript)
to hit the :system
condition (as the file project/node_modules/.bin/tsserver
exists).
So, the workaround is as follows:
(after! lsp-volar
;; remove :system after lsp-volar loaded
(lsp-dependency 'typescript
'(:npm :package "typescript"
:path "tsserver")))
I've also noticed another issue: the behavior of lsp--system-path doesn't align with its documentation,
Otherwise, return the absolute path to the executable defined by PATH or nil
However, in reality, (lsp--system-path "tsserver")
returns tsserver
instead of the absolute path. cc @yyoncho
I also encountered some issues with the typescript-language server
. I've tried M-x lsp-describe-session
, and everything shown to be working, but I couldn't get the completion to work. 🤔
I also got bothered by the same problem and spent a couple of hours locating the problem.
Firstly, the
typescript
dependency is defined as follows:(lsp-dependency 'typescript '(:system "tsserver") '(:npm :package "typescript" :path "tsserver"))
This means that it first attempts to find the
tsserver
binary in thesystem
. If it exists, the path to it is returned.If it doesn't exist, it then returns the
tsserver
installed inlsp-server-install-dir
.In Doom Emacs or OP @Daut's configuration,
node_modules/.bin
is added to$PATH
. This causes(lsp-package-path 'typescript)
to hit the:system
condition (as the fileproject/node_modules/.bin/tsserver
exists).So, the workaround is as follows:
(after! lsp-volar ;; remove :system after lsp-volar loaded (lsp-dependency 'typescript '(:npm :package "typescript" :path "tsserver")))
I've also noticed another issue: the behavior of lsp--system-path doesn't align with its documentation,
Otherwise, return the absolute path to the executable defined by PATH or nil
However, in reality,
(lsp--system-path "tsserver")
returnstsserver
instead of the absolute path. cc @yyoncho
Thanks @sdvcrx! That solved it for me.
This is solved by installing typescript-language-server via npm.: npm install -g typescript-language-server
.
Thank you for the bug report
lsp-mode
related packages.M-x lsp-start-plain
Bug description
Getting the following error even though typescript is installed globally
I'm using brew on Mac OS to install packages. This is the path to global installation of typescript
Steps to reproduce
.vue
fileExpected behavior
lsp-volar should detect typescript installed globally.
Which Language Server did you use?
lsp-volar
OS
MacOS
Error callstack
No response
Anything else?
No response