-
Notifications
You must be signed in to change notification settings - Fork 20
/
jsonnet-language-server.el
32 lines (27 loc) · 1.12 KB
/
jsonnet-language-server.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
;;; jsonnet-language-server -- LSP registration for Emacs lsp-mode.
;;; Commentary:
;;; Code:
(require 'jsonnet-mode)
(require 'lsp-mode)
(defcustom lsp-jsonnet-executable "jsonnet-language-server"
"Command to start the Jsonnet language server."
:group 'lsp-jsonnet
:risky t
:type 'file)
;; Configure lsp-mode language identifiers.
(add-to-list 'lsp-language-id-configuration '(jsonnet-mode . "jsonnet"))
;; Register jsonnet-language-server with the LSP client.
(lsp-register-client
(make-lsp-client
:new-connection (lsp-stdio-connection (lambda () lsp-jsonnet-executable))
:activation-fn (lsp-activate-on "jsonnet")
:initialized-fn (lambda (workspace)
(with-lsp-workspace workspace
(lsp--set-configuration
;; TODO: jsonnet-language-server settings should use a prefix
(ht-get (lsp-configuration-section "jsonnet") "jsonnet"))))
:server-id 'jsonnet))
;; Start the language server whenever jsonnet-mode is used.
(add-hook 'jsonnet-mode-hook #'lsp-deferred)
(provide 'jsonnet-language-server)
;;; jsonnet-language-server.el ends here