summary refs log tree commit diff
path: root/emacs/custom/my-lsp.el
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-10-17 18:29:37 -0700
committerFranck Cuny <franck@fcuny.net>2022-10-17 18:29:37 -0700
commit7084581ae2df832689f362ccdf5305b34c8bf0cf (patch)
treef17130e46cdc82e605534d750fc003091931a9ea /emacs/custom/my-lsp.el
parentref(prog): wrap comments at column 120 (diff)
downloademacs.d-7084581ae2df832689f362ccdf5305b34c8bf0cf.tar.gz
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
Diffstat (limited to '')
-rw-r--r--emacs/custom/my-lsp.el41
1 files changed, 12 insertions, 29 deletions
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)