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

Previous Next

Package: emacs;

Reported by: Christophe TROESTLER <Christophe.TROESTLER <at> umons.ac.be>

Date: Sat, 19 Oct 2024 11:02:01 UTC

Severity: normal

Tags: patch

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Randy Taylor <dev <at> rjt.dev>
To: Christophe TROESTLER <Christophe.TROESTLER <at> umons.ac.be>
Cc: 73877 <at> debbugs.gnu.org, Stefan Kangas <stefankangas <at> gmail.com>
Subject: bug#73877: 30; rust-ts-mode: highlight the possible type suffix of number literals
Date: Tue, 22 Oct 2024 23:05:21 +0000
> Christophe TROESTLER Christophe.TROESTLER <at> umons.ac.be 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.




This bug report was last modified 175 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.