GNU bug report logs -
#74277
29.4; rust-ts-mode doesn't highlight some function calls
Previous Next
Reported by: acidbong <at> tilde.club
Date: Sat, 9 Nov 2024 08:22:02 UTC
Severity: normal
Tags: notabug
Found in version 29.4
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #20 received at 74277 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Trevor Arjeski <tmarjeski <at> gmail.com> writes:
I decided to hack around with this a little bit and found that adding
the following lines partially works:
[rust-ts-mode-macro-highlight.patch (text/x-patch, inline)]
diff --git a/lisp/progmodes/rust-ts-mode.el b/lisp/progmodes/rust-ts-mode.el
index e52ea3b125a..508a53d9e32 100644
--- a/lisp/progmodes/rust-ts-mode.el
+++ b/lisp/progmodes/rust-ts-mode.el
@@ -517,6 +517,19 @@ rust-ts-mode
(setq-local syntax-propertize-function
#'rust-ts-mode--syntax-propertize)
+ ;; Injected languages
+ ;; TODO: add json?
+ (setq-local treesit-range-settings
+ (treesit-range-rules
+ :embed 'rust
+ :host 'rust
+ :local t
+ '((macro_invocation
+ (token_tree) @capture))))
+
+ ;; TODO: set this to a useful function
+ (setq-local treesit-language-at-point-function (lambda (_pos) 'rust))
+
;; Comments.
(c-ts-common-comment-setup)
[Message part 3 (text/plain, inline)]
I'm sure there is an issue with solving it this way, I just need someone
else more experienced to confirm. It is finicky where it turns the
highlighting on and off when you make some code changes, for example
adding and removing the semi-colon after the macro invocation.
Here is some example code to test it against:
fn foo() -> i32 {
4
}
fn main() {
println!("{:?}", foo());
}
Thanks
This bug report was last modified 134 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.