You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 to format!(indoc!($fmt), ...)
printdoc!($fmt, ...) — equivalent to print!(indoc!($fmt), ...)
eprintdoc!($fmt, ...) — equivalent to eprint!(indoc!($fmt), ...)
writedoc!($dest, $fmt, ...) — equivalent to write!($dest, indoc!($fmt), ...)
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?
The text was updated successfully, but these errors were encountered:
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: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:
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?
The text was updated successfully, but these errors were encountered: