the margins are not set when not an initial render

This commit is contained in:
Aiday Marlen Kyzy
2023-06-13 17:48:23 +02:00
parent eb98edb838
commit d85ee0f6c5
2 changed files with 6 additions and 3 deletions
@@ -203,7 +203,11 @@ export class InlineChatController implements IEditorContribution {
} else {
widgetPosition = this._strategy.getWidgetPosition();
}
this._zone.value.show((widgetPosition ?? this._zone.value.position) ?? this._activeSession.wholeRange.value.getEndPosition());
const position = ((widgetPosition ?? this._zone.value.position) ?? this._activeSession.wholeRange.value.getEndPosition());
this._zone.value.show(position);
if (initialRender) {
this._zone.value.setMargins(position);
}
}
protected async _nextState(state: State, options: InlineChatRunOptions | undefined): Promise<void> {
@@ -795,10 +795,9 @@ export class InlineChatZoneWidget extends ZoneWidget {
super.show(position, this._computeHeightInLines());
this.widget.focus();
this._ctxVisible.set(true);
this._setMargins(position);
}
private _setMargins(position: Position): void {
public setMargins(position: Position): void {
const viewModel = this.editor._getViewModel();
if (!viewModel) {
return;