This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
spacemacs/layers/+tools/lsp/packages.el
cormacc 18eacf48a2 Configure preference for lsp-ui-peek or xref/lsp navigation
<<Amendment 1 21/09/18>>
Added functions to facilitate keybindings in derived layers consistent
with navigation style preference.

<<Amendment 2 24/09/18>>
Incorporated feedback from yyoncho
Corrected error in peek binding extension definition

<<Amendment 3 24/09/18>>
Moved 'heirarchy' prefix/keybindings from 'SPC m h' to 'SPC m <g/p> h' for
consistency with navigation style preference selections.
Added 'members' prefix under 'SPC m <g/p> m'
Moved 'lsp-ui-imenu' from 'SPC m g m' to 'SPC m g M'

<<Amendment 4 20/10/18>>
Rebased. Updated README formatting for consistency with norms.

<<Amendment 5 25/10/18>>
Rebased. Moved 'peek' keybindings from 'SPC m p' to 'SPC m G'

<<Amendment 6 01/11/18>>
Reased. Updated for compatibility with upstream changes in lsp-ui.

<<Amendment 7 02/11/18>>
Corrected oversight -- was still binding some peek funcs under 'p'
rather than 'G'. Moved backend keybindings to 'b' (for backend)
rather than 'l' (for lsp)

<<Amendment 8 06/11/18>>
Documentation corrections -- based on feedback from sdwolfz
2018-11-06 22:18:43 +00:00

75 lines
2.4 KiB
EmacsLisp

;;; packages.el --- Language Server Protocol Layer packages file for Spacemacs
;;
;; Copyright (c) 2012-2018 Sylvain Benner & Contributors
;;
;; Author: Fangrui Song <i@maskray.me>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
(defconst lsp-packages
'(
lsp-mode
lsp-ui
(lsp-imenu :requires imenu :location built-in)
(lsp-ui-imenu :requires lsp-imenu :location built-in)
(company-lsp :requires company)
;; `flycheck-lsp' does not exist so we defined it as built-in to avoid
;; fetching it from ELPA repositories.
;; this logical package serves to hook all flycheck related configuration
;; for LSP.
(flycheck-lsp :requires flycheck :location built-in)
))
(defun lsp/init-lsp-mode ()
(use-package lsp-mode
:defer t
:config
(progn
(spacemacs|hide-lighter lsp-mode)
(evil-set-command-property 'lsp-goto-type-definition :jump t)
(evil-set-command-property 'lsp-goto-implementation :jump t))))
(defun lsp/init-company-lsp ()
(use-package company-lsp
:defer t
:init
;; Language servers have better idea filtering and sorting,
;; don't filter results on the client side.
(setq company-transformers nil
company-lsp-async t
company-lsp-cache-candidates nil)))
(defun lsp/init-flycheck-lsp ()
;; Disable lsp-flycheck.el in favor of lsp-ui-flycheck.el
(setq lsp-enable-flycheck nil))
(defun lsp/init-lsp-ui ()
(use-package lsp-ui
:defer t
:init (add-hook 'lsp-mode-hook #'lsp-ui-mode)
:config
(progn
(spacemacs//lsp-sync-peek-face)
(add-hook 'spacemacs-post-theme-change-hook #'spacemacs//lsp-sync-peek-face)
(if lsp-remap-xref-keybindings
(progn (define-key lsp-ui-mode-map [remap xref-find-definitions] #'lsp-ui-peek-find-definitions)
(define-key lsp-ui-mode-map [remap xref-find-references] #'lsp-ui-peek-find-references)))
(spacemacs/lsp-define-key
lsp-ui-peek-mode-map
"h" #'lsp-ui-peek--select-prev-file
"j" #'lsp-ui-peek--select-next
"k" #'lsp-ui-peek--select-prev
"l" #'lsp-ui-peek--select-next-file
)
)))
(defun lsp/init-lsp-imenu ()
(use-package lsp-imenu :defer t :init (add-hook 'lsp-after-open-hook #'lsp-enable-imenu)))
(defun lsp/init-lsp-ui-imenu ()
(use-package lsp-ui-imenu :defer t :config (evil-make-overriding-map lsp-ui-imenu-mode-map)))