Skip to content

Commit f491974

Browse files
authored
lsp-javascript: add tsgo server (#4929)
1 parent a7dd7f8 commit f491974

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

clients/lsp-javascript.el

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@
7272
(warn (concat "The javascript-typescript-langserver (jsts-ls) is unmaintained; "
7373
"it is recommended to use ts-ls or deno-ls instead.")))))
7474

75+
76+
7577
(defgroup lsp-typescript nil
7678
"LSP support for TypeScript, using Theia/Typefox's TypeScript Language Server."
7779
:group 'lsp-mode
@@ -881,6 +883,7 @@ to run the command in."
881883
error-callback)
882884
error-callback))))
883885

886+
884887

885888
(defgroup lsp-flow nil
886889
"LSP support for the Flow Javascript type checker."
@@ -956,6 +959,8 @@ particular FILE-NAME and MODE."
956959
:activation-fn 'lsp-clients-flow-activate-p
957960
:server-id 'flow-ls))
958961

962+
963+
959964
(defgroup lsp-deno nil
960965
"LSP support for the Deno language server."
961966
:group 'lsp-mode
@@ -1061,6 +1066,47 @@ Examples: `./import-map.json',
10611066
:activation-fn #'lsp-typescript-javascript-tsx-jsx-activate-p
10621067
:server-id 'deno-ls))
10631068

1069+
1070+
1071+
(defgroup lsp-tsgo nil
1072+
"LSP support for the TypeScript (Go native) language server."
1073+
:group 'lsp-mode
1074+
:link '(url-link "https://github.com/microsoft/typescript-go"))
1075+
1076+
(defcustom lsp-clients-tsgo-path "tsgo"
1077+
"Path to the tsgo binary."
1078+
:group 'lsp-tsgo
1079+
:risky t
1080+
:type 'string)
1081+
1082+
(defcustom lsp-clients-tsgo-args '("--lsp" "--stdio")
1083+
"Extra arguments for the tsgo language server."
1084+
:group 'lsp-tsgo
1085+
:risky t
1086+
:type '(repeat string))
1087+
1088+
(lsp-dependency 'tsgo
1089+
'(:system lsp-clients-tsgo-path)
1090+
'(:npm :package "@typescript/native-preview"
1091+
:path "tsgo"))
1092+
1093+
(lsp-register-client
1094+
(make-lsp-client :new-connection (lsp-stdio-connection (lambda ()
1095+
`(,(lsp-package-path 'tsgo)
1096+
,@lsp-clients-tsgo-args)))
1097+
:activation-fn 'lsp-typescript-javascript-tsx-jsx-activate-p
1098+
:priority -4
1099+
:completion-in-comments? t
1100+
:initialized-fn (lambda (_workspace))
1101+
:server-id 'tsgo
1102+
:download-server-fn (lambda (_client callback error-callback _update?)
1103+
(lsp-package-ensure
1104+
'tsgo
1105+
callback
1106+
error-callback))))
1107+
1108+
1109+
10641110
(lsp-consistency-check lsp-javascript)
10651111

10661112
(provide 'lsp-javascript)

0 commit comments

Comments
 (0)