Conversation
…dering pi's edit tool result details provides both `patch` (standard unified diff with hunk headers) and `diff` (pre-formatted line-numbered diff without hunk headers). The edit renderer previously read only `details.diff`, causing both word-level emphasis and side-by-side split (`diffSplit`) to silently fall back because they require `@@` hunk headers to pair lines. Add `extractEditDiff` to prefer `details.patch` when available, falling back to `details.diff`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When
diffSplit: trueis enabled, theedittool diff never renders in side-by-side mode and silently falls back to a unified diff. Similarly, word-level diff emphasis and line-number gutters fail to activate foreditresults, degrading to plain line-colored output.Root Cause
In pi's core
edittool (packages/coding-agent/src/core/tools/edit.ts),EditToolDetailsexplicitly provides two diff representations:When executing an edit:
extensions/pretty.tspreviously read onlyresult.details.diff(the display-oriented diff which lacks@@hunk headers). Becausedetails.diffdoes not contain@@hunk headers, theinHunkstate in bothsrc/split.ts(parseRows) andsrc/diff.tsremainedfalseacross all lines. Consequently:buildSplittreated every line as an unparsedfullrow, failing to split into columns.colorizeDiffskipped paired word-diff analysis and line-number gutter formatting.Solution
extractEditDiff(result)inextensions/pretty.tsto preferdetails.patchwhen available, falling back todetails.diff.details.patch(the standard unified patch) consumed,buildSplitandcolorizeDiffreceive the expected hunk headers, allowing side-by-side split rendering, word-level emphasis, and line gutters to work as originally designed without altering any core parser logic.Verification
test/wire.test.ts:edit result prefers details.patch over details.diff(verifies split view separator│is present whendiffSplitis on)edit result falls back to details.diff when details.patch is absentbun run typecheck: clean (0 errors).bun test: all 124 tests passed (0 failed).