1

Add Rust support

This commit is contained in:
Jessie Hildebrandt 2024-05-26 10:53:54 -04:00
parent cc3b1ee3d9
commit 6fcbe308b5

17
init.el
View File

@ -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
;; ---------------------------------- ;;