bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#70464: [PATCH] Add font-locking for Rust macro variables


From: Yuan Fu
Subject: bug#70464: [PATCH] Add font-locking for Rust macro variables
Date: Fri, 19 Apr 2024 00:41:01 -0700

Noah Peart <noah.v.peart@gmail.com> writes:

> Tags: patch
>
> Adds some tree-sitter font-locking rules in rust-ts-mode to fontify
> meta variables, their types, and repetition operators in macros.
>
> These rules add new font-locking as indicated in the following
> snippet:
>
>     macro_rules! unsafe_raw_call {
>         ($env:expr, $name:ident $(, $args:expr)*) => {
> //          ^ font-lock-variable-name-face
> //                  ^ font-lock-type-face
> //                                              ^ font-lock-operator-face
> //                                                                     ^ 
> font-lock-operator-face
>             {
>                 let env = $env;
> //                                ^ font-lock-variable-use-face
>                 let result = unsafe {
>                     let $name = raw_fn!(env, $name);
>                     $name(env.raw $(, $args)*)
>                 };
>                 env.handle_exit(result)
>             }
>         };
>     }
>
> I also removed the last occurrence of the following duplicated rule from the 
> `type` feature:
>     (type_identifier) @font-lock-type-face
>

Great! Thanks! I’ll merge this in some time once I figure out whether
should we apply it to emacs-29 or master.

Meanwhile, it seems that you’ve recently working on tree-sitter modes.
If you’re interested, maybe you can take a look at ert-font-lock, and
add some tests that cover the bugs your patches fixes? This is
completely optional, of course. I bought it up because I think you might
be interested.

Yuan





reply via email to

[Prev in Thread] Current Thread [Next in Thread]