Skip to content

Commit 63ea963

Browse files
authored
Response preview not requiring IU (#457)
* Optimize tab group restoration by comparing current and saved states before closing editors_ * Disable elapsed time display in checkpoint creation progress indicator * Implement a failed application state for files and display it in the response preview UI when patches cannot be automatically applied * Add the ability to preview AI-generated code in a temporary file when changes fail to apply * Implement real-time per-file application progress and status reporting within the response preview interface * Introduce inline-file items to support parsing and rendering unmapped code blocks in response previews * Improve file block parsing logic to use append mode only when git-style conflict markers are detected during file path reuse * Update test case to handle merge conflicts with inline files by renaming and correcting file references * Add intelligent update success state and improve file preview error/warning UI with fix actions * Refactor response preview UI to improve error handling and action visibility with enhanced status indicators and interactive controls * Implement functionality to batch fix all files that failed to apply in the response preview using intelligent updates
1 parent 66e7053 commit 63ea963

49 files changed

Lines changed: 2049 additions & 705 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎packages/shared/src/types/file-in-preview.ts‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,27 @@ export type FileInPreview = {
99
diff_application_method?: 'recount' | 'search_and_replace'
1010
content?: string
1111
proposed_content?: string
12+
apply_failed?: boolean
13+
ai_content?: string
14+
is_applying?: boolean
15+
apply_status?: 'waiting' | 'thinking' | 'receiving' | 'done' | 'retrying'
16+
apply_progress?: number
17+
apply_tokens_per_second?: number
18+
fixed_with_intelligent_update?: boolean
1219
}
1320

1421
export type TextContentInPreview = {
1522
type: 'text'
1623
content: string
1724
}
1825

19-
export type ItemInPreview = FileInPreview | TextContentInPreview
26+
export type InlineFileInPreview = {
27+
type: 'inline-file'
28+
content: string
29+
language?: string
30+
}
31+
32+
export type ItemInPreview =
33+
| FileInPreview
34+
| TextContentInPreview
35+
| InlineFileInPreview

‎packages/ui/.storybook/preview.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import '@vscode/codicons/dist/codicon.css'
22
import 'simplebar-react/dist/simplebar.min.css'
33
import '../src/styles/global.scss'
4-
import './variables.css'
4+
import './styles.css'
55

66
export const parameters = {
77
layout: 'fullscreen'

‎packages/ui/.storybook/styles.css‎

Lines changed: 559 additions & 0 deletions
Large diffs are not rendered by default.

‎packages/ui/.storybook/variables.css‎

Lines changed: 0 additions & 49 deletions
This file was deleted.

‎packages/ui/src/components/editor/panel/ResponsePreview/ResponsePreview.module.scss‎

Lines changed: 172 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,54 @@
66
}
77

88
.info {
9-
padding: 4px 7px;
9+
display: flex;
10+
justify-content: space-between;
11+
gap: 4px;
1012
color: var(--vscode-descriptionForeground);
1113
font-size: 12px;
1214
border: 1px solid var(--vscode-sideBarSectionHeader-border);
13-
opacity: var(--dimmed-opacity);
1415
margin: 0 12px;
1516
border-radius: 8px;
17+
overflow: hidden;
18+
19+
&--error {
20+
border-color: var(--vscode-errorForeground);
21+
color: var(--vscode-errorForeground);
22+
}
1623

17-
> span {
18-
vertical-align: middle;
24+
&--warning {
25+
border-color: var(--vscode-inputValidation-warningBorder);
26+
color: var(--vscode-inputValidation-warningBorder);
27+
}
28+
29+
&__content {
30+
gap: 6px;
31+
flex: 1;
32+
overflow: hidden;
33+
text-overflow: ellipsis;
34+
white-space: nowrap;
35+
padding: 4px 0 4px 7px;
36+
37+
> span:first-child {
38+
font-size: 12px;
39+
transform: translateY(2px);
40+
margin-right: 4px;
41+
}
42+
}
43+
44+
&__action {
45+
display: flex;
1946
font-size: 12px;
47+
align-items: center;
48+
gap: 4px;
49+
cursor: pointer;
50+
white-space: nowrap;
51+
color: var(--vscode-textLink-foreground);
52+
padding: 0 7px 0 4px;
53+
54+
&:hover {
55+
background-color: var(--vscode-list-hoverBackground);
56+
}
2057
}
2158
}
2259

@@ -54,78 +91,161 @@
5491
margin-bottom: 0;
5592
}
5693

57-
&__file {
94+
&__item {
5895
display: flex;
59-
align-items: center;
60-
justify-content: space-between;
61-
gap: 8px;
62-
border: 1px solid var(--cwc-border-color-dimmed);
63-
padding: 0 8px;
64-
margin: 0 12px;
65-
height: 34px;
66-
border-radius: 8px;
67-
68-
&:hover {
69-
background-color: var(--vscode-list-hoverBackground);
70-
border-color: var(--cwc-border-color);
71-
72-
.list__file__actions {
73-
display: flex;
74-
}
75-
}
96+
flex-direction: column;
7697

77-
&--selected {
78-
background-color: var(--vscode-list-inactiveSelectionBackground);
98+
&__progress {
99+
display: flex;
100+
align-items: center;
101+
gap: 6px;
102+
font-size: 11px;
103+
color: var(--vscode-descriptionForeground);
104+
margin-right: 4px;
79105
}
80106

81-
&__left {
107+
&__file {
82108
display: flex;
83109
align-items: center;
110+
justify-content: space-between;
84111
gap: 8px;
85-
overflow: hidden;
112+
border: 1px solid var(--cwc-border-color-dimmed);
113+
padding: 0 8px;
114+
margin: 0 12px;
115+
height: 34px;
116+
border-radius: 8px;
117+
118+
&:hover {
119+
background-color: var(--vscode-list-hoverBackground);
120+
border-color: var(--cwc-border-color);
121+
122+
.list__item__file__actions {
123+
display: flex;
124+
}
125+
}
126+
127+
&--selected {
128+
background-color: var(--vscode-list-inactiveSelectionBackground);
129+
}
130+
131+
&--error {
132+
border-color: var(--vscode-errorForeground) !important;
133+
}
134+
135+
&--warning {
136+
border-color: var(--vscode-inputValidation-warningBorder) !important;
137+
}
86138

87-
&__label {
88-
flex: 1;
89-
text-overflow: ellipsis;
139+
&__left {
140+
display: flex;
141+
align-items: center;
142+
gap: 8px;
90143
overflow: hidden;
91-
white-space: nowrap;
92144

93-
> span:last-child {
94-
opacity: 0.7;
95-
margin-left: 0.5em;
96-
font-size: 0.9em;
145+
&__label {
146+
flex: 1;
147+
text-overflow: ellipsis;
148+
overflow: hidden;
149+
white-space: nowrap;
150+
151+
> span:last-child {
152+
opacity: 0.7;
153+
margin-left: 0.5em;
154+
font-size: 0.9em;
155+
}
156+
157+
&--new {
158+
color: var(--vscode-gitDecoration-untrackedResourceForeground);
159+
}
160+
161+
&--deleted {
162+
text-decoration: line-through;
163+
color: var(--vscode-gitDecoration-deletedResourceForeground);
164+
}
97165
}
166+
}
98167

99-
&--new {
100-
color: var(--vscode-gitDecoration-untrackedResourceForeground);
101-
}
168+
&__right {
169+
display: flex;
170+
align-items: center;
171+
gap: 4px;
172+
}
102173

103-
&--deleted {
104-
text-decoration: line-through;
174+
&__actions {
175+
display: none;
176+
align-items: center;
177+
}
178+
179+
&__line-numbers {
180+
display: flex;
181+
gap: 3px;
182+
183+
&__added {
184+
color: var(--vscode-gitDecoration-addedResourceForeground);
185+
}
186+
&__removed {
105187
color: var(--vscode-gitDecoration-deletedResourceForeground);
106188
}
107189
}
108190
}
191+
}
109192

110-
&__right {
111-
display: flex;
112-
align-items: center;
113-
gap: 8px;
193+
&__message {
194+
margin: 0 20px;
195+
display: flex;
196+
justify-content: space-between;
197+
gap: 4px;
198+
border: 1px solid var(--cwc-border-color-dimmed);
199+
border-top: none;
200+
border-bottom-left-radius: 6px;
201+
border-bottom-right-radius: 6px;
202+
overflow: hidden;
203+
204+
&--error {
205+
color: var(--vscode-errorForeground);
206+
border-color: var(--vscode-errorForeground);
114207
}
115208

116-
&__actions {
117-
display: none;
209+
&--warning {
210+
color: var(--vscode-inputValidation-warningBorder);
211+
border-color: var(--vscode-inputValidation-warningBorder);
118212
}
119213

120-
&__line-numbers {
121-
display: flex;
122-
gap: 0.3em;
214+
&--success {
215+
color: var(--vscode-notebookStatusSuccessIcon-foreground);
216+
}
123217

124-
&__added {
125-
color: var(--vscode-gitDecoration-addedResourceForeground);
218+
&__content {
219+
flex: 1;
220+
overflow: hidden;
221+
text-overflow: ellipsis;
222+
white-space: nowrap;
223+
font-size: 11px;
224+
padding: 2px 0 2px 6px;
225+
226+
> span:first-child {
227+
font-size: 12px !important;
228+
margin-right: 4px;
229+
transform: translateY(2px);
126230
}
127-
&__removed {
128-
color: var(--vscode-gitDecoration-deletedResourceForeground);
231+
}
232+
233+
&__actions {
234+
display: flex;
235+
236+
&__item {
237+
display: flex;
238+
font-size: 12px;
239+
align-items: center;
240+
gap: 4px;
241+
cursor: pointer;
242+
white-space: nowrap;
243+
color: var(--vscode-textLink-foreground);
244+
padding: 0 6px 0 3px;
245+
246+
&:hover {
247+
background-color: var(--vscode-list-hoverBackground);
248+
}
129249
}
130250
}
131251
}

0 commit comments

Comments
 (0)