show all available lsp servers when switching (#5191)

* show all available lsp servers

show all available lsp servers instead of only high priority ones

* fixes +lsp/switch-client priority reset

now waits for lsp to initialize before restoring the default client priority
This commit is contained in:
Lordie 2021-07-24 19:28:07 -03:00 committed by GitHub
parent b540ad5311
commit 22e6912846
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -28,7 +28,8 @@
(require 'lsp-mode) (require 'lsp-mode)
(list (completing-read (list (completing-read
"Select server: " "Select server: "
(or (mapcar #'lsp--client-server-id (lsp--find-clients)) (or (mapcar #'lsp--client-server-id (lsp--filter-clients (-andfn #'lsp--matching-clients?
#'lsp--server-binary-present?)))
(user-error "No available LSP clients for %S" major-mode)))))) (user-error "No available LSP clients for %S" major-mode))))))
(require 'lsp-mode) (require 'lsp-mode)
(let* ((client (if (symbolp client) client (intern client))) (let* ((client (if (symbolp client) client (intern client)))
@ -48,7 +49,8 @@
nil t) nil t)
(car workspaces))) (car workspaces)))
(lsp-mode +1)) (lsp-mode +1))
(setf (lsp--client-priority match) old-priority))))) (add-transient-hook! 'lsp-after-initialize-hook
(setf (lsp--client-priority match) old-priority))))))
;;;###autoload ;;;###autoload
(defun +lsp-lookup-definition-handler () (defun +lsp-lookup-definition-handler ()