Formatter rewrites Lisette f-strings to multiline interpolation that the compiler…
- User
Formatter rewrites Lisette f-strings to multiline interpolation that the compiler rejects
lis buildrejects multiline interpolation expressions insidef"...{...}"strings, but Zed’s Lisette formatter appears to rewrite single-line calls across lines automatically.Example:
lisettef"You cannot use another ender pearl for {shared.format_duration( remaining, )}."The compiler reports:
text[error] Multi-line f-string interpolation ... error: f-string interpolations must be single-lineImpact:
lis buildfails after formatting in touched spots.- This forces manual one-line edits to pass build.
Expected:
- Either Lisette formatter should preserve single-line interpolation in compatible cases, or
- Formatter rules should be configured to avoid splitting interpolation argument expressions across lines.
Interface
No new interfaces are introduced.
- Assistant
I'll investigate the Lisette formatter and how it handles f-string interpolations so we can stop it from splitting expressions across lines.
- Assistant
Reproducing the formatter bug, then applying the fix.
- Assistant
Bug confirmed. Wrapping f-string interpolation expressions with
next_break_fits(false)so they stay on one line. - Assistant
next_break_fits(false)isn't enough — nestedGroupnodes still break. Checking lindig behavior and fixing mode propagation. - Assistant
The fix works. Running format tests to check for regressions.
- Assistant
Fixed the formatter so f-string interpolations stay on one line, which matches the compiler’s lexer constraint.
Root cause
Two issues combined:
- F-string interpolations used normal
expression()formatting, so call arguments inside{...}could wrap across lines. NextBreakFitsin lindig only affected thefits()pass, not actual printing — sonext_break_fits(false)did not reliably prevent nestedGroupnodes from breaking.
Changes
crates/format/src/formatter/expression.rs— wrap interpolation expressions withnext_break_fits(false):239:244:crates/format/src/formatter/expression.rs - F-string interpolations used normal
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.