-
Notifications
You must be signed in to change notification settings - Fork 29.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WorkspaceEdit should support creating, deleting, and renaming of files #10659
Comments
Yeah, maybe it's enough to enrich the |
Agree. May be we should support create, rename and delete of files. |
@gorkem I cannot give an ETA, but it is on the backlog and it is on the radar for our next iteration plan. |
@gorkem no I don't as long as it doesn't beak existing clients. However it would be nice if you could implement this for VS Code :-). It shouldn't be too hard. |
Work has started on this, maybe Jan, surely Feb |
Fixes #10659 Allows workspace edits to also change files in the workspace
That's the new methods we have added on /**
* Renames a given resource in the workspace.
*
* @param from Uri of current resource.
* @param to Uri of renamed resource.
*/
renameResource(from: Uri, to: Uri): void;
/**
* Create a new resource in the workspace.
*
* @param uri Uri of resource to create.
*/
createResource(uri: Uri): void;
/**
* Delete a given resource in the workspace.
*
* @param uri Uri of resource to delete.
*/
deleteResource(uri: Uri): void;
/**
* Get the resource edits for this workspace edit.
*
* @returns A shallow copy of uri-tuples in which a rename-edit
* is represented as `[from, to]`, a delete-operation as `[from, null]`,
* and a create-operation as `[null, to]`;
*/
resourceEdits(): [Uri, Uri][];
/**
* Get all edits, textual changes and file changes. The order is the order
* in which edits have been added to this workspace edits. Textuals edits
* are grouped and the first textual edit for a resource matters.
*
* @returns A shallow copy of all changes.
*/
allEntries(): ([Uri, TextEdit[]] | [Uri, Uri])[]; |
@jrieken I've hooked up TS to use the new API with 7c96862 One small complication: TS doesn't tell us which files need to be created so I believe the code still has to use |
Yeah, I stumbled over that when looking into how TypeScript uses this and I have an item on my todo-list. One option would be to ignore files that already exist. However that might violate your assumption about the file being empty... Alternatively, we could expose more options on the create-call, like |
@mjbvz I have added an |
Moving to Juli for api finalisation |
Languages like Java require that renaming the top level class needs to rename the file as well. Currently the rename provider doesn't allow me to do that.
The text was updated successfully, but these errors were encountered: