Add embark target for LSP identifiers w/ binding for code actions

This commit is contained in:
Jeremy Dormitzer 2022-04-01 10:26:05 -04:00
parent 9b5f71fcc1
commit 2d38afd418

View File

@ -81,6 +81,19 @@ targets."
("k" password-store-remove)
("U" password-store-url))
(add-to-list 'embark-keymap-alist '(password-store . embark-password-store-actions))
;; Add identifiers in LSP-mode as their own target type
(with-eval-after-load 'lsp-mode
(defun embark-target-lsp-identifier-at-point ()
(when lsp-mode
(when-let ((sym (embark-target-identifier-at-point)))
(cons 'lsp-identifier (cdr sym)))))
(add-to-list 'embark-target-finders 'embark-target-lsp-identifier-at-point)
(embark-define-keymap embark-lsp-identifier-actions
"Keymap for actions on LSP identifiers."
:parent embark-identifier-map
("a" lsp-execute-code-action))
(add-to-list 'embark-keymap-alist '(lsp-identifier . embark-lsp-identifier-actions))
(add-to-list 'embark-target-injection-hooks '(lsp-execute-code-action embark--ignore-target)))
:general
("C-." #'embark-act)
("M-." #'embark-dwim)