Subject: bug#73877: 30; rust-ts-mode: highlight the possible type suffix of number literals

From: Randy Taylor <[email-masked]>
Date: Tue, 22 Oct 2024 23:05:21 +0000

> Christophe TROESTLER [email-masked] writes:
> 
> > Hi,
> > 
> > In order to make Rust number literals such as 1usize, 1.0_f64,... more legible, the type suffix should be highlighted. The attached patch to rust-ts-mode does that.
> > 
> > Best,
> > Christophe

Thanks for working on this Christophe.

I think this will need to be gated behind a variable which should retain the existing behaviour by default.

Would you also be able to add some tests for this?
You can see how the font-lock tests are done in the test/lisp/progmodes/rust-ts-mode-tests.el file,
and add some to the rust-ts-mode-resources/font-lock.rs file.
We might need a new file for this one, actually, since we'd want to test both cases.

I have some comments below:

+  "Regexp that matches any suffix on number litterals as documented
                                             ^ literals
+at https://doc.rust-lang.org/reference/tokens.html#suffixes")
Add a period at the end.

+  "Fontify number literals, highlighting the optional type if present"
Add a period at the end.

We may also want to say something like: "highlighting the optional type based on the value of `name-of-the-variable'."
once the variable to control it is added.