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:
f"You cannot use another ender pearl for {shared.format_duration( remaining, )}."The compiler reports:
[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
Investigating how the Lisette formatter handles f-string interpolations and where we can prevent multiline splits the compiler rejects.
- Assistant
Verifying the issue and testing whether
next_break_fits(false)alone is sufficient, or if the document printer needs changes. - Assistant
Reproduced the bug. Implementing the fix and verifying it.
- Assistant
Found the bug:
NextBreakFitssetsForcedUnbrokeninfits()but not informat(). Fixing that. - Assistant
The fix works. Running the format test suite and adding a regression test.
- Assistant
Updating the two snapshots affected by the
next_break_fitsfix and adding a regression test. - Assistant
Adding a unit test for the
NextBreakFitsfix and verifying the formatted output lexes cleanly: - Assistant
Fixed. The formatter was splitting call arguments inside f-string
{...}interpolations because two things were wrong.Root cause
-
Interpolation expressions were formatted like normal code —
format_stringcalledself.expression(e)with no constraint, so long calls likeshared.format_duration(remaining)were wrapped across lines inside{...}. -
next_break_fits(false)was a no-op during printing — Inlindig.rs,NextBreakFitscorrectly set in the layout pass, but passed through the parent mode unchanged. So existing uses of on call formatting also weren't actually preventing breaks.
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.