Repository navigation
Commit 6f395f7
committed
Improve handling of in-preview out-of-response file edits
- create `apps/editor/src/commands/apply-response-command/response-processor`, inside place `apps/editor/src/commands/apply-response-command/response-processor.ts` and handlers
- Extract the tab group capture and restoration logic (SavedTabGroups and restore_tab_groups) from apps/editor/src/commands/apply-response-command/apply-response-command.ts into a dedicated utility file utils/tab-group-manager.ts and import it back.
- Extract the workspace map creation and root resolution logic from `apply-response-command.ts` into a reusable util
- checkpoints related logic should be held by `apps/editor/src/features/checkpoints`, not `apps/editor/src/commands/apply-response-command`
- Extract the inline patch-repair processing logic from `apply-response-command.ts` into a new handler function inside `apps/editor/src/commands/apply-response-command/response-processor/handlers/patch-repair-handler.ts` and update the main command to call it.
- Refactor `apps/editor/src/commands/apply-response-command/apply-response-command.ts` by extracting the `preview_data.original_states` loop that builds `files_for_history` and calculates diff stats into a dedicated utility function in `apps/editor/src/commands/apply-response-command/utils/preview/build-history-files.ts`.
- Regarding response previewing: files outside of the original parsed response that were added due modification, should be removed when modification is reverted, so that we don't see +0 -0 items. Make sure restoring response from history keeps the file detail it was added outside the original response - we need to be able to continue removing it from the list if it becomes +0 -0.
- don't show 'apply with patch repair' on files that were 'added in preview'
├── apps
│ └── editor
│ └── src
│ ├── commands
│ │ └── apply-response-command
│ │ ├── apply-response-command.ts
│ │ ├── response-processor
│ │ │ ├── handlers
│ │ │ │ ├── diff-handler.ts
│ │ │ │ ├── fast-replace-handler.ts
│ │ │ │ ├── patch-repair-handler.ts
│ │ │ │ ├── restore-preview-handler.ts
│ │ │ │ ├── search-replace-handler.ts
│ │ │ │ └── truncated-handler.ts
│ │ │ ├── index.ts
│ │ │ └── response-processor.ts
│ │ ├── types
│ │ │ └── original-file-state.ts
│ │ └── utils
│ │ ├── file-checks.ts
│ │ ├── file-operations
│ │ │ ├── apply-file-relocations.ts
│ │ │ ├── cleanup-rename-source.ts
│ │ │ ├── close-file-tabs.ts
│ │ │ ├── create-file-if-needed.ts
│ │ │ ├── get-rename-source-info.ts
│ │ │ ├── handle-deleted-file-item.ts
│ │ │ ├── index.ts
│ │ │ ├── read-rename-source-file.ts
│ │ │ ├── relocate-file.ts
│ │ │ ├── remove-directory-if-empty.ts
│ │ │ ├── undo-files.ts
│ │ │ └── uri-exists.ts
│ │ ├── preview
│ │ │ ├── build-history-files.ts
│ │ │ ├── diff-utils.ts
│ │ │ ├── file-preparer.ts
│ │ │ ├── index.ts
│ │ │ ├── preview.ts
│ │ │ ├── temp-file-manager.ts
│ │ │ ├── types.ts
│ │ │ ├── virtual-document-provider.ts
│ │ │ ├── vscode-ui.ts
│ │ │ └── workspace-listener.ts
│ │ ├── preview-handler.ts
│ │ ├── response-parser
│ │ │ ├── index.ts
│ │ │ ├── parsers
│ │ │ │ └── diff-parser
│ │ │ │ ├── diff-parser.ts
│ │ │ │ ├── helpers
│ │ │ │ │ └── block-utils.ts
│ │ │ │ └── test
│ │ │ │ └── diff-parser.spec.ts
│ │ │ └── response-parser.ts
│ │ ├── state-manager.ts
│ │ ├── tab-group-manager.ts
│ │ └── workspace.ts
│ ├── features
│ │ └── checkpoints
│ │ ├── actions
│ │ │ ├── accept-checkpoint.ts
│ │ │ ├── create-checkpoint.ts
│ │ │ ├── delete-checkpoint.ts
│ │ │ ├── get-checkpoints.ts
│ │ │ └── index.ts
│ │ ├── types
│ │ │ ├── checkpoint.ts
│ │ │ └── index.ts
│ │ └── utils
│ │ ├── copy-optimised-recursively.ts
│ │ ├── get-checkpoint-path.ts
│ │ ├── get-incremented-description.ts
│ │ ├── git-utils.ts
│ │ └── index.ts
│ ├── services
│ │ └── websocket-manager.ts
│ └── views
│ └── prompt
│ ├── backend
│ │ ├── message-handlers
│ │ │ ├── handle-cancel-intelligent-update-file-in-preview.ts
│ │ │ ├── handle-discard-user-changes-in-preview.ts
│ │ │ ├── handle-focus-on-file-in-preview.ts
│ │ │ ├── handle-patch-repair.ts
│ │ │ ├── handle-preview-generated-code.ts
│ │ │ ├── handle-response-preview.ts
│ │ │ └── handle-toggle-file-in-preview.ts
│ │ └── prompt-view-provider.ts
│ ├── frontend
│ │ ├── Main
│ │ │ ├── Main.tsx
│ │ │ └── MainView
│ │ │ └── MainView.tsx
│ │ ├── Prompt.tsx
│ │ └── hooks
│ │ ├── use-preview-manager.ts
│ │ └── use-response-history.ts
│ └── types
│ └── messages.ts
└── packages
├── shared
│ └── src
│ └── types
│ ├── file-in-preview.ts
│ └── response-history-item.ts
└── ui
└── src
└── components
└── editor
└── prompt
├── ResponsePreview
│ ├── ResponsePreview.module.scss
│ ├── ResponsePreview.tsx
│ ├── components
│ │ ├── FileItem
│ │ │ ├── FileItem.module.scss
│ │ │ ├── FileItem.tsx
│ │ │ └── index.ts
│ │ ├── InlineFileItem
│ │ │ ├── InlineFileItem.module.scss
│ │ │ ├── InlineFileItem.tsx
│ │ │ └── index.ts
│ │ ├── TextItem
│ │ │ ├── TextItem.module.scss
│ │ │ ├── TextItem.tsx
│ │ │ └── index.ts
│ │ └── index.ts
│ └── index.ts
├── ResponsePreviewFooter
│ ├── ResponsePreviewFooter.module.scss
│ ├── ResponsePreviewFooter.tsx
│ └── index.ts
└── Responses
├── Responses.stories.tsx
└── Responses.tsx1 parent 8891c3b commit 6f395f7
28 files changed
Lines changed: 811 additions & 583 deletions
File tree
- apps/editor/src
- commands/apply-response-command
- response-processor
- handlers
- types
- utils
- file-operations
- preview
- features/checkpoints/actions
- views/prompt
- frontend/hooks
- types
- packages
- ui/src/components/editor/prompt/ResponsePreview/components/FileItem
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | | - | |
9 | | - | |
10 | | - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
9 | 13 | | |
10 | 14 | | |
11 | 15 | | |
12 | 16 | | |
13 | | - | |
| 17 | + | |
14 | 18 | | |
15 | 19 | | |
16 | 20 | | |
| |||
39 | 43 | | |
40 | 44 | | |
41 | 45 | | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
| 46 | + | |
48 | 47 | | |
49 | 48 | | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
59 | 56 | | |
60 | 57 | | |
61 | 58 | | |
| |||
98 | 95 | | |
99 | 96 | | |
100 | 97 | | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
105 | 103 | | |
106 | 104 | | |
107 | 105 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
10 | 14 | | |
11 | 15 | | |
12 | 16 | | |
| |||
31 | 35 | | |
32 | 36 | | |
33 | 37 | | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
52 | 50 | | |
53 | 51 | | |
54 | 52 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
9 | 13 | | |
10 | 14 | | |
11 | 15 | | |
12 | 16 | | |
13 | | - | |
14 | | - | |
15 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
16 | 20 | | |
17 | 21 | | |
18 | 22 | | |
| |||
38 | 42 | | |
39 | 43 | | |
40 | 44 | | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
10 | 14 | | |
11 | 15 | | |
12 | 16 | | |
13 | 17 | | |
14 | | - | |
| 18 | + | |
15 | 19 | | |
16 | 20 | | |
17 | 21 | | |
| |||
37 | 41 | | |
38 | 42 | | |
39 | 43 | | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
0 commit comments