From b73d4498fb7e6b9297c9c38bbbb295b810a13125 Mon Sep 17 00:00:00 2001 From: JenChieh Date: Fri, 22 Mar 2024 20:20:11 -0700 Subject: [PATCH 1/2] fix(ts-ls): node_modules has different path on different platforms --- clients/lsp-javascript.el | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/clients/lsp-javascript.el b/clients/lsp-javascript.el index 54404d5eae..bc99038198 100644 --- a/clients/lsp-javascript.el +++ b/clients/lsp-javascript.el @@ -791,16 +791,19 @@ name (e.g. `data' variable passed as `data' parameter)." (eq 'initialized (lsp--workspace-status workspace)))) (defun lsp-clients-typescript-project-ts-server-path () + "Return the project local TS server path." (f-join (lsp-workspace-root) "node_modules" "typescript" "lib" "tsserver.js")) (defun lsp-clients-typescript-server-path () + "Return the TS sever path base on settings." (cond - ((and - lsp-clients-typescript-prefer-use-project-ts-server - (f-exists? (lsp-clients-typescript-project-ts-server-path))) + ((and lsp-clients-typescript-prefer-use-project-ts-server + (f-exists? (lsp-clients-typescript-project-ts-server-path))) (lsp-clients-typescript-project-ts-server-path)) (t - (f-join (f-parent (lsp-package-path 'typescript)) "node_modules" "typescript" "lib")))) + (if (memq system-type '(cygwin windows-nt ms-dos)) + (f-join (f-parent (lsp-package-path 'typescript)) "node_modules" "typescript" "lib") + (f-join (f-parent (f-parent (lsp-package-path 'typescript))) "lib" "node_modules" "typescript" "lib"))))) (lsp-register-client (make-lsp-client :new-connection (lsp-stdio-connection (lambda () @@ -1009,14 +1012,14 @@ Examples: `./import-map.json', (defun lsp-clients-deno--make-init-options () "Initialization options for the Deno language server." `(:enable t - :config ,lsp-clients-deno-config - :importMap ,lsp-clients-deno-import-map - :lint ,(lsp-json-bool lsp-clients-deno-enable-lint) - :unstable ,(lsp-json-bool lsp-clients-deno-enable-unstable) - :codeLens (:implementations ,(lsp-json-bool lsp-clients-deno-enable-code-lens-implementations) - :references ,(lsp-json-bool (or lsp-clients-deno-enable-code-lens-references - lsp-clients-deno-enable-code-lens-references-all-functions)) - :referencesAllFunctions ,(lsp-json-bool lsp-clients-deno-enable-code-lens-references-all-functions)))) + :config ,lsp-clients-deno-config + :importMap ,lsp-clients-deno-import-map + :lint ,(lsp-json-bool lsp-clients-deno-enable-lint) + :unstable ,(lsp-json-bool lsp-clients-deno-enable-unstable) + :codeLens (:implementations ,(lsp-json-bool lsp-clients-deno-enable-code-lens-implementations) + :references ,(lsp-json-bool (or lsp-clients-deno-enable-code-lens-references + lsp-clients-deno-enable-code-lens-references-all-functions)) + :referencesAllFunctions ,(lsp-json-bool lsp-clients-deno-enable-code-lens-references-all-functions)))) (lsp-register-client (make-lsp-client :new-connection From 6b27803264cc6700a6465482c44386a9dae6e278 Mon Sep 17 00:00:00 2001 From: JenChieh Date: Fri, 22 Mar 2024 20:21:32 -0700 Subject: [PATCH 2/2] fix indentation --- clients/lsp-javascript.el | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/clients/lsp-javascript.el b/clients/lsp-javascript.el index bc99038198..96a1213377 100644 --- a/clients/lsp-javascript.el +++ b/clients/lsp-javascript.el @@ -1011,15 +1011,15 @@ Examples: `./import-map.json', (defun lsp-clients-deno--make-init-options () "Initialization options for the Deno language server." - `(:enable t - :config ,lsp-clients-deno-config - :importMap ,lsp-clients-deno-import-map - :lint ,(lsp-json-bool lsp-clients-deno-enable-lint) - :unstable ,(lsp-json-bool lsp-clients-deno-enable-unstable) - :codeLens (:implementations ,(lsp-json-bool lsp-clients-deno-enable-code-lens-implementations) - :references ,(lsp-json-bool (or lsp-clients-deno-enable-code-lens-references - lsp-clients-deno-enable-code-lens-references-all-functions)) - :referencesAllFunctions ,(lsp-json-bool lsp-clients-deno-enable-code-lens-references-all-functions)))) + `( :enable t + :config ,lsp-clients-deno-config + :importMap ,lsp-clients-deno-import-map + :lint ,(lsp-json-bool lsp-clients-deno-enable-lint) + :unstable ,(lsp-json-bool lsp-clients-deno-enable-unstable) + :codeLens ( :implementations ,(lsp-json-bool lsp-clients-deno-enable-code-lens-implementations) + :references ,(lsp-json-bool (or lsp-clients-deno-enable-code-lens-references + lsp-clients-deno-enable-code-lens-references-all-functions)) + :referencesAllFunctions ,(lsp-json-bool lsp-clients-deno-enable-code-lens-references-all-functions)))) (lsp-register-client (make-lsp-client :new-connection