Skip to content

Commit 33946e5

Browse files
authored
Add support for Deno language server (#2607)
* Add support for Deno's language server * Fix doc lint errors * Add :package-version to defcustom vars and fix typo
1 parent 39687fe commit 33946e5

File tree

3 files changed

+113
-0
lines changed

3 files changed

+113
-0
lines changed

CHANGELOG.org

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
* Add ActionScript support.
2222
* Add ~iedit~ integration (=documentHighlights=)
2323
* Add an interactive =lsp-clangd-find-other-file= method that uses the clangd extension to return the corresponding header/cpp file from cpp/header file respectively.
24+
* Add support for [[https://deno.land/][Deno language server]].
2425
** Release 7.0.1
2526
* Introduced ~lsp-diagnostics-mode~.
2627
* Safe renamed ~lsp-flycheck-default-level~ -> ~lsp-diagnostics-flycheck-default-level~

clients/lsp-javascript.el

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,5 +206,110 @@ particular FILE-NAME and MODE."
206206
:activation-fn 'lsp-clients-flow-activate-p
207207
:server-id 'flow-ls))
208208

209+
(defgroup lsp-deno nil
210+
"LSP support for the Deno language server."
211+
:group 'lsp-mode
212+
:link '(url-link "https://deno.land/"))
213+
214+
(defcustom lsp-clients-deno-server "deno"
215+
"The Deno executable to use.
216+
Leave as just the executable name to use the default behavior of
217+
finding the executable with variable `exec-path'."
218+
:group 'lsp-deno
219+
:risky t
220+
:type 'file
221+
:package-version '(lsp-mode . "7.1.0"))
222+
223+
(defcustom lsp-clients-deno-server-args '("lsp")
224+
"Extra arguments for starting the Deno language server."
225+
:group 'lsp-deno
226+
:risky t
227+
:type '(repeat string)
228+
:package-version '(lsp-mode . "7.1.0"))
229+
230+
(defcustom lsp-clients-deno-enable-lint t
231+
"Controls if linting information will be provided by the Deno Language Server."
232+
:group 'lsp-deno
233+
:risky t
234+
:type 'boolean
235+
:package-version '(lsp-mode . "7.1.0"))
236+
237+
(defcustom lsp-clients-deno-enable-code-lens-references t
238+
"Enables or disables the display of code lens information."
239+
:group 'lsp-deno
240+
:risky t
241+
:type 'boolean
242+
:package-version '(lsp-mode . "7.1.0"))
243+
244+
(defcustom lsp-clients-deno-enable-code-lens-references-all-functions t
245+
"Enables or disables the display of code lens information for all functions.
246+
Setting this variable to `non-nil' implicitly enables
247+
`lsp-clients-deno-enable-code-lens-references'."
248+
:group 'lsp-deno
249+
:risky t
250+
:type 'boolean
251+
:package-version '(lsp-mode . "7.1.0"))
252+
253+
(defcustom lsp-clients-deno-enable-code-lens-implementations t
254+
"Enables or disables the display of code lens information for implementations."
255+
:group 'lsp-deno
256+
:risky t
257+
:type 'boolean
258+
:package-version '(lsp-mode . "7.1.0"))
259+
260+
(defcustom lsp-clients-deno-config nil
261+
"The file path to a tsconfig.json file.
262+
The path can be either be relative to the workspace, or an
263+
absolute path.
264+
265+
Examples: `./tsconfig.json',
266+
`/path/to/tsconfig.json', `C:\\path\\to\\tsconfig.json'"
267+
:group 'lsp-deno
268+
:risky t
269+
:type 'file
270+
:package-version '(lsp-mode . "7.1.0"))
271+
272+
(defcustom lsp-clients-deno-import-map nil
273+
"The file path to an import map.
274+
Import maps provide a way to relocate modules based on their
275+
specifiers. The path can either be relative to the workspace, or
276+
an absolute path.
277+
278+
Examples: `./import-map.json',
279+
`/path/to/import-map.json', `C:\\path\\to\\import-map.json'."
280+
:group 'lsp-deno
281+
:risky t
282+
:type 'file
283+
:package-version '(lsp-mode . "7.1.0"))
284+
285+
(defcustom lsp-clients-deno-enable-unstable nil
286+
"Controls if code will be type checked with Deno's unstable APIs."
287+
:group 'lsp-deno
288+
:risky t
289+
:type 'boolean
290+
:package-version '(lsp-mode . "7.1.0"))
291+
292+
(defun lsp-clients-deno--make-init-options ()
293+
"Initialization options for the Deno language server."
294+
`(:enable t
295+
:config ,lsp-clients-deno-config
296+
:importMap ,lsp-clients-deno-import-map
297+
:lint ,(lsp-json-bool lsp-clients-deno-enable-lint)
298+
:unstable ,(lsp-json-bool lsp-clients-deno-enable-unstable)
299+
:codeLens (:implementations ,(lsp-json-bool lsp-clients-deno-enable-code-lens-implementations)
300+
:references ,(lsp-json-bool (or lsp-clients-deno-enable-code-lens-references
301+
lsp-clients-deno-enable-code-lens-references-all-functions))
302+
:referencesAllFunctions ,(lsp-json-bool lsp-clients-deno-enable-code-lens-references-all-functions))))
303+
304+
(lsp-register-client
305+
(make-lsp-client :new-connection
306+
(lsp-stdio-connection (lambda ()
307+
(cons lsp-clients-deno-server
308+
lsp-clients-deno-server-args)))
309+
:initialization-options #'lsp-clients-deno--make-init-options
310+
:priority -5
311+
:activation-fn #'lsp-typescript-javascript-tsx-jsx-activate-p
312+
:server-id 'deno-ls))
313+
209314
(provide 'lsp-javascript)
210315
;;; lsp-javascript.el ends here

docs/lsp-clients.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,13 @@
228228
"lsp-install-server": "js-ts",
229229
"debugger": "Yes (Firefox/Chrome)"
230230
},
231+
{
232+
"name": "deno",
233+
"full-name": "Deno",
234+
"server-name": "deno lsp",
235+
"server-url": "https://deno.land/#installation",
236+
"debugger": "Yes (Chrome)"
237+
},
231238
{
232239
"name": "json",
233240
"full-name": "Json",

0 commit comments

Comments
 (0)