Merge pull request #2952 from jsravn/add-lsp-command-map

Add lsp-command-map to SPC-c-l
This commit is contained in:
Henrik Lissner 2020-05-04 16:44:53 -04:00 committed by GitHub
commit a13b0e6649
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 14 deletions

View file

@ -42,16 +42,18 @@
(:when (featurep! :checkers syntax)
:desc "List errors" "x" #'flycheck-list-errors)
(:when (featurep! :tools lsp)
:desc "LSP Code actions" "a" #'lsp-execute-code-action
:desc "LSP Format buffer/region" "F" #'+default/lsp-format-region-or-buffer
:desc "LSP Organize imports" "i" #'lsp-organize-imports
:desc "LSP Rename" "r" #'lsp-rename
(: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 Code actions" "a" #'lsp-execute-code-action
:desc "LSP Format buffer/region" "F" #'+default/lsp-format-region-or-buffer
:desc "LSP Organize imports" "i" #'lsp-organize-imports
:desc "LSP Rename" "r" #'lsp-rename
(:after lsp-mode
:desc "LSP" "l" 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)
(: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)))
;;; <leader> f --- file
(:prefix-map ("f" . "file")

View file

@ -344,7 +344,6 @@
;;; <leader> c --- code
(:prefix-map ("c" . "code")
:desc "LSP Execute code action" "a" #'lsp-execute-code-action
:desc "Compile" "c" #'compile
:desc "Recompile" "C" #'recompile
:desc "Jump to definition" "d" #'+lookup/definition
@ -352,8 +351,6 @@
: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 "LSP Format buffer/region" "F" #'+default/lsp-format-region-or-buffer
:desc "LSP Organize imports" "i" #'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)
@ -361,7 +358,13 @@
: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 "Jump to documentation" "k" #'+lookup/documentation
:desc "LSP Rename" "r" #'lsp-rename
(:when (featurep! :tools lsp)
:desc "LSP Execute code action" "a" #'lsp-execute-code-action
:desc "LSP Format buffer/region" "F" #'+default/lsp-format-region-or-buffer
:desc "LSP Organize imports" "i" #'lsp-organize-imports
:desc "LSP Rename" "r" #'lsp-rename
(:after lsp-mode
:desc "LSP" "l" lsp-command-map))
:desc "Send to repl" "s" #'+eval/send-region-to-repl
:desc "Delete trailing whitespace" "w" #'delete-trailing-whitespace
:desc "Delete trailing newlines" "W" #'doom/delete-trailing-newlines

View file

@ -26,6 +26,10 @@ working on that project after closing the last buffer.")
(setq lsp-server-install-dir (concat doom-etc-dir "lsp/")
lsp-intelephense-storage-path (concat doom-cache-dir "lsp-intelephense/"))
(when (featurep! :config default +bindings)
;; Let doom bind the lsp keymap.
(setq lsp-keymap-prefix nil))
;; Disable LSP's superfluous, expensive and/or debatably unnecessary features.
;; Some servers implement these poorly. Better to just rely on Emacs' native
;; mechanisms and make these opt-in.
@ -99,6 +103,11 @@ This also logs the resolved project root, if found, so we know where we are."
(lambda (it) (format "[%s]" (lsp--workspace-print it)))
lsp--buffer-workspaces))))))
(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))))
(add-hook! 'lsp-mode-hook
(defun +lsp-init-company-h ()
(if (not (bound-and-true-p company-mode))