summary refs log tree commit diff stats
path: root/user/emacs
diff options
context:
space:
mode:
authorAlan Pearce2024-06-25 10:41:53 +0200
committerAlan Pearce2024-06-25 10:41:53 +0200
commitc9ab8eff28536cd11aab21175faf6d7c9fb4c2a6 (patch)
tree6ed8a8f8aa7e15e4d0eef9c42bd2885cf27d1213 /user/emacs
parente8e28f1b15ec8c16df739b1d3933961c0f450fb4 (diff)
downloadnixfiles-c9ab8eff28536cd11aab21175faf6d7c9fb4c2a6.tar.lz
nixfiles-c9ab8eff28536cd11aab21175faf6d7c9fb4c2a6.tar.zst
nixfiles-c9ab8eff28536cd11aab21175faf6d7c9fb4c2a6.zip
emacs: bind <leader>a to code actions provided by eglot/lsp-mode
Diffstat (limited to 'user/emacs')
-rw-r--r--user/emacs/init.el7
1 files changed, 7 insertions, 0 deletions
diff --git a/user/emacs/init.el b/user/emacs/init.el
index b559f843..b666e033 100644
--- a/user/emacs/init.el
+++ b/user/emacs/init.el
@@ -1216,6 +1216,12 @@ _C-k_: prev  _u_pper              _=_: upper/lower       _s_mart resolve
       (call-interactively #'consult-lsp-symbols)
     (call-interactively #'consult-eglot-symbols)))
 
+(defun my/ls-code-actions ()
+  (interactive)
+  (call-interactively
+   (if lsp-mode
+       #'lsp-execute-code-action
+     #'eglot-code-actions)))
 
 ;;;; Reformat on save
 
@@ -1270,6 +1276,7 @@ _C-k_: prev  _u_pper              _=_: upper/lower       _s_mart resolve
   "s" #'treemacs-select-window
   "u" #'universal-argument
   ";" #'execute-extended-command
+  "a" #'my/ls-code-actions
   "bb" #'consult-buffer
   "bx" #'kill-this-buffer
   "br" #'revert-buffer