Override lsp-mode code action autoselect

This commit is contained in:
outfoxxed 2023-08-13 16:56:37 -07:00
parent 7821b7b605
commit a254cc2951
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E

16
init.el
View file

@ -348,3 +348,19 @@
(lambda (&optional count file) (hyprctl "hy3:movefocus" "u"))) (lambda (&optional count file) (hyprctl "hy3:movefocus" "u")))
(advice-add #'evil-window-down :override (advice-add #'evil-window-down :override
(lambda (&optional count file) (hyprctl "hy3:movefocus" "d"))) (lambda (&optional count file) (hyprctl "hy3:movefocus" "d")))
;;; Overrides
;; stop lsp-mode from yoloing code actions when only one is present
(defun lsp--select-action (actions)
"Select an action to execute from ACTIONS."
(cond
((seq-empty-p actions) (signal 'lsp-no-code-actions nil))
;;((and (eq (seq-length actions) 1) lsp-auto-execute-action)
;;(lsp-seq-first actions))
(t (let ((completion-ignore-case t))
(lsp--completing-read "Select code action: "
(seq-into actions 'list)
(-compose (lsp--create-unique-string-fn)
#'lsp:code-action-title)
nil t)))))