ISSUE DESCRIPTION Formatter rewrites Lisette f-strings to multiline interpolation that…
- User
ISSUE DESCRIPTION
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.
ADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use
git checkout <file>to restore the file to its original state. You can also reset all changes in the repository usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you callsubmit) usinggit statusorgit diffcommands. However you don't need to usegit addorgit commitbefore submitting your changes. In fact,submitonly submits currently unstaged changes because it usesgit diffto get the changes that need to be submitted.CHECKLIST
Before submitting your solution, please go over the following checklist and make sure you've done everything:
- If an error was reported in the issue description, I have successfully reproduced it.
- If an error was reported in the issue description, I have confirmed that my fix resolves the error.
- I have thought about edge cases and made sure my fix handles them as well.
- I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.
Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!
(Current directory: /lisette, current file: none) bash-$
- Assistant
I'll start by exploring the repository structure and locating the formatter logic related to f-string / interpolation formatting.
- Assistant
The format crate looks central—I'll dig into how it handles f-strings and interpolation.
- Assistant
rg is not available, let me use grep instead.
- Assistant
Next I'll inspect how the formatter emits format-string expressions.
- Assistant
Let me read the format_string function and related call formatting code.
- Assistant
Interpolation is formatted as a normal expression, so calls can still break — I'll inspect call formatting and the pretty-printer next.
- Assistant
Let me look at how other formatters handle "must stay single line" contexts. The typical approach would be to either:
- Assistant
There's already
ForceBrokenand modes likeForcedUnbroken. Let me see if there's aforce_unbrokenmethod on Document. - Assistant
I'll search for existing format-string tests and any prior discussion of this limitation.
- Assistant
Let me look at the format tests in tests/spec/format
- Assistant
There's already a format_fstring_multiline_text_roundtrip and format_string snapshots. Let me read the format test module.
- Assistant
Let me look at existing format string tests and the call formatting more carefully. I need to reproduce the issue.
- Assistant
I'll try reproducing the breaking interpolation with a small formatting test.
- Assistant
I'll reproduce by writing a small temporary test using the format API.
- Assistant
I can use a temporary binary or run via cargo test in the format crate. Or use
cargo script. Let me check if there's a format CLI. - Assistant
Need to use the rust-toolchain from the project.
- Assistant
Toolchain is ready; next I'll run a reproduction from the workspace.
- Assistant
Need to copy toolchain or run from lisette.
- Assistant
I've reproduced the issue. I'll inspect forced unbroken and break handling next.
- Assistant
I'm in /tmp/fmt_repro now.
- Assistant
FlexBreak ignores ForcedUnbroken today—checking method-chain formatting next.
- Assistant
I'll check the CHANGELOG and git history for similar format fixes.
- Assistant
Implementing
ForceUnbrokenin the pretty-printer and wrapping f-string interpolations so they stay single-line. - Assistant
Need to navigate to the right lines first with goto or open.
- Assistant
I'll make comprehensive edits to lindig.rs.
- Assistant
Next I'll update FlexBreak/Group handling in format() and add the ForceUnbroken enum variant plus helper.
- Assistant
Need to goto first again.
- Assistant
Continue with the edits.
- Assistant
Now update Group and ForceBroken handling.
- Assistant
I need to update Group handling and ForceBroken | NextBreakFits, plus enum and methods.
- Assistant
Now add the enum variant and force_unbroken method.
- Assistant
Add force_unbroken method.
- Assistant
Now update format_string to force expressions unbroken.
- Assistant
Update the format_string method.
- Assistant
Trailing commas in unbroken calls may look off — checking join_pattern_entries next.
- Assistant
Trailing commas look fine unbroken; verifying the fix next.
- Assistant
The reported cases are fixed. I'll exercise a few more edge cases next.
- Assistant
I'll check pipeline formatting for forced newlines.
- Assistant
Need to cd first
- Assistant
Pipelines with 3+ segments always emit newlines — I'll test that edge case next.
- Assistant
I'll make multi-segment pipelines use group/strict_break so force_unbroken can keep them single-line.
- Assistant
Checking whether flex_break is still used elsewhere in this file.
- Assistant
Strange - the open tool has the file at absolute path but shell might not be in /lisette. The error says current dir is /tmp/fmt_repro from previous.
- Assistant
Need to remove unused flex_break import.
- Assistant
Need to go to line 5 first.
- Assistant
Now replace.
- Assistant
I'll test match-in-interpolation and re-check pipelines.
- Assistant
Match still expands in interpolations because of unconditional newlines — inspecting that next.
- Assistant
Keep forgetting to cd.
- Assistant
Looking at existing tests for pipelines to see expectation.
- Assistant
Let me see current snapshots.
- Assistant
I'll inspect as_block and match formatting for short forms.
- Assistant
Looking at match_:
- Assistant
Let me look at braced_body and join_sibling_body.
- Assistant
Let me read braced_body
- Assistant
I'll make ForcedUnbroken truly flatten by treating newlines as spaces, then restore pipeline Newline behavior.
- Assistant
Let me update ForceBroken, Newline in fits and format.
- Assistant
Now update format() for Newline.
- Assistant
Update Newline handling in format.
- Assistant
Now restore pipeline multi-segment to always break with Newline while 2-seg uses flex.
- Assistant
Update import and pipeline function.
- Assistant
Now restore pipeline function.
- Assistant
Restoring the original pipeline layout so multi-segment pipes keep breaking outside f-strings.
- Assistant
Retesting edge cases with thenew flattening behavior.
- Assistant
All edge cases look good. Running the format test suite next.
- Assistant
The ForceBroken + ForcedUnbroken interaction negated NextBreakFits—I'll restore that Fitssemantics.
- Assistant
I'll add a distinct Flatten mode so force_unbroken doesn'tdao collide with NextBreakFits.
- Assistant
Need to goto line 5.
- Assistant
I'll update Mode and the fit/format match arms carefully.
- Assistant
Now update format() to use Flatten instead of ForcedUnbroken for ForceUnbroken and Newline/Flex/Strict/Group.
- Assistant
Update Newline, FlexBreak, StrictBreak and Group, ForceUnbroken handlers.
- Assistant
Update Group and ForceUnbroken in format.
- Assistant
Update Group and ForceUnbroken handlers.
- Assistant
Retesting the formatter cases and the test suite.
- Assistant
Format tests are green. Checking whether emit shares the pretty-printer—those failures look suspicious.
- Assistant
I'll check whether the testharness formats sources before emit.
- Assistant
Emit output is missing its newlines — checking whether the emit path depends on the format crate.
- Assistant
Emit doesn't use format. Why are emit snapshots broken?
- Assistant
Need full test path.
- Assistant
This is very strange - emit output lost blank lines and tabs. Our format changes shouldn't affect emit. Unless... the test harness formats Go Mut? Or emit uses gofmt and something is wrong with PATH?
- Assistant
Emit failures come from missing Go, not our change. Cleaning snap.new files and running format tests only.
- Assistant
All 292 format tests pass. Cleaning up and doing a final review of the changes.
- Assistant
Need to fix typo with goto first.
- Assistant
Fix typo.
- Assistant
Cleaning up temporary files and submitting.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.5-35B-A3BCompare side by side →
Qwen/Qwen3.5-35B-A3BCompare side by side →