Skip to content

Commit 75d9820

Browse files
committed
Use initialized-fn instead of hook.
This makes lsp-haskell to set configuration only for hie server.
1 parent 6d481f9 commit 75d9820

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

lsp-haskell.el

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -179,17 +179,18 @@ These are assembled from the customizable variables
179179
(append (list lsp-haskell-process-path-hie "--lsp") lsp-haskell-process-args-hie) )
180180

181181
;; ---------------------------------------------------------------------
182-
;; Supporting the new lsp.el operation, as per
183-
;; https://github.com/emacs-lsp/lsp-mode/blob/master/README-NEXT.md
184-
185-
(eval-after-load 'lsp '(lsp-register-client
186-
(make-lsp--client
187-
:new-connection (lsp-stdio-connection (lambda () (lsp-haskell--hie-command)))
188-
:major-modes '(haskell-mode)
189-
:server-id 'hie
190-
;; :multi-root t
191-
;; :initialization-options 'lsp-haskell--make-init-options
192-
)))
182+
183+
(lsp-register-client
184+
(make-lsp--client
185+
:new-connection (lsp-stdio-connection (lambda () (lsp-haskell--hie-command)))
186+
:major-modes '(haskell-mode)
187+
:server-id 'hie
188+
:initialized-fn (lambda (workspace)
189+
(with-lsp-workspace workspace
190+
(lsp-haskell--set-configuration)))
191+
;; :multi-root t
192+
;; :initialization-options 'lsp-haskell--make-init-options
193+
))
193194

194195
(defun lsp-haskell--hie-command ()
195196
(funcall lsp-haskell-process-wrapper-function (lsp--haskell-hie-command)))
@@ -207,8 +208,6 @@ These are assembled from the customizable variables
207208
(defun lsp-haskell--set-configuration ()
208209
(lsp--set-configuration `(:languageServerHaskell ,lsp-haskell--config-options)))
209210

210-
(add-hook 'lsp-after-initialize-hook 'lsp-haskell--set-configuration)
211-
212211
(defun lsp-haskell-set-config (name option)
213212
"Set config option NAME to value OPTION in the haskell lsp server."
214213
(puthash name option lsp-haskell--config-options))

0 commit comments

Comments
 (0)