Skip to content

Commit

Permalink
Send settings on client initialization (#125)
Browse files Browse the repository at this point in the history
Send settings on LSP client initialization.  Note jsonnet-language-server is unusual and expects configuration without a prefix.  This is probably a bug in jsonnet-language-server, but this PR works with the existing code by passing through the "jsonnet" settings subtree, without the "jsonnet" prefix.

Example:
```elisp
;; .emacs
(lsp-register-custom-settings
 '(("jsonnet.formatting"
   ;; jsonnetfmt --string-style d --comment-style s
   ((StringStyle . "double")
    (CommentStyle . "slash")))))
```
  • Loading branch information
anguslees authored Sep 8, 2023
1 parent 02d502b commit ebc2b49
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions editor/emacs/jsonnet-language-server.el
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
(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.
Expand Down

0 comments on commit ebc2b49

Please sign in to comment.