Skip to content

Commit 17e583c

Browse files
authored
fix(ts-ls): node_modules has different path on different platforms (#4389)
1 parent d1411d9 commit 17e583c

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

clients/lsp-javascript.el

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -791,16 +791,19 @@ name (e.g. `data' variable passed as `data' parameter)."
791791
(eq 'initialized (lsp--workspace-status workspace))))
792792

793793
(defun lsp-clients-typescript-project-ts-server-path ()
794+
"Return the project local TS server path."
794795
(f-join (lsp-workspace-root) "node_modules" "typescript" "lib" "tsserver.js"))
795796

796797
(defun lsp-clients-typescript-server-path ()
798+
"Return the TS sever path base on settings."
797799
(cond
798-
((and
799-
lsp-clients-typescript-prefer-use-project-ts-server
800-
(f-exists? (lsp-clients-typescript-project-ts-server-path)))
800+
((and lsp-clients-typescript-prefer-use-project-ts-server
801+
(f-exists? (lsp-clients-typescript-project-ts-server-path)))
801802
(lsp-clients-typescript-project-ts-server-path))
802803
(t
803-
(f-join (f-parent (lsp-package-path 'typescript)) "node_modules" "typescript" "lib"))))
804+
(if (memq system-type '(cygwin windows-nt ms-dos))
805+
(f-join (f-parent (lsp-package-path 'typescript)) "node_modules" "typescript" "lib")
806+
(f-join (f-parent (f-parent (lsp-package-path 'typescript))) "lib" "node_modules" "typescript" "lib")))))
804807

805808
(lsp-register-client
806809
(make-lsp-client :new-connection (lsp-stdio-connection (lambda ()
@@ -1008,15 +1011,15 @@ Examples: `./import-map.json',
10081011

10091012
(defun lsp-clients-deno--make-init-options ()
10101013
"Initialization options for the Deno language server."
1011-
`(:enable t
1012-
:config ,lsp-clients-deno-config
1013-
:importMap ,lsp-clients-deno-import-map
1014-
:lint ,(lsp-json-bool lsp-clients-deno-enable-lint)
1015-
:unstable ,(lsp-json-bool lsp-clients-deno-enable-unstable)
1016-
:codeLens (:implementations ,(lsp-json-bool lsp-clients-deno-enable-code-lens-implementations)
1017-
:references ,(lsp-json-bool (or lsp-clients-deno-enable-code-lens-references
1018-
lsp-clients-deno-enable-code-lens-references-all-functions))
1019-
:referencesAllFunctions ,(lsp-json-bool lsp-clients-deno-enable-code-lens-references-all-functions))))
1014+
`( :enable t
1015+
:config ,lsp-clients-deno-config
1016+
:importMap ,lsp-clients-deno-import-map
1017+
:lint ,(lsp-json-bool lsp-clients-deno-enable-lint)
1018+
:unstable ,(lsp-json-bool lsp-clients-deno-enable-unstable)
1019+
:codeLens ( :implementations ,(lsp-json-bool lsp-clients-deno-enable-code-lens-implementations)
1020+
:references ,(lsp-json-bool (or lsp-clients-deno-enable-code-lens-references
1021+
lsp-clients-deno-enable-code-lens-references-all-functions))
1022+
:referencesAllFunctions ,(lsp-json-bool lsp-clients-deno-enable-code-lens-references-all-functions))))
10201023

10211024
(lsp-register-client
10221025
(make-lsp-client :new-connection

0 commit comments

Comments
 (0)