]> jturnerusa.dev Git - emacs.d/commitdiff
dir-locals.el configured to use rust-mode features in rust-ts-mode
authorJohn Turner <jturner.usa@gmail.com>
Sat, 25 Mar 2023 07:22:02 +0000 (03:22 -0400)
committerJohn Turner <jturner.usa@gmail.com>
Sat, 25 Mar 2023 07:22:02 +0000 (03:22 -0400)
dir-locals/eglot-rust-dir-locals.el

index 5f7d0c675e4b5c59f566f9d6d7bde0cb8279412f..68be387d99d5abafffa7d65dec14890423148ff2 100644 (file)
@@ -1,7 +1,16 @@
-((rust-mode . ((eval . (eglot-ensure))
-               (eglot-workspace-configuration . ((:rust-analyzer . (:checkOnSave
-                                                                    (:command "clippy")))))
-               (rust-format-on-save . t)
-               (rust-format-goto-problem . t)
-               (rust-rustfmt-switches . ("--edition" "2021"))))
+((rust-ts-mode . ((eval . (progn
+                            (require 'rust-mode)
+                            (eglot-ensure)
+                            (use-local-map (make-composed-keymap (list rust-mode-map rust-ts-mode-map)))
+                            (add-hook 'before-save-hook rust-before-save-hook nil t)
+                            (add-hook 'after-save-hook rust-after-save-hook nil t)
+                            (keymap-set (current-local-map) "C-c C-c C-c C-d" (lambda ()
+                                                                                (interactive)
+                                                                                (rust--compile
+                                                                                 "%s doc"
+                                                                                 rust-cargo-bin)))))
+                  (eglot-workspace-configuration . ((:rust-analyzer . (:checkOnSave
+                                                                       (:command "clippy")))))
+                  (rust-format-on-save . t)               
+                  (rust-rustfmt-switches . ("--edition" "2021"))))
  (nil . ((rust-cargo-bin . "TMPDIR=~/tmp cargo"))))