Add eglot setup function
This commit is contained in:
parent
6fcbe308b5
commit
936f21330f
15
init.el
15
init.el
@ -27,7 +27,7 @@
|
|||||||
;; - init/config
|
;; - init/config
|
||||||
;; - custom/custom-faces
|
;; - custom/custom-faces
|
||||||
;; - commands
|
;; - commands
|
||||||
;; - mode/interpreter/hook
|
;; - hook/interpreter/mode
|
||||||
;; - bind/bind*/bind-keymap/bind-keymap*
|
;; - bind/bind*/bind-keymap/bind-keymap*
|
||||||
;;
|
;;
|
||||||
;; Custom functions and variables should generally be prefixed with "user/".
|
;; 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
|
(editor-feature eglot
|
||||||
"Integrates LSP client features into Emacs."
|
"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
|
:config
|
||||||
;; Remove the mode-line segment that Eglot adds
|
;; Remove the mode-line segment that Eglot adds
|
||||||
(setq mode-line-misc-info (assoc-delete-all 'eglot--managed-mode mode-line-misc-info))
|
(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)
|
(rust-ts-mode-hook . eglot-ensure)
|
||||||
(typescript-mode-hook . eglot-ensure)
|
(typescript-mode-hook . eglot-ensure)
|
||||||
(gdscript-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
|
:bind
|
||||||
(:map eglot-mode-map
|
(:map eglot-mode-map
|
||||||
("C-c \\" . eglot-format-buffer)
|
("C-c \\" . eglot-format-buffer)
|
||||||
@ -708,6 +715,10 @@ have been closed."
|
|||||||
;; Ensure Emacs knows where to look for Rust tooling
|
;; Ensure Emacs knows where to look for Rust tooling
|
||||||
(when (file-directory-p user/rust-cargo-directory)
|
(when (file-directory-p user/rust-cargo-directory)
|
||||||
(add-to-list 'exec-path 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
|
:mode
|
||||||
("\\.rs\\'" . rust-ts-mode))
|
("\\.rs\\'" . rust-ts-mode))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user