mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
add content height change event for chat widget so that inline chat can relayout accordingly (#208883)
fixes https://github.com/microsoft/vscode/issues/208418
This commit is contained in:
parent
dd0f3a32fd
commit
298c42a605
|
@ -100,6 +100,9 @@ export class ChatWidget extends Disposable implements IChatWidget {
|
|||
private _onDidChangeHeight = this._register(new Emitter<number>());
|
||||
readonly onDidChangeHeight = this._onDidChangeHeight.event;
|
||||
|
||||
private readonly _onDidChangeContentHeight = new Emitter<void>();
|
||||
readonly onDidChangeContentHeight: Event<void> = this._onDidChangeContentHeight.event;
|
||||
|
||||
private contribs: IChatWidgetContrib[] = [];
|
||||
|
||||
private tree!: WorkbenchObjectTree<ChatTreeItem>;
|
||||
|
@ -499,6 +502,7 @@ export class ChatWidget extends Disposable implements IChatWidget {
|
|||
}
|
||||
|
||||
this.previousTreeScrollHeight = this.tree.scrollHeight;
|
||||
this._onDidChangeContentHeight.fire();
|
||||
}
|
||||
|
||||
private createInput(container: HTMLElement, options?: { renderFollowups: boolean; renderStyle?: 'default' | 'compact' }): void {
|
||||
|
@ -557,7 +561,12 @@ export class ChatWidget extends Disposable implements IChatWidget {
|
|||
},
|
||||
});
|
||||
}));
|
||||
this._register(this.inputPart.onDidChangeHeight(() => this.bodyDimension && this.layout(this.bodyDimension.height, this.bodyDimension.width)));
|
||||
this._register(this.inputPart.onDidChangeHeight(() => {
|
||||
if (this.bodyDimension) {
|
||||
this.layout(this.bodyDimension.height, this.bodyDimension.width);
|
||||
}
|
||||
this._onDidChangeContentHeight.fire();
|
||||
}));
|
||||
this._register(this.inputEditor.onDidChangeModelContent(() => this.updateImplicitContextKinds()));
|
||||
this._register(this.chatAgentService.onDidChangeAgents(() => {
|
||||
if (this.viewModel) {
|
||||
|
|
|
@ -260,6 +260,9 @@ export class InlineChatWidget {
|
|||
this._onDidChangeHeight.fire();
|
||||
}));
|
||||
|
||||
this._store.add(this.chatWidget.onDidChangeContentHeight(() => {
|
||||
this._onDidChangeHeight.fire();
|
||||
}));
|
||||
|
||||
// context keys
|
||||
this._ctxResponseFocused = CTX_INLINE_CHAT_RESPONSE_FOCUSED.bindTo(this._contextKeyService);
|
||||
|
@ -268,8 +271,8 @@ export class InlineChatWidget {
|
|||
this._store.add(tracker.onDidFocus(() => this._ctxResponseFocused.set(true)));
|
||||
|
||||
this._ctxInputEditorFocused = CTX_INLINE_CHAT_FOCUSED.bindTo(_contextKeyService);
|
||||
this._chatWidget.inputEditor.onDidFocusEditorWidget(() => this._ctxInputEditorFocused.set(true));
|
||||
this._chatWidget.inputEditor.onDidBlurEditorWidget(() => this._ctxInputEditorFocused.set(false));
|
||||
this._store.add(this._chatWidget.inputEditor.onDidFocusEditorWidget(() => this._ctxInputEditorFocused.set(true)));
|
||||
this._store.add(this._chatWidget.inputEditor.onDidBlurEditorWidget(() => this._ctxInputEditorFocused.set(false)));
|
||||
|
||||
const statusMenuId = options.statusMenuId instanceof MenuId ? options.statusMenuId : options.statusMenuId.menu;
|
||||
const statusMenuOptions = options.statusMenuId instanceof MenuId ? undefined : options.statusMenuId.options;
|
||||
|
|
Loading…
Reference in a new issue