Skip to content
Merged
5 changes: 5 additions & 0 deletions .changeset/add-editor-auto-close-settings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"zoo-code": minor
---

Add settings to control whether editor tabs Zoo opens during diff edits are auto-closed after accept/reject: auto-close transiently-opened files, auto-close even after user interaction (a refinement of the first), and auto-close newly created files.
7 changes: 7 additions & 0 deletions .changeset/fix-diff-scroll-position.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"zoo-code": patch
---

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to investigate why so many agents create these changeset files lol, I saw it in other PRs too. I think it might be some instruction in the zoo repository

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

figured it out, looks like they look at changesets in the repo and assume we need to generate one. We need to add instructions about it in agents.md, or just allow changesets in general

Fix diff view scroll position and tab handling when applying edits. The diff now opens scrolled to the first changed line (including end-of-file removals, which are clamped to a valid line in the modified document) instead of forcing the viewport to the top. After accepting or rejecting a diff, files that were already open are restored to their pre-edit scroll position, and files that were not open before the edit have their transiently opened tab closed -- unless the user activated that tab during the diff, in which case it is kept open. Focus is no longer pulled back to the edited file when the user has navigated elsewhere. A file that was open in a preview tab is restored in a preview tab with the original scroll position, even if the target file replaced the preview tab and was automatically closed after the diff was accepted or rejected. A file that was pinned before the edit is re-pinned after the diff closes, so applying a diff no longer drops the tab's pinned state.

When a user clicks or edits inside the diff pane, the target file's tab is kept open after saving -- even if it was not previously open. If the user only scrolls in the diff pane, the existing close behavior is preserved. When the target file is re-revealed after a diff, it scrolls to the position most recently viewed by the user: if the user last scrolled in the diff pane, the target file mirrors that scroll position; if the user last scrolled in the target file's own editor, that position is used instead; otherwise the pre-edit scroll position is restored.
3 changes: 3 additions & 0 deletions packages/types/src/global-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ export const globalSettingsSchema = z.object({
execaShellPath: z.string().optional(),

diagnosticsEnabled: z.boolean().optional(),
autoCloseZooOpenedFiles: z.boolean().optional(),
autoCloseZooOpenedFilesAfterUserEdited: z.boolean().optional(),
autoCloseZooOpenedNewFiles: z.boolean().optional(),

rateLimitSeconds: z.number().optional(),
experiments: experimentsSchema.optional(),
Expand Down
3 changes: 3 additions & 0 deletions packages/types/src/vscode-extension-host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,9 @@ export type ExtensionState = Pick<
| "terminalProfile"
| "execaShellPath"
| "diagnosticsEnabled"
| "autoCloseZooOpenedFiles"
| "autoCloseZooOpenedFilesAfterUserEdited"
| "autoCloseZooOpenedNewFiles"
| "language"
| "modeApiConfigs"
| "customModePrompts"
Expand Down
525 changes: 506 additions & 19 deletions src/integrations/editor/DiffViewProvider.ts

Large diffs are not rendered by default.

Loading
Loading