From 7084581ae2df832689f362ccdf5305b34c8bf0cf Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Mon, 17 Oct 2022 18:29:37 -0700 Subject: ref(lsp): switch from lsp-mode to eglot The experimentation was a disaster: lsp-mode was buggy, slow, littering the interface with a lot of things I did not understood or needed. eglot is definitely simpler and works better for me. Change-Id: Ie7e7e6f1c8e7b26aa5cb79d636f3ad53c1493617 --- emacs/custom/my-lsp.el | 41 ++++++++++++----------------------------- 1 file changed, 12 insertions(+), 29 deletions(-) (limited to 'emacs/custom/my-lsp.el') diff --git a/emacs/custom/my-lsp.el b/emacs/custom/my-lsp.el index c10e06c..40ba785 100644 --- a/emacs/custom/my-lsp.el +++ b/emacs/custom/my-lsp.el @@ -5,35 +5,18 @@ ;;; Code: -(require 'lsp-mode) -(require 'lsp-ui) -(require 'lsp-diagnostics) -(require 'consult-lsp) -(require 'lsp-completion) - -(setq lsp-ui-doc-enable t) ;; Enable documentation -(setq lsp-ui-doc-position 'at-point) ;; Show the documentation at point -(setq lsp-ui-doc-header t) -(setq lsp-ui-doc-include-signature t) -(setq lsp-ui-peek-enable t) ;; Enable `lsp-ui-peek'. -(setq lsp-ui-peek-show-directory t) ;; Show the directory of files. -(setq lsp-ui-sideline-enable nil) ;; Don't enable `lsp-ui-sideline'. - -(add-hook 'lsp-mode-hook #'lsp-ui-mode) - -;; Enable `completion-at-point' integration. -(setq lsp-completion-enable t) - -;; The default is to use flycheck -(setq lsp-diagnostics-provider :flymake) - -(define-key lsp-mode-map [remap xref-find-apropos] #'consult-lsp-symbols) - -;; Configure the completion to be corfu -(setq lsp-completion-provider :none) -(add-hook 'lsp-completion-mode-hook - (lambda () - (setf (alist-get 'lsp-capf completion-category-defaults) '((styles . (orderless flex)))))) +(require 'eglot) + +;; settings related to performance +;; https://emacs-lsp.github.io/lsp-mode/page/performance/ +(setq read-process-output-max (* 1024 1024)) ;; 1mb +(setq gc-cons-threshold 100000000) ;; 100mb + +(global-set-key (kbd "C-c l e") #'eglot) +(define-key eglot-mode-map (kbd "C-c l s") #'eglot-shutdown) +(define-key eglot-mode-map (kbd "C-c l r") #'eglot-rename) +(define-key eglot-mode-map (kbd "C-c l a") #'eglot-code-actions) +(define-key eglot-mode-map (kbd "C-c l o") #'eglot-code-action-organize-imports) (provide 'my-lsp) -- cgit 1.4.1