Skip to content
This repository was archived by the owner on Jul 31, 2023. It is now read-only.

Commit 4570cf9

Browse files
committed
lsp: use if statement instead of when-unless
This fixes a linting error and also fixes the wrong method being used for the callback: lsp-python-ms--language-server-started was being used instead of lsp-python-ms--language-server-started-callback. That was most likely due to a bad merge from #3.
1 parent 2d430f5 commit 4570cf9

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

lsp-python-ms.el

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,16 @@ WORKSPACE is just used for logging and _PARAMS is unused."
154154
(list (lsp-python-ms--find-dotnet)
155155
(concat lsp-python-ms-dir "Microsoft.Python.LanguageServer.dll"))))
156156

157-
;;; Old lsp-mode
158-
(unless (fboundp 'lsp-register-client)
157+
(if (fboundp 'lsp-register-client)
158+
;; New lsp-mode
159+
(lsp-register-client
160+
(make-lsp-client
161+
:new-connection (lsp-stdio-connection 'lsp-python-ms--command-string)
162+
:major-modes '(python-mode)
163+
:server-id 'mspyls
164+
:initialization-options 'lsp-python-ms--extra-init-params
165+
:notification-handlers (lsp-ht ("python/languageServerStarted" 'lsp-python-ms--language-server-started-callback))))
166+
;; Old lsp-mode
159167
(lsp-define-stdio-client
160168
lsp-python "python"
161169
#'lsp-python-ms--workspace-root
@@ -164,18 +172,6 @@ WORKSPACE is just used for logging and _PARAMS is unused."
164172
:extra-init-params #'lsp-python-ms--extra-init-params
165173
:initialize #'lsp-python-ms--client-initialized))
166174

167-
;;; New lsp-mode
168-
(when (fboundp 'lsp-register-client)
169-
(lsp-register-client
170-
(make-lsp-client
171-
:new-connection (lsp-stdio-connection 'lsp-python-ms--command-string)
172-
:major-modes '(python-mode)
173-
:server-id 'mspyls
174-
:initialization-options 'lsp-python-ms--extra-init-params
175-
:notification-handlers (lsp-ht ("python/languageServerStarted" 'lsp-python-ms--language-server-started))
176-
)))
177-
178-
179175
(provide 'lsp-python-ms)
180176

181177
;;; lsp-python-ms.el ends here

0 commit comments

Comments
 (0)