A workspace edit is a collection of textual and files changes for multiple resources and documents.
Use the {@link workspace.applyEdit applyEdit}-function to apply a workspace edit.
Constructor
Variables
Methods
createFile(uri:Uri, ?options:{overwrite:Null<Bool>, ignoreIfExists:Null<Bool>}, ?metadata:WorkspaceEditEntryMetadata):Void
Create a regular file.
Parameters:
uri | Uri of the new file.. |
---|---|
options | Defines if an existing file should be overwritten or be ignored. When overwrite and ignoreIfExists are both set overwrite wins. When both are unset and when the file already exists then the edit cannot be applied successfully. |
metadata | Optional metadata for the entry. |
delete(uri:Uri, range:Range, ?metadata:WorkspaceEditEntryMetadata):Void
Delete the text at the given range.
Parameters:
uri | A resource identifier. |
---|---|
range | A range. |
metadata | Optional metadata for the entry. |
deleteFile(uri:Uri, ?options:{recursive:Null<Bool>, ignoreIfNotExists:Null<Bool>}, ?metadata:WorkspaceEditEntryMetadata):Void
Delete a file or folder.
Parameters:
uri | The uri of the file that is to be deleted. |
---|---|
metadata | Optional metadata for the entry. |
entries():Array<WorkspaceEditEntriesTuple>
get(uri:Uri):Array<TextEdit>
Get the text edits for a resource.
Parameters:
uri | A resource identifier. |
---|
Returns:
An array of text edits.
has(uri:Uri):Bool
Check if a text edit for a resource exists.
Parameters:
uri | A resource identifier. |
---|
Returns:
true
if the given resource will be touched by this edit.
insert(uri:Uri, position:Position, newText:String, ?metadata:WorkspaceEditEntryMetadata):Void
Insert the given text at the given position.
Parameters:
uri | A resource identifier. |
---|---|
position | A position. |
newText | A string. |
metadata | Optional metadata for the entry. |
renameFile(oldUri:Uri, newUri:Uri, ?options:{overwrite:Null<Bool>, ignoreIfExists:Null<Bool>}, ?metadata:WorkspaceEditEntryMetadata):Void
Rename a file or folder.
Parameters:
oldUri | The existing file. |
---|---|
newUri | The new location. |
options | Defines if existing files should be overwritten or be ignored. When overwrite and ignoreIfExists are both set overwrite wins. |
metadata | Optional metadata for the entry. |
replace(uri:Uri, range:Range, newText:String, ?metadata:WorkspaceEditEntryMetadata):Void
Replace the given range with given text for the given resource.
Parameters:
uri | A resource identifier. |
---|---|
range | A range. |
newText | A string. |
metadata | Optional metadata for the entry. |