A workspace edit represents changes to many resources managed in the workspace. The edit should either provide changes or documentChanges. If the client can handle versioned document edits and if documentChanges are present, the latter are preferred over changes.
A workspace edit can optionally provide resource changes. If present resource changes are applies after the changes/documentChanges has been applied.
interface WorkspaceEdit{
TextEdit[] changes
TextDocumentEdit[] documentChanges
ResourceChange[] resourceChanges
}
Changes to a folder or document on the workspace.
interface ResourceChange{
/**
* The resource change operation type
*/
ResourceChangeType changeType
/**
* The resource.
*
* If change type is CREATE a new file is created on the uri with the given content.
* The operation is ignored if uri is pointing to a folder.
* This will overwrite any existing files on this uri.
*
* If change type is DELETE the resource is deleted if it exists. If the
* uri is a folder this operation deletes all its children too.
*
* If change type is MOVE this uri is considered the source resource for the
* move and must point to an existing resource
*/
Uri path
/**
* The new uri for the resource pointed by path.
* Used only if change type is MOVE. Must be compatible with the path
* uri ie. must be a file uri if path is a file uri.
*
*/
Uri newPath
/**
* Required only if change type is CREATE
*/
string content
}
enum ResourceChangeType{
CREATE
DELETE
MOVE
}
In one of the issues on this topic there was a suggestion that it would be enough to provide a "delete" flag on changes. Create would be an insert of [0,0:<file contents], move would be delete + insert. Have you thought along those lines and if yes, what are you reasons to go with the current idea?