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.
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 first inspect the repository structure and identify the formatter implementation and its test conventions. Then I’ll reproduce the multiline interpolation output with the existing formatter, implement the narrowest general fix, and run the relevant test suite plus a direct reproduction.
- Assistant
The project is a Rust workspace with multiple compiler/editor components. I’ll locate formatting code and existing f-string tests by searching for formatter APIs, interpolation AST nodes, and the compiler diagnostic text from the report.
- Assistant
ripgrepis unavailable, so I’ll usegrep. The dedicatedcrates/formatpackage is likely responsible; I’ll inspect its public entry point, formatter internals, and test locations, while tracing the exact compiler restriction to understand what source shapes must remain single-line. - Assistant
Formatting tests are integrated under
tests/spec/formatrather than unit tests in the library. I’ll inspect expression formatting—especiallyFormatStringand call grouping—and the pretty-printer’s “group/flatten” mechanics, then inspect representative formatting fixtures and the test harness invocation so the reproduction uses the project’s normal path. - Assistant
The AST formatter recursively emits interpolation expressions as ordinary documents, so any nested call group can choose a broken layout at the global 80-column width. The pretty-printer already has a
ForcedUnbrokenmode viaNextBreakFits; I’ll inspect its public constructors and call/sequence formatting to determine whether interpolation can safely force all optional breaks flat without affecting literal newlines or comments. - Assistant
NextBreakFits(..., false)is the existing mechanism that renders all descendant strict/flex breaks in their unbroken form regardless of width;truedoes the opposite. I’ll verify how it is used elsewhere, inspect exact call documents, and run a temporary example through the formatter before editing. Since tests cannot be added, the reproduction will be a disposable example/binary or a one-off existing CLI invocation. - Assistant
The formatter’s call layout confirms the failure: non-inlinable arguments use a normal
.group()and break when the surrounding f-string exceeds 80 columns. The likely fix is to wrap each interpolation expression in forced-unbroken mode. Before applying it, I’ll invokelis formaton a valid one-line interpolation long enough to trigger wrapping, then feed that output back to the formatter/compiler parser to confirm the reported failure. - Assistant
The toolchain is available; the CLI package name differs from its directory. I’ll read its manifest/usage and create a temporary
.lisfile containing the report’s pattern with enough prefix width to exceed the line limit. I’ll preserve the before/after and run the formatter a second time to demonstrate that its own generated output is rejected during lexing. - Assistant
The failure is reproduced exactly: formatting a valid one-line interpolation emits a multiline call, and a second formatter pass rejects it at lexing. Merely forcing optional breaks is insufficient for edge cases such as a three-stage pipeline, whose formatter uses hard
Newlinedocuments even when the original interpolation was valid on one line. I’ll add a document-levelflattenoperation that selects every unbroken separator, removes formatting-only force/group wrappers, and replaces hard formatting newlines with spaces, then apply it only to interpolation expressions. This guarantees compiler-compatible single-line interpolation for calls, pipelines, nested blocks, tuples/slices, and other expressions. - Assistant
The first edit range accidentally replaced the adjacent
force_breakmethod and duplicated thenext_break_fitssignature, producing the expected syntax error caught bycargo fmt. I’ll repair that method block, preserving both existing APIs around the new flatten operation, then re-run formatting and compilation checks. - Assistant
The method block is now structurally correct; only rustfmt’s preferred one-line match arm caused the command chain to stop before compilation. I’ll apply rustfmt, compile the formatter, and rerun the original reproduction plus a hard-newline edge case (a three-stage pipeline) to ensure both output and formatter idempotence remain parser-valid.
- Assistant
Both the reported call and the hard-newline pipeline now remain single-line inside braces, and formatting each generated file a second time succeeds. I’ll now run the complete formatting snapshot module (which also checks idempotence), inspect any failures for unintended layout changes, then run formatter/CLI tests and review the final diff/status.
- Assistant
The test package is named
tests(notlisette-tests), so the attempted invocation did not execute tests; it only fetched missing dev dependencies. I’ll rerun with the manifest’s actual package name and the formatting module filter. - Assistant
All 292 formatter snapshots pass, including f-string multiline-text roundtrips and idempotence checks. I’ll run the CLI package’s tests because formatting is exposed through both CLI and LSP, then inspect the final diff for scope and ensure no snapshots, test files, or temporary repository files were changed.
- Assistant
The final code diff is limited to the formatter and pretty-document helper; CLI tests (41 total across library/binary), rustfmt, and diff checks all pass. To verify the exact downstream impact rather than only re-lexing through the formatter, I’ll create a disposable minimal Lisette project containing the long f-string, format it, and run
lis buildon that formatted project. This will confirm compiler acceptance end-to-end without modifying repository tests. - Assistant
The end-to-end build attempt exposed two environment/setup issues rather than formatter regressions: my disposable sample used incorrect parameter syntax, and this container has no Go binary, so
lis buildcannot proceed regardless of source. I’ll correct the temporary project using repository syntax, run formatter andlis check(the full Lisette frontend), and retry build only to document that its sole remaining blocker is the missing external Go toolchain.
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
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
- xiaomi/mimo-v2.5-proCompare side by side →
- xiaomi/mimo-v2.5-proCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-lunaCompare side by side →