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>, contents:Null<EitherType<Uint8Array, DataTransferFile>>}, ?metadata:Null<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 |
metadata | Optional metadata for the entry. |
delete(uri:Uri, range:Range, ?metadata:Null<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:Null<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:Null<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:Null<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:Null<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. |
set(uri:Uri, edits:ReadOnlyArray<EitherType<TextEdit, SnippetTextEdit>>):Void
set(uri:Uri, edits:ReadOnlyArray<WorkspaceEditNotebookMetadataTuple>):Void
set(uri:Uri, edits:ReadOnlyArray<NotebookEdit>):Void
set(uri:Uri, edits:ReadOnlyArray<WorkspaceEditMetadataTuple>):Void
Set (and replace) text edits or snippet edits for a resource.
Parameters:
uri | A resource identifier. |
---|---|
edits | An array of edits. |