From 66980715aa735a15dd94b543d23ce22df3359490 Mon Sep 17 00:00:00 2001 From: Sakooooo <78461130+Sakooooo@users.noreply.github.com> Date: Thu, 19 Sep 2024 10:36:52 +0400 Subject: [PATCH] ok --- config/emacs/emacs.org | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/config/emacs/emacs.org b/config/emacs/emacs.org index 09993a30..cfb47a05 100644 --- a/config/emacs/emacs.org +++ b/config/emacs/emacs.org @@ -1034,14 +1034,31 @@ this should be useful later ;; Configuration taken from rust-analyzer’s manual: ;; https://rust-analyzer.github.io/manual.html#configuration (setq-local eglot-workspace-configuration - ;; Setting the workspace configuration for every - ;; rust-mode buffer, you can also set it with dir-local - ;; variables, should you want different configuration - ;; per project/directory. - '(:rust-analyzer - :cargo (:features ["all"])))) + ;; Setting the workspace configuration for every + ;; rust-mode buffer, you can also set it with dir-local + ;; variables, should you want different configuration + ;; per project/directory. + '(:rust-analyzer + :cargo (:features ["all"])))) (add-hook 'rustic-mode-hook #'setup-rust) + (add-hook 'rust-mode-hook #'setup-rust) + + + ;; expects initializationOptions done a bit differently (see below). + (defclass eglot-rust-analyzer (eglot-lsp-server) () + :documentation "A custom class for rust-analyzer.") + + ;; Rust-analyzer requires the workspaceConfiguration sent as + ;; initializationOptions at startup time. See + ;; https://github.com/joaotavora/eglot/discussions/845 and + ;; rust-analyzer’s manual page. + (cl-defmethod eglot-initialization-options ((server eglot-rust-analyzer)) + eglot-workspace-configuration) + + ;; Use our custom ‘eglot-rust-analyzer’ for ‘rust-mode’. + (add-to-list 'eglot-server-programs + '(rustic-mode . (eglot-rust-analyzer "rust-analyzer"))) :custom (rustic-cargo-use-last-stored-arguments t))