-
Notifications
You must be signed in to change notification settings - Fork 105
Description
Sublime Text Version
E.g Sublime Text 4 (Build 4150)
Rust Enhanced Version
2.25.0
Operating system
Pop OS 22.04 / Linux 6.2.6
Feature Request
Heya 👋
TL;DR: Extend or provide some way to extend RustEnhanced.sublime-syntax with additional macros which take format specs, and highlight the args in them.
Description
The indoc crate provides macros to dedent whitespace in string literals. Example:
let arg = 123;
let string = formatdoc!("
this is some text
and an {arg}
more text
");
// ^^^^ The {arg} is interpreted as it would be in a `format!()` macro
// ^^^^ The spaces on the second line are kept.
// ^^^^^ these spaces are removed by the macro.I'd like {arg}s inside these additional macros to also be highlighted since it makes it easier to spot format strings.
There are 4 macros that do the interpolation:
formatdoc!($fmt, ...)— equivalent toformat!(indoc!($fmt), ...)printdoc!($fmt, ...)— equivalent toprint!(indoc!($fmt), ...)eprintdoc!($fmt, ...)— equivalent toeprint!(indoc!($fmt), ...)writedoc!($dest, $fmt, ...)— equivalent towrite!($dest, indoc!($fmt), ...)
I think concatdoc!(...) doesn't interpolate.
Solutioning
I could just edit RustEnhanced.sublime-syntax#L149-L182 in a local clone of the plugin, though:
- Maybe others want it as well
- It would be nice to not have to remember to update my local copy
There's the "wrong-but-easy" solution to just include it in the regex; I haven't worked on sublime's plugin system to know if it can be made configurable, but I suspect it's possible.
Would this be something you're happy to have in the plugin?