1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

Rust ts: fontify as type the possible suffix of number literals

* lisp/progmodes/rust-ts-mode.el
(rust-ts-mode--fontify-number-literal): Perform the improved
fontification of numbers.  (Bug#73877)
* test/lisp/progmodes/rust-ts-mode-tests.el:
* test/lisp/progmodes/rust-ts-mode-resources/font-lock.rs:
* test/lisp/progmodes/rust-ts-mode-resources/font-lock-number.rs:
Add tests for the new optional fontification of the possible type
suffix of numbers.
This commit is contained in:
Christophe Troestler 2024-10-18 23:50:06 +02:00 committed by Eli Zaretskii
parent 1b33c00f4c
commit 902696c3ae
5 changed files with 90 additions and 3 deletions

View file

@ -0,0 +1,17 @@
fn main() {
let x = 1usize;
// ^ font-lock-number-face
// ^ font-lock-type-face
let x = 1_usize;
// ^ font-lock-number-face
// ^ font-lock-type-face
let x = 1_f64;
// ^ font-lock-number-face
// ^ font-lock-type-face
let x = 1.0f64;
// ^ font-lock-number-face
// ^ font-lock-type-face
let x = 1.0_f64;
// ^ font-lock-number-face
// ^ font-lock-type-face
}

View file

@ -23,3 +23,21 @@ macro_rules! unsafe_foo {
// ^ font-lock-operator-face
}
};
fn main() {
let x = 1usize;
// ^ font-lock-number-face
// ^ font-lock-number-face
let x = 1_usize;
// ^ font-lock-number-face
// ^ font-lock-number-face
let x = 1_f64;
// ^ font-lock-number-face
// ^ font-lock-number-face
let x = 1.0f64;
// ^ font-lock-number-face
// ^ font-lock-number-face
let x = 1.0_f64;
// ^ font-lock-number-face
// ^ font-lock-number-face
}