mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-19 14:49:48 +01:00
show preview only for rename
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user