- 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:
Johannes
2024-03-15 15:44:41 +01:00
parent 080f9685c0
commit 0ac95cc1b7
20 changed files with 411 additions and 376 deletions

View File

@@ -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 {