tools/lsp: lazy load <leader> c l keybind
Fixes a issue where folks would try to rebind <leader> c, only to get a non-prefix key error about <leader> c l.
This commit is contained in:
parent
362f101227
commit
841eacc77d
4 changed files with 51 additions and 39 deletions
|
@ -47,8 +47,7 @@
|
|||
:desc "LSP Code actions" "a" #'lsp-execute-code-action
|
||||
:desc "LSP Organize imports" "o" #'lsp-organize-imports
|
||||
:desc "LSP Rename" "r" #'lsp-rename
|
||||
(:after lsp-mode
|
||||
:desc "LSP" "l" lsp-command-map)
|
||||
:desc "LSP" "l" #'+default/lsp-command-map
|
||||
(:when (featurep! :completion ivy)
|
||||
:desc "Jump to symbol in current workspace" "j" #'lsp-ivy-workspace-symbol
|
||||
:desc "Jump to symbol in any workspace" "J" #'lsp-ivy-global-workspace-symbol)
|
||||
|
|
|
@ -337,37 +337,36 @@
|
|||
;;; <leader> c --- code
|
||||
(:prefix-map ("c" . "code")
|
||||
(:when (and (featurep! :tools lsp) (not (featurep! :tools lsp +eglot)))
|
||||
:desc "LSP Execute code action" "a" #'lsp-execute-code-action
|
||||
:desc "LSP Organize imports" "o" #'lsp-organize-imports
|
||||
(:when (featurep! :completion ivy)
|
||||
:desc "Jump to symbol in current workspace" "j" #'lsp-ivy-workspace-symbol
|
||||
:desc "Jump to symbol in any workspace" "J" #'lsp-ivy-global-workspace-symbol)
|
||||
(:when (featurep! :completion helm)
|
||||
:desc "Jump to symbol in current workspace" "j" #'helm-lsp-workspace-symbol
|
||||
:desc "Jump to symbol in any workspace" "J" #'helm-lsp-global-workspace-symbol)
|
||||
:desc "LSP Rename" "r" #'lsp-rename
|
||||
(:after lsp-mode
|
||||
:desc "LSP" "l" lsp-command-map))
|
||||
(:when (featurep! :tools lsp +eglot)
|
||||
:desc "LSP Execute code action" "a" #'eglot-code-actions
|
||||
:desc "LSP Rename" "r" #'eglot-rename
|
||||
:desc "LSP Find declaration" "j" #'eglot-find-declaration)
|
||||
:desc "Compile" "c" #'compile
|
||||
:desc "Recompile" "C" #'recompile
|
||||
:desc "Jump to definition" "d" #'+lookup/definition
|
||||
:desc "Jump to references" "D" #'+lookup/references
|
||||
:desc "Evaluate buffer/region" "e" #'+eval/buffer-or-region
|
||||
:desc "Evaluate & replace region" "E" #'+eval:replace-region
|
||||
:desc "Format buffer/region" "f" #'+format/region-or-buffer
|
||||
:desc "Find implementations" "i" #'+lookup/implementations
|
||||
:desc "Jump to documentation" "k" #'+lookup/documentation
|
||||
:desc "Send to repl" "s" #'+eval/send-region-to-repl
|
||||
:desc "Find type definition" "t" #'+lookup/type-definition
|
||||
:desc "Delete trailing whitespace" "w" #'delete-trailing-whitespace
|
||||
:desc "Delete trailing newlines" "W" #'doom/delete-trailing-newlines
|
||||
:desc "List errors" "x" #'flymake-show-diagnostics-buffer
|
||||
(:when (featurep! :checkers syntax)
|
||||
:desc "List errors" "x" #'flycheck-list-errors))
|
||||
:desc "LSP Execute code action" "a" #'lsp-execute-code-action
|
||||
:desc "LSP Organize imports" "o" #'lsp-organize-imports
|
||||
(:when (featurep! :completion ivy)
|
||||
:desc "Jump to symbol in current workspace" "j" #'lsp-ivy-workspace-symbol
|
||||
:desc "Jump to symbol in any workspace" "J" #'lsp-ivy-global-workspace-symbol)
|
||||
(:when (featurep! :completion helm)
|
||||
:desc "Jump to symbol in current workspace" "j" #'helm-lsp-workspace-symbol
|
||||
:desc "Jump to symbol in any workspace" "J" #'helm-lsp-global-workspace-symbol)
|
||||
:desc "LSP" "l" #'+default/lsp-command-map
|
||||
:desc "LSP Rename" "r" #'lsp-rename)
|
||||
(:when (featurep! :tools lsp +eglot)
|
||||
:desc "LSP Execute code action" "a" #'eglot-code-actions
|
||||
:desc "LSP Rename" "r" #'eglot-rename
|
||||
:desc "LSP Find declaration" "j" #'eglot-find-declaration)
|
||||
:desc "Compile" "c" #'compile
|
||||
:desc "Recompile" "C" #'recompile
|
||||
:desc "Jump to definition" "d" #'+lookup/definition
|
||||
:desc "Jump to references" "D" #'+lookup/references
|
||||
:desc "Evaluate buffer/region" "e" #'+eval/buffer-or-region
|
||||
:desc "Evaluate & replace region" "E" #'+eval:replace-region
|
||||
:desc "Format buffer/region" "f" #'+format/region-or-buffer
|
||||
:desc "Find implementations" "i" #'+lookup/implementations
|
||||
:desc "Jump to documentation" "k" #'+lookup/documentation
|
||||
:desc "Send to repl" "s" #'+eval/send-region-to-repl
|
||||
:desc "Find type definition" "t" #'+lookup/type-definition
|
||||
:desc "Delete trailing whitespace" "w" #'delete-trailing-whitespace
|
||||
:desc "Delete trailing newlines" "W" #'doom/delete-trailing-newlines
|
||||
:desc "List errors" "x" #'flymake-show-diagnostics-buffer
|
||||
(:when (featurep! :checkers syntax)
|
||||
:desc "List errors" "x" #'flycheck-list-errors))
|
||||
|
||||
;;; <leader> f --- file
|
||||
(:prefix-map ("f" . "file")
|
||||
|
|
20
modules/config/default/autoload/deferred.el
Normal file
20
modules/config/default/autoload/deferred.el
Normal file
|
@ -0,0 +1,20 @@
|
|||
;;; config/default/autoload/deferred.el -*- lexical-binding: t; -*-
|
||||
|
||||
;; TODO generalize this
|
||||
;;;###autoload
|
||||
(defun +default/lsp-command-map ()
|
||||
"Lazily invoke `lsp-command-map'."
|
||||
(interactive)
|
||||
(require 'lsp-mode)
|
||||
(map! :leader "c l" lsp-command-map)
|
||||
(dolist (leader-key (list doom-leader-key doom-leader-alt-key))
|
||||
(let ((lsp-keymap-prefix (concat leader-key " c l")))
|
||||
(lsp-enable-which-key-integration)))
|
||||
(setq prefix-arg current-prefix-arg
|
||||
unread-command-events
|
||||
(mapcar (lambda (e) (cons t e))
|
||||
(vconcat (when evil-this-operator
|
||||
(where-is-internal evil-this-operator
|
||||
evil-normal-state-map
|
||||
t))
|
||||
(this-command-keys)))))
|
|
@ -62,12 +62,6 @@ should be a deliberate act (as is flipping this variable).")
|
|||
:type-definition #'lsp-find-type-definition
|
||||
:references #'lsp-find-references)
|
||||
|
||||
;; REVIEW The '<leader> c l' prefix is hardcoded here, unfortunately.
|
||||
(when (featurep! :config default +bindings)
|
||||
(dolist (leader-key (list doom-leader-key doom-leader-alt-key))
|
||||
(let ((lsp-keymap-prefix (concat leader-key " c l")))
|
||||
(lsp-enable-which-key-integration))))
|
||||
|
||||
(when lsp-auto-configure
|
||||
(mapc (lambda (package) (require package nil t))
|
||||
(cl-remove-if #'featurep lsp-client-packages)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue