add ignoreIfExists-option #10659

This commit is contained in:
Johannes Rieken
2018-06-20 15:57:38 +02:00
parent 991b74bced
commit 257ae9f76c
7 changed files with 23 additions and 11 deletions

View File

@@ -766,7 +766,7 @@ export interface WorkspaceSymbolsDto extends IdObject {
export interface ResourceFileEditDto {
oldUri: UriComponents;
newUri: UriComponents;
options: { overwrite?: boolean };
options: { overwrite?: boolean, ignoreIfExists?: boolean };
}
export interface ResourceTextEditDto {

View File

@@ -499,7 +499,7 @@ export interface IFileOperation {
_type: 1;
from: URI;
to: URI;
options?: { overwrite?: boolean };
options?: { overwrite?: boolean, ignoreIfExists?: boolean; };
}
export interface IFileTextEdit {
@@ -516,12 +516,12 @@ export class WorkspaceEdit implements vscode.WorkspaceEdit {
this._edits.push({ _type: 1, from, to, options });
}
createFile(uri: vscode.Uri, options?: { overwrite?: boolean }): void {
this.renameFile(undefined, uri, options);
createFile(uri: vscode.Uri, options?: { overwrite?: boolean, ignoreIfExists?: boolean }): void {
this._edits.push({ _type: 1, from: undefined, to: uri, options });
}
deleteFile(uri: vscode.Uri): void {
this.renameFile(uri, undefined);
this._edits.push({ _type: 1, from: uri, to: undefined });
}
replace(uri: URI, range: Range, newText: string): void {
@@ -593,8 +593,8 @@ export class WorkspaceEdit implements vscode.WorkspaceEdit {
return values(textEdits);
}
allEntries(): ([URI, TextEdit[]] | [URI, URI, { overwrite?: boolean }])[] {
let res: ([URI, TextEdit[]] | [URI, URI, { overwrite?: boolean }])[] = [];
allEntries(): ([URI, TextEdit[]] | [URI, URI, { overwrite?: boolean, ignoreIfExists?: boolean }])[] {
let res: ([URI, TextEdit[]] | [URI, URI, { overwrite?: boolean, ignoreIfExists?: boolean }])[] = [];
for (let edit of this._edits) {
if (edit._type === 1) {
res.push([edit.from, edit.to, edit.options]);