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-lang-nix.el | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'emacs/custom/my-lang-nix.el') diff --git a/emacs/custom/my-lang-nix.el b/emacs/custom/my-lang-nix.el index 7d197e2..6e17ee3 100644 --- a/emacs/custom/my-lang-nix.el +++ b/emacs/custom/my-lang-nix.el @@ -5,21 +5,11 @@ ;;; Code: -(require 'lsp-mode) +(require 'eglot) +(require 'nix-mode) -(add-to-list 'lsp-language-id-configuration '(nix-mode . "nix")) -(lsp-register-client - (make-lsp-client :new-connection - (lsp-stdio-connection '("rnix-lsp")) - :major-modes '(nix-mode) - :server-id 'nix)) - -(defun my/lsp-nix-install-save-hooks () - "Set up before-save hooks to format buffer." - (add-hook 'before-save-hook #'lsp-format-buffer t t)) - -(add-hook 'nix-mode-hook #'my/lsp-nix-install-save-hooks) -(add-hook 'nix-mode-hook #'lsp-deferred) +(add-hook 'nix-mode-hook 'eglot-ensure) +(add-hook 'nix-mode-hook #'(lambda() (add-hook 'before-save-hook 'eglot-format-buffer nil t))) (provide 'my-lang-nix) -- cgit 1.4.1