mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-23 10:08:49 +01:00
- use chat input part for content widget
- use chat widget over renderer-reuse and custom input - allow to configure chat menus/actions - allow to define filter for chat list/tree
This commit is contained in:
@@ -59,7 +59,9 @@ export class InlineChatZoneWidget extends ZoneWidget {
|
||||
}
|
||||
}
|
||||
});
|
||||
this._disposables.add(this.widget.onDidChangeHeight(() => this._relayout()));
|
||||
this._disposables.add(this.widget.onDidChangeHeight(() => {
|
||||
this._relayout(this._computeHeightInLines());
|
||||
}));
|
||||
this._disposables.add(this.widget);
|
||||
this.create();
|
||||
|
||||
@@ -105,9 +107,16 @@ export class InlineChatZoneWidget extends ZoneWidget {
|
||||
}
|
||||
|
||||
private _computeHeightInLines(): number {
|
||||
const chatContentHeight = this.widget.getContentHeight();
|
||||
const editorHeight = this.editor.getLayoutInfo().height;
|
||||
|
||||
const contentHeight = Math.min(chatContentHeight, editorHeight * 0.42);
|
||||
const lineHeight = this.editor.getOption(EditorOption.lineHeight);
|
||||
const widgetHeight = this.widget.getHeight();
|
||||
return widgetHeight / lineHeight;
|
||||
const heightInLines = contentHeight / lineHeight;
|
||||
|
||||
console.log('ZONE#lineheight', chatContentHeight, editorHeight, contentHeight, heightInLines);
|
||||
|
||||
return heightInLines;
|
||||
}
|
||||
|
||||
protected override _onWidth(_widthInPixel: number): void {
|
||||
@@ -116,13 +125,6 @@ export class InlineChatZoneWidget extends ZoneWidget {
|
||||
}
|
||||
}
|
||||
|
||||
protected override _relayout() {
|
||||
if (this._dimension) {
|
||||
this._doLayout(this._dimension.height);
|
||||
}
|
||||
super._relayout(this._computeHeightInLines());
|
||||
}
|
||||
|
||||
override show(position: Position): void {
|
||||
assertType(this.container);
|
||||
|
||||
@@ -131,14 +133,13 @@ export class InlineChatZoneWidget extends ZoneWidget {
|
||||
this.container.style.marginLeft = `${marginWithoutIndentation}px`;
|
||||
|
||||
this._setWidgetMargins(position);
|
||||
this.widget.takeInputWidgetOwnership();
|
||||
super.show(position, this._computeHeightInLines());
|
||||
this.widget.focus();
|
||||
}
|
||||
|
||||
override updatePositionAndHeight(position: Position): void {
|
||||
this._setWidgetMargins(position);
|
||||
super.updatePositionAndHeight(position);
|
||||
super.updatePositionAndHeight(position, this._computeHeightInLines());
|
||||
}
|
||||
|
||||
protected override _getWidth(info: EditorLayoutInfo): number {
|
||||
|
||||
Reference in New Issue
Block a user