From 6fcbe308b5bbfed4fa422fc93b64024dde6cfae9 Mon Sep 17 00:00:00 2001 From: Jessie Hildebrandt Date: Sun, 26 May 2024 10:53:54 -0400 Subject: [PATCH] Add Rust support --- init.el | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/init.el b/init.el index 35109c3..6dbe851 100644 --- a/init.el +++ b/init.el @@ -441,8 +441,10 @@ DOCSTRING is an optional form that is discarded upon expansion." :hook (c-ts-base-mode-hook . eglot-ensure) (js-ts-mode-hook . eglot-ensure) + (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))) :bind (:map eglot-mode-map ("C-c \\" . eglot-format-buffer) @@ -694,6 +696,21 @@ have been closed." ("e" . flymake-show-project-diagnostics) ("RET" . project-eshell))) +;; ---------------------------------- ;; +;; rust-ts-mode +;; ---------------------------------- ;; + +(editor-feature rust-ts-mode + "Major mode for Rust, using the Tree-sitter parsing library." + :preface + (defconst user/rust-cargo-directory (expand-file-name "~/.cargo/bin") "Location of installed Rust binaries.") + :config + ;; 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)) + :mode + ("\\.rs\\'" . rust-ts-mode)) + ;; ---------------------------------- ;; ;; savehist ;; ---------------------------------- ;;