Closed svieujot closed 1 year ago
It looks like this is due to the use of UTF-8 characters: The ° in the span, and the œ in Manœuvering.
That is indeed the cause
I have no explanation for the @ however.
The issue is that it uses proc_macro2
's get_source_text
which impl comes down to source[lo..hi]
, where lo
and hi
are character indexes but are used as byte indexes here... So multibyte characters anywhere in the source file will cause issues with unquoted text at the moment.
Also from proc_macro
s docs (https://docs.rs/proc-macro2/latest/proc_macro2/struct.Span.html#method.source_text):
Note: The observable result of a macro should only rely on the tokens and not on this source text. The result of this function is a best effort to be used for diagnostics only.
Ah I see now that the author of proc_macro2
pushed a fix 2 days ago :D
https://github.com/dtolnay/proc-macro2/commit/7f5533d6cc9ff783d174aec4e3be2caa202b62ca
ok, so the proc_macro2 crate is still having a bug, issue here: https://github.com/dtolnay/proc-macro2/issues/410 will implement a workaround for now
@bram209 Works perfectly. Thank you !
Running
leptosfmt
on the following file:Generates this:
Switch
has becomeSwitc
(and looses one more character at every subsequent run).@
has been replaced with a>
aid
has been replaced bya
It looks like this is due to the use of UTF-8 characters: The
°
in thespan
, and theœ
inManœuvering
. I have no explanation for the@
however.