Skip to content

Commit 63c0355

Browse files
authored
Fix flickering when clearing edits session (#239171)
This layout code needs to be cleaned up. Basically the view renders without the working set for an instant before the new model is initialized, then the working set comes back. The welcome view tries to center itself vertically, that's where the flicker comes from. I already fixed the same issue for followups in the chat view, we reserve some space for them. Applying the same to the working set's height.
1 parent d9ea0ed commit 63c0355

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

src/vs/workbench/contrib/chat/browser/chatInputPart.ts

+6
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,11 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
256256
return this._followupsHeight;
257257
}
258258

259+
private _editSessionWidgetHeight: number = 0;
260+
get editSessionWidgetHeight() {
261+
return this._editSessionWidgetHeight;
262+
}
263+
259264
private _inputEditor!: CodeEditorWidget;
260265
private _inputEditorElement!: HTMLElement;
261266

@@ -1514,6 +1519,7 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
15141519

15151520
this._inputPartHeight = data.inputPartVerticalPadding + data.followupsHeight + inputEditorHeight + data.inputEditorBorder + data.attachmentsHeight + data.toolbarsHeight + data.chatEditingStateHeight;
15161521
this._followupsHeight = data.followupsHeight;
1522+
this._editSessionWidgetHeight = data.chatEditingStateHeight;
15171523

15181524
const initialEditorScrollWidth = this._inputEditor.getScrollWidth();
15191525
const newEditorWidth = width - data.inputPartHorizontalPadding - data.editorBorder - data.inputPartHorizontalPaddingInside - data.toolbarsWidth - data.sideToolbarWidth;

src/vs/workbench/contrib/chat/browser/chatWidget.ts

+9-4
Original file line numberDiff line numberDiff line change
@@ -1208,10 +1208,15 @@ export class ChatWidget extends Disposable implements IChatWidget {
12081208
this.tree.layout(listHeight, width);
12091209
this.tree.getHTMLElement().style.height = `${listHeight}px`;
12101210

1211-
// Push the welcome message down so it doesn't change position when followups appear
1212-
const followupsOffset = this.viewOptions.renderFollowups ? Math.max(100 - this.inputPart.followupsHeight, 0) : 0;
1213-
this.welcomeMessageContainer.style.height = `${listHeight - followupsOffset}px`;
1214-
this.welcomeMessageContainer.style.paddingBottom = `${followupsOffset}px`;
1211+
// Push the welcome message down so it doesn't change position when followups or working set appear
1212+
let extraOffset: number = 0;
1213+
if (this.viewOptions.renderFollowups) {
1214+
extraOffset = Math.max(100 - this.inputPart.followupsHeight, 0);
1215+
} else if (this.viewOptions.enableWorkingSet) {
1216+
extraOffset = Math.max(100 - this.inputPart.editSessionWidgetHeight, 0);
1217+
}
1218+
this.welcomeMessageContainer.style.height = `${listHeight - extraOffset}px`;
1219+
this.welcomeMessageContainer.style.paddingBottom = `${extraOffset}px`;
12151220
this.renderer.layout(width);
12161221

12171222
const lastItem = this.viewModel?.getItems().at(-1);

0 commit comments

Comments
 (0)