Skip to content

Commit 1b66d05

Browse files
committed
💄 simplify LivePreview creation
1 parent cc407c9 commit 1b66d05

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/vs/workbench/contrib/interactiveEditor/browser/interactiveEditorController.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ export class InteractiveEditorController implements IEditorContribution {
213213
this._strategy = this._instaService.createInstance(LiveStrategy, session, this._editor, this._zone.widget);
214214
break;
215215
case EditMode.LivePreview:
216-
this._strategy = this._instaService.createInstance(LivePreviewStrategy, session, this._editor, this._zone.widget, () => session!.wholeRange);
216+
this._strategy = this._instaService.createInstance(LivePreviewStrategy, session, this._editor, this._zone.widget);
217217
break;
218218
case EditMode.Preview:
219219
this._strategy = this._instaService.createInstance(PreviewStrategy, session, this._zone.widget);

src/vs/workbench/contrib/interactiveEditor/browser/interactiveEditorStrategies.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,6 @@ export class LivePreviewStrategy extends LiveStrategy {
336336
session: Session,
337337
editor: ICodeEditor,
338338
widget: InteractiveEditorWidget,
339-
private _getWholeRange: () => Range,
340339
@IContextKeyService contextKeyService: IContextKeyService,
341340
@IStorageService storageService: IStorageService,
342341
@IBulkEditService bulkEditService: IBulkEditService,
@@ -370,11 +369,11 @@ export class LivePreviewStrategy extends LiveStrategy {
370369

371370
override async renderChanges(response: EditResponse, changes: LineRangeMapping[]) {
372371

373-
this._diffZone.showDiff(() => this._getWholeRange(), changes);
372+
this._diffZone.showDiff(() => this._session.wholeRange, changes);
374373
this._updateSummaryMessage(changes);
375374

376375
if (response.singleCreateFileEdit) {
377-
this._previewZone.showCreation(this._getWholeRange(), response.singleCreateFileEdit.uri, await Promise.all(response.singleCreateFileEdit.edits));
376+
this._previewZone.showCreation(this._session.wholeRange, response.singleCreateFileEdit.uri, await Promise.all(response.singleCreateFileEdit.edits));
378377
} else {
379378
this._previewZone.hide();
380379
}

0 commit comments

Comments
 (0)