2018-03-16 00:38:24 +00:00
|
|
|
;;; packages.el --- Language Server Protocol Layer packages file for Spacemacs
|
2018-02-19 03:53:07 +00:00
|
|
|
;;
|
|
|
|
;; 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
|
|
|
|
|
2018-01-21 20:27:33 +00:00
|
|
|
(defconst lsp-packages
|
|
|
|
'(
|
2018-03-16 00:38:24 +00:00
|
|
|
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))))
|
2018-01-21 20:27:33 +00:00
|
|
|
|
|
|
|
(defun lsp/init-company-lsp ()
|
|
|
|
(use-package company-lsp
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2018-01-21 20:27:33 +00:00
|
|
|
:init
|
|
|
|
;; Language servers have better idea filtering and sorting,
|
|
|
|
;; don't filter results on the client side.
|
|
|
|
(setq company-transformers nil
|
2018-03-16 00:38:24 +00:00
|
|
|
company-lsp-async t
|
|
|
|
company-lsp-cache-candidates nil)))
|
2018-01-21 20:27:33 +00:00
|
|
|
|
2018-02-19 03:56:41 +00:00
|
|
|
(defun lsp/init-flycheck-lsp ()
|
|
|
|
;; Disable lsp-flycheck.el in favor of lsp-ui-flycheck.el
|
|
|
|
(setq lsp-enable-flycheck nil))
|
|
|
|
|
2018-01-21 20:27:33 +00:00
|
|
|
(defun lsp/init-lsp-ui ()
|
|
|
|
(use-package lsp-ui
|
2018-06-11 03:25:45 +00:00
|
|
|
:defer t
|
2018-02-28 03:29:08 +00:00
|
|
|
:init (add-hook 'lsp-mode-hook #'lsp-ui-mode)
|
2018-01-21 20:27:33 +00:00
|
|
|
:config
|
|
|
|
(progn
|
2018-02-19 03:53:07 +00:00
|
|
|
(spacemacs//lsp-sync-peek-face)
|
2018-03-16 00:38:24 +00:00
|
|
|
(add-hook 'spacemacs-post-theme-change-hook #'spacemacs//lsp-sync-peek-face)
|
|
|
|
|
|
|
|
(if lsp-ui-peek-expand-by-default
|
|
|
|
(setq lsp-ui-peek-expand-function (lambda (xs) (mapcar #'car xs))))
|
|
|
|
|
|
|
|
(if lsp-ui-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)))
|