2018-02-19 03:53:07 +00:00
|
|
|
;;; packages.el --- Language Server Protocol functions 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
|
|
|
|
|
|
|
|
(defun spacemacs//lsp-sync-peek-face ()
|
|
|
|
"Synchronize the face used in `lsp-ui' peek window according to the theme."
|
2018-01-21 20:27:33 +00:00
|
|
|
(set-face-attribute 'lsp-ui-peek-list nil
|
|
|
|
:background (face-attribute 'hl-line :background nil t))
|
|
|
|
(set-face-attribute 'lsp-ui-peek-peek nil
|
|
|
|
:background (face-attribute 'hl-line :background nil t))
|
|
|
|
(set-face-attribute 'lsp-ui-peek-selection nil
|
|
|
|
:background (face-attribute 'highlight :background nil t)
|
|
|
|
:foreground (face-attribute 'default :foreground nil t))
|
|
|
|
(set-face-attribute 'lsp-ui-peek-filename nil
|
2018-02-19 03:53:07 +00:00
|
|
|
:foreground (face-attribute 'font-lock-constant-face
|
|
|
|
:foreground nil t))
|
2018-01-21 20:27:33 +00:00
|
|
|
(set-face-attribute 'lsp-ui-peek-highlight nil
|
|
|
|
:background (face-attribute 'highlight :background nil t)
|
|
|
|
:foreground (face-attribute 'highlight :foreground nil t)
|
2018-02-19 03:53:07 +00:00
|
|
|
:distant-foreground (face-attribute 'highlight
|
|
|
|
:foreground nil t))
|
2018-01-21 20:27:33 +00:00
|
|
|
(set-face-attribute 'lsp-ui-peek-header nil
|
|
|
|
:background (face-attribute 'highlight :background nil t)
|
|
|
|
:foreground (face-attribute 'default :foreground nil t))
|
|
|
|
)
|
2018-04-28 06:16:20 +00:00
|
|
|
|
2018-05-08 04:17:56 +00:00
|
|
|
(defun spacemacs//setup-lsp-jump-handler (&rest modes)
|
|
|
|
"Set jump handler for LSP with the given MODE."
|
|
|
|
(dolist (m modes)
|
|
|
|
(add-to-list (intern (format "spacemacs-jump-handlers-%S" m))
|
2018-06-02 22:11:47 +00:00
|
|
|
#'lsp-ui-peek-find-definitions)))
|
2018-04-26 19:43:50 +00:00
|
|
|
|
|
|
|
(defun fix-lsp-company-prefix ()
|
|
|
|
"fix lsp-javascript company prefix
|
|
|
|
https://github.com/emacs-lsp/lsp-javascript/issues/9#issuecomment-379515379"
|
|
|
|
(interactive)
|
|
|
|
(defun lsp-prefix-company-transformer (candidates)
|
|
|
|
(let ((completion-ignore-case t))
|
|
|
|
(all-completions (company-grab-symbol) candidates)))
|
|
|
|
(make-local-variable 'company-transformers)
|
|
|
|
(add-to-list 'company-transformers 'lsp-prefix-company-transformer))
|