mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-16 08:53:26 +01:00
This commit is contained in:
@@ -279,7 +279,6 @@ export class InlineChatController implements IEditorContribution {
|
||||
widgetPosition = this._editor.getSelection().getStartPosition().delta(-1);
|
||||
}
|
||||
|
||||
let needsMargin = false;
|
||||
if (initialRender) {
|
||||
this._zone.value.setContainerMargins();
|
||||
}
|
||||
@@ -290,11 +289,8 @@ export class InlineChatController implements IEditorContribution {
|
||||
if (this._activeSession) {
|
||||
this._zone.value.updateBackgroundColor(widgetPosition, this._activeSession.wholeRange.value);
|
||||
}
|
||||
if (this._strategy) {
|
||||
needsMargin = this._strategy.needsMargin();
|
||||
}
|
||||
if (!this._zone.value.position) {
|
||||
this._zone.value.setWidgetMargins(widgetPosition, !needsMargin ? 0 : undefined);
|
||||
this._zone.value.setWidgetMargins(widgetPosition);
|
||||
this._zone.value.show(widgetPosition);
|
||||
} else {
|
||||
this._zone.value.updatePositionAndHeight(widgetPosition);
|
||||
|
||||
@@ -75,8 +75,6 @@ export abstract class EditModeStrategy {
|
||||
abstract renderChanges(response: ReplyResponse): Promise<Position | undefined>;
|
||||
|
||||
abstract hasFocus(): boolean;
|
||||
|
||||
abstract needsMargin(): boolean;
|
||||
}
|
||||
|
||||
export class PreviewStrategy extends EditModeStrategy {
|
||||
@@ -165,10 +163,6 @@ export class PreviewStrategy extends EditModeStrategy {
|
||||
hasFocus(): boolean {
|
||||
return this._zone.widget.hasFocus();
|
||||
}
|
||||
|
||||
needsMargin(): boolean {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -307,11 +301,6 @@ export class LivePreviewStrategy extends EditModeStrategy {
|
||||
this._zone.widget.updateStatus(message);
|
||||
}
|
||||
|
||||
override needsMargin(): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private async _updateDiffZones() {
|
||||
const diff = await this._editorWorkerService.computeDiff(this._session.textModel0.uri, this._session.textModelN.uri, { ignoreTrimWhitespace: false, maxComputationTimeMs: 5000, computeMoves: false }, 'advanced');
|
||||
if (!diff || diff.changes.length === 0) {
|
||||
@@ -901,10 +890,6 @@ export class LiveStrategy extends EditModeStrategy {
|
||||
this._zone.widget.updateStatus(message);
|
||||
}
|
||||
|
||||
override needsMargin(): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
hasFocus(): boolean {
|
||||
return this._zone.widget.hasFocus();
|
||||
}
|
||||
|
||||
@@ -1042,10 +1042,8 @@ export class InlineChatZoneWidget extends ZoneWidget {
|
||||
this.container.style.marginLeft = `${marginWithoutIndentation}px`;
|
||||
}
|
||||
|
||||
setWidgetMargins(position: Position, indentationWidth?: number): void {
|
||||
if (indentationWidth === undefined) {
|
||||
indentationWidth = this._calculateIndentationWidth(position);
|
||||
}
|
||||
setWidgetMargins(position: Position): void {
|
||||
const indentationWidth = this._calculateIndentationWidth(position);
|
||||
if (this._indentationWidth === indentationWidth) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user