move WorkspaceEdit api additions to vscode.d.ts #10659

This commit is contained in:
Johannes Rieken 2018-07-26 18:43:09 +02:00
parent 7e421ef110
commit 4c5c94185f
2 changed files with 42 additions and 71 deletions

49
src/vs/vscode.d.ts vendored
View file

@ -2707,13 +2707,15 @@ declare module 'vscode' {
}
/**
* A workspace edit represents textual and files changes for
* A workspace edit is a collection of textual and files changes for
* multiple resources and documents.
*
* Use the [applyEdit](#workspace.applyEdit)-function to apply a workspace edit.
*/
export class WorkspaceEdit {
/**
* The number of affected resources.
* The number of affected resources of textual or resource changes.
*/
readonly size: number;
@ -2744,7 +2746,8 @@ declare module 'vscode' {
delete(uri: Uri, range: Range): void;
/**
* Check if this edit affects the given resource.
* Check if a text edit for a resource exists.
*
* @param uri A resource identifier.
* @return `true` if the given resource will be touched by this edit.
*/
@ -2766,6 +2769,33 @@ declare module 'vscode' {
*/
get(uri: Uri): TextEdit[];
/**
* Create a regular file.
*
* @param uri Uri of the new file..
* @param options Defines if an existing file should be overwritten or be
* ignored. When overwrite and ignoreIfExists are both set overwrite wins.
*/
createFile(uri: Uri, options?: { overwrite?: boolean, ignoreIfExists?: boolean }): void;
/**
* Delete a file or folder.
*
* @param uri The uri of the file that is to be deleted.
*/
deleteFile(uri: Uri, options?: { recursive?: boolean, ignoreIfNotExists?: boolean }): void;
/**
* Rename a file or folder.
*
* @param oldUri The existing file.
* @param newUri The new location.
* @param options Defines if existing files should be overwritten or be
* ignored. When overwrite and ignoreIfExists are both set overwrite wins.
*/
renameFile(oldUri: Uri, newUri: Uri, options?: { overwrite?: boolean, ignoreIfExists?: boolean }): void;
/**
* Get all text edits grouped by resource.
*
@ -7173,12 +7203,17 @@ declare module 'vscode' {
export function saveAll(includeUntitled?: boolean): Thenable<boolean>;
/**
* Make changes to one or many resources as defined by the given
* Make changes to one or many resources or create, delete, and rename resources as defined by the given
* [workspace edit](#WorkspaceEdit).
*
* When applying a workspace edit, the editor implements an 'all-or-nothing'-strategy,
* that means failure to load one document or make changes to one document will cause
* the edit to be rejected.
* All changes of a workspace edit are applied in the same order in which they have been added. If
* multiple textual inserts are made at the same position, these strings appear in the resulting text
* in the order the 'inserts' were made. Invalid sequences like 'delete file a' -> 'insert text in file a'
* cause failure of the operation.
*
* When applying a workspace edit that consists only of text edits an 'all-or-nothing'-strategy is used.
* A workspace edit with resource creations or deletions aborts the operation, e.g. consective edits will
* not be attempted, when a single edit fails.
*
* @param edit A workspace edit.
* @return A thenable that resolves when the edit could be applied.

View file

@ -697,70 +697,6 @@ declare module 'vscode' {
//#endregion
//#region joh: https://github.com/Microsoft/vscode/issues/10659
/**
* A workspace edit is a collection of textual and files changes for
* multiple resources and documents.
*
* Use the [applyEdit](#workspace.applyEdit)-function to apply a workspace edit.
*/
export interface WorkspaceEdit {
/**
* The number of affected resources of textual or resource changes.
*/
readonly size: number;
/**
* Create a regular file.
*
* @param uri Uri of the new file..
* @param options Defines if an existing file should be overwritten or be
* ignored. When overwrite and ignoreIfExists are both set overwrite wins.
*/
createFile(uri: Uri, options?: { overwrite?: boolean, ignoreIfExists?: boolean }): void;
/**
* Delete a file or folder.
*
* @param uri The uri of the file that is to be deleted.
*/
deleteFile(uri: Uri, options?: { recursive?: boolean, ignoreIfNotExists?: boolean }): void;
/**
* Rename a file or folder.
*
* @param oldUri The existing file.
* @param newUri The new location.
* @param options Defines if existing files should be overwritten or be
* ignored. When overwrite and ignoreIfExists are both set overwrite wins.
*/
renameFile(oldUri: Uri, newUri: Uri, options?: { overwrite?: boolean, ignoreIfExists?: boolean }): void;
}
export namespace workspace {
/**
* Make changes to one or many resources or create, delete, and rename resources.
*
* All changes of a workspace edit are applied in the same order in which they have been added. If
* multiple textual inserts are made at the same position, these strings appear in the resulting text
* in the order the 'inserts' were made. Invalid sequences like 'delete file a' -> 'insert text in file a'
* cause failure of the operation.
*
* When applying a workspace edit that consists only of text edits an 'all-or-nothing'-strategy is used.
* A workspace edit with resource creations or deletions aborts the operation, e.g. consective edits will
* not be attempted, when a single edit fails.
*
* @param edit A workspace edit.
* @return A thenable that resolves when the edit could be applied.
*/
export function applyEdit(edit: WorkspaceEdit): Thenable<boolean>;
}
//#endregion
//#region mjbvz,joh: https://github.com/Microsoft/vscode/issues/43768
export interface FileRenameEvent {
readonly oldUri: Uri;