Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions src/vs/workbench/contrib/bulkEdit/browser/bulkEditService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { Extensions, IConfigurationRegistry } from '../../../../platform/configu
import { IDialogService } from '../../../../platform/dialogs/common/dialogs.js';
import { InstantiationType, registerSingleton } from '../../../../platform/instantiation/common/extensions.js';
import { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';
import { ILogService } from '../../../../platform/log/common/log.js';
import { canLog, ILogService, LogLevel } from '../../../../platform/log/common/log.js';
import { IProgress, IProgressStep, Progress } from '../../../../platform/progress/common/progress.js';
import { Registry } from '../../../../platform/registry/common/platform.js';
import { UndoRedoGroup, UndoRedoSource } from '../../../../platform/undoRedo/common/undoRedo.js';
Expand Down Expand Up @@ -141,26 +141,33 @@ class BulkEdit {
return resources.flat();
}

private _logEdits(operation: string, edits: ResourceEdit[]): void {
// avoid serializing (potentially very many) edits when debug logging is off
if (canLog(this._logService.getLevel(), LogLevel.Debug)) {
this._logService.debug(operation, JSON.stringify(edits));
}
}

private async _performFileEdits(edits: ResourceFileEdit[], undoRedoGroup: UndoRedoGroup, undoRedoSource: UndoRedoSource | undefined, confirmBeforeUndo: boolean, progress: IProgress<void>): Promise<readonly URI[]> {
this._logService.debug('_performFileEdits', JSON.stringify(edits));
this._logEdits('_performFileEdits', edits);
const model = this._instaService.createInstance(BulkFileEdits, this._label || localize('workspaceEdit', "Workspace Edit"), this._code || 'undoredo.workspaceEdit', undoRedoGroup, undoRedoSource, confirmBeforeUndo, progress, this._token, edits);
return await model.apply();
}

private async _performTextEdits(edits: ResourceTextEdit[], undoRedoGroup: UndoRedoGroup, undoRedoSource: UndoRedoSource | undefined, progress: IProgress<void>, reason: TextModelEditSource | undefined): Promise<readonly URI[]> {
this._logService.debug('_performTextEdits', JSON.stringify(edits));
this._logEdits('_performTextEdits', edits);
const model = this._instaService.createInstance(BulkTextEdits, this._label || localize('workspaceEdit', "Workspace Edit"), this._code || 'undoredo.workspaceEdit', this._editor, undoRedoGroup, undoRedoSource, progress, this._token, edits);
return await model.apply(reason);
}

private async _performCellEdits(edits: ResourceNotebookCellEdit[], undoRedoGroup: UndoRedoGroup, undoRedoSource: UndoRedoSource | undefined, progress: IProgress<void>): Promise<readonly URI[]> {
this._logService.debug('_performCellEdits', JSON.stringify(edits));
this._logEdits('_performCellEdits', edits);
const model = this._instaService.createInstance(BulkCellEdits, undoRedoGroup, undoRedoSource, progress, this._token, edits);
return await model.apply();
}

private async _performOpaqueEdits(edits: ResourceAttachmentEdit[], undoRedoGroup: UndoRedoGroup, undoRedoSource: UndoRedoSource | undefined, progress: IProgress<void>): Promise<readonly URI[]> {
this._logService.debug('_performOpaqueEdits', JSON.stringify(edits));
this._logEdits('_performOpaqueEdits', edits);
const model = this._instaService.createInstance(OpaqueEdits, undoRedoGroup, undoRedoSource, progress, this._token, edits);
return await model.apply();
}
Expand Down
Loading