GNU bug report logs -
#73877
30; rust-ts-mode: highlight the possible type suffix of number literals
Previous Next
Full log
Message #25 received at 73877 <at> debbugs.gnu.org (full text, mbox):
> Cc: "73877 <at> debbugs.gnu.org" <73877 <at> debbugs.gnu.org>,
> Stefan Kangas <stefankangas <at> gmail.com>
> From: Christophe TROESTLER <Christophe.TROESTLER <at> umons.ac.be>
> Date: Mon, 28 Oct 2024 21:56:52 +0000
>
> Here is an updated patch that (hopefully) addresses all of your remarks except the last one: when executing the tests interactively in the instance of Emacs one works with, it is good IMHO that global variables are not changed under our feet. That being said, it is not a strong opinion and I can remove the reset if you wish.
Thanks, a few more nits to be fixed:
> * lisp/progmodes/rust-ts-mode.el (rust-ts-mode--fontify-number-literal):
> perform the improved fontification of numbers.
The description should start with a capital letter.
Also, please mention the bug number somewhere in the log message.
> +---
> +*** New user option 'rust-ts-mode-fontify-number-suffix-as-type'.
> +Rust number literals may have an optional type suffix. When this option
> +is non-nil, this suffix is fontified as a type.
^^^^^^^^^
I think "using the 'font-lock-type-face'" is a more clear description
than "as a type".
> +(defcustom rust-ts-mode-fontify-number-suffix-as-type nil
> + "If non-nil, fontify the optional type suffix of number literals with
> +`font-lock-type-face' instead of `font-lock-number-face'."
The first line of a doc string should be a single complete sentence.
So please make it a summary of what this option does, and describe the
details in the subsequent sentences.
> +(defconst rust-ts-mode--number-types
> + (regexp-opt '("u8" "i8" "u16" "i16" "u32" "i32" "u64"
> + "i64" "u128" "i128" "usize" "isize" "f32" "f64"))
> + "Regexp that matches any suffix on number literals as documented
> +at https://doc.rust-lang.org/reference/tokens.html#suffixes.")
Same here.
> +(defun rust-ts-mode--fontify-number-literal (node override start stop &rest _)
> + "Fontify number literals, highlighting the optional suffix as a type
> +based on the value of `rust-ts-mode-highlight-number-literal-type'."
And here.
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.