show preview only for rename

This commit is contained in:
Johannes Rieken
2020-01-10 07:00:00 +01:00
parent 517ff5d3a9
commit 3e6ba164cc
5 changed files with 5 additions and 5 deletions
@@ -14,7 +14,7 @@ export const IBulkEditService = createDecorator<IBulkEditService>('IWorkspaceEdi
export interface IBulkEditOptions {
editor?: ICodeEditor;
progress?: IProgress<IProgressStep>;
noPreview?: boolean;
showPreview?: boolean;
}
export interface IBulkEditResult {
+1 -1
View File
@@ -200,7 +200,7 @@ class RenameController implements IEditorContribution {
this._bulkEditService.apply(renameResult, {
editor: this.editor,
noPreview: !inputFieldResult.wantsPreview
showPreview: inputFieldResult.wantsPreview
}).then(result => {
if (result.ariaSummary) {
alert(nls.localize('aria', "Successfully renamed '{0}' to '{1}'. Summary: {2}", loc!.text, inputFieldResult.newName, result.ariaSummary));
@@ -217,7 +217,7 @@ export class MainThreadTextEditors implements MainThreadTextEditorsShape {
$tryApplyWorkspaceEdit(dto: IWorkspaceEditDto): Promise<boolean> {
const { edits } = reviveWorkspaceEditDto(dto);
return this._bulkEditService.apply({ edits }, { noPreview: false }).then(() => true, err => false);
return this._bulkEditService.apply({ edits }).then(() => true, _err => false);
}
$tryInsertSnippet(id: string, template: string, ranges: readonly IRange[], opts: IUndoStopOptions): Promise<boolean> {
@@ -105,7 +105,7 @@ export class ReplaceService implements IReplaceService {
replace(match: FileMatchOrMatch, progress?: IProgress<IProgressStep>, resource?: URI): Promise<any>;
replace(arg: any, progress: IProgress<IProgressStep> | undefined = undefined, resource: URI | null = null): Promise<any> {
const edits: ResourceTextEdit[] = this.createEdits(arg, resource);
return this.bulkEditorService.apply({ edits }, { progress, noPreview: true }).then(() => this.textFileService.saveAll(edits.map(e => e.resource)));
return this.bulkEditorService.apply({ edits }, { progress }).then(() => this.textFileService.saveAll(edits.map(e => e.resource)));
}
openReplacePreview(element: FileMatchOrMatch, preserveFocus?: boolean, sideBySide?: boolean, pinned?: boolean): Promise<any> {
@@ -406,7 +406,7 @@ export class BulkEditService implements IBulkEditService {
async apply(edit: WorkspaceEdit, options?: IBulkEditOptions): Promise<IBulkEditResult> {
if (this._previewHandler && !options?.noPreview) {
if (this._previewHandler && options?.showPreview) {
edit = await this._previewHandler(edit, options);
}