提交 b8025bcf 编写于 作者: J Johannes Rieken

some bulk edit polish

上级 a361f69d
......@@ -226,17 +226,18 @@ class BulkEditModel implements IDisposable {
}
}
export type Edit = ResourceFileEdit | ResourceTextEdit;
type Edit = ResourceFileEdit | ResourceTextEdit;
export class BulkEdit {
class BulkEdit {
private _edits: Edit[] = [];
private _editor: ICodeEditor | undefined;
private _progress: IProgress<IProgressStep>;
private readonly _edits: Edit[] = [];
private readonly _editor: ICodeEditor | undefined;
private readonly _progress: IProgress<IProgressStep>;
constructor(
editor: ICodeEditor | undefined,
progress: IProgress<IProgressStep> | undefined,
edits: Edit[],
@ILogService private readonly _logService: ILogService,
@ITextModelService private readonly _textModelService: ITextModelService,
@IFileService private readonly _fileService: IFileService,
......@@ -246,14 +247,7 @@ export class BulkEdit {
) {
this._editor = editor;
this._progress = progress || emptyProgress;
}
add(edits: Edit[] | Edit): void {
if (Array.isArray(edits)) {
this._edits.push(...edits);
} else {
this._edits.push(edits);
}
this._edits = edits;
}
ariaMessage(): string {
......@@ -419,8 +413,11 @@ export class BulkEditService implements IBulkEditService {
// If the code editor is readonly still allow bulk edits to be applied #68549
codeEditor = undefined;
}
const bulkEdit = new BulkEdit(codeEditor, options.progress, this._logService, this._textModelService, this._fileService, this._textFileService, this._labelService, this._configurationService);
bulkEdit.add(edits);
const bulkEdit = new BulkEdit(
codeEditor, options.progress, edits,
this._logService, this._textModelService, this._fileService, this._textFileService, this._labelService, this._configurationService
);
return bulkEdit.perform().then(() => {
return { ariaSummary: bulkEdit.ariaMessage() };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册