1

Add eglot setup function

This commit is contained in:
Jessie Hildebrandt 2024-08-20 14:15:23 -04:00
parent 6fcbe308b5
commit 936f21330f

15
init.el
View File

@ -27,7 +27,7 @@
;; - init/config
;; - custom/custom-faces
;; - commands
;; - mode/interpreter/hook
;; - hook/interpreter/mode
;; - bind/bind*/bind-keymap/bind-keymap*
;;
;; Custom functions and variables should generally be prefixed with "user/".
@ -435,6 +435,13 @@ DOCSTRING is an optional form that is discarded upon expansion."
(editor-feature eglot
"Integrates LSP client features into Emacs."
:preface
(defun user/set-up-eglot ()
"Set up buffer-local variables for current eglot session."
(setq eldoc-documentation-functions '(flymake-eldoc-function
eglot-signature-eldoc-function
eglot-hover-eldoc-function))
(eglot-inlay-hints-mode -1))
:config
;; Remove the mode-line segment that Eglot adds
(setq mode-line-misc-info (assoc-delete-all 'eglot--managed-mode mode-line-misc-info))
@ -444,7 +451,7 @@ DOCSTRING is an optional form that is discarded upon expansion."
(rust-ts-mode-hook . eglot-ensure)
(typescript-mode-hook . eglot-ensure)
(gdscript-mode-hook . eglot-ensure)
(eglot-managed-mode-hook . (lambda () (eglot-inlay-hints-mode -1)))
(eglot-managed-mode-hook . user/set-up-eglot)
:bind
(:map eglot-mode-map
("C-c \\" . eglot-format-buffer)
@ -708,6 +715,10 @@ have been closed."
;; Ensure Emacs knows where to look for Rust tooling
(when (file-directory-p user/rust-cargo-directory)
(add-to-list 'exec-path user/rust-cargo-directory))
:hook
;; Ignore disruptive delimiter auto-matching feature of rust-analyzer LS
(eglot-managed-mode-hook . (lambda ()
(setq-local eglot-ignored-server-capabilities '(:documentOnTypeFormattingProvider))))
:mode
("\\.rs\\'" . rust-ts-mode))