Skip to content
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 for files isn't atomic/undoable #52927

Closed
isidorn opened this issue Jun 26, 2018 · 9 comments
Closed

WorkspaceEdit for files isn't atomic/undoable #52927

isidorn opened this issue Jun 26, 2018 · 9 comments
Assignees
Labels
under-discussion Issue is under discussion for relevance, priority, approach workspace-edit
Milestone

Comments

@isidorn
Copy link
Contributor

isidorn commented Jun 26, 2018

Refs: #52800

I could not find anywhere specified that if one workspace edit fails, all consective edits will not even be attempted.
If feel like this is good behavior but expect some explanation in our vscode.d.ts comments.

@joaomoreno
Copy link
Member

I also wonder if we should specify the reason for returning false. How can an extension react correctly to a false result?

@jrieken
Copy link
Member

jrieken commented Jun 26, 2018

Well, there is this: "the editor implements an 'all-or-nothing'-strategy," which is arguably written towards textual edits (for historical reasons) but the idea is the same. The problem is more the lack of composite undo and the lack of undoable file operations.

@jrieken jrieken added this to the June 2018 milestone Jun 26, 2018
@jrieken jrieken added the polish Cleanup and polish issue label Jun 26, 2018
@joaomoreno
Copy link
Member

@jrieken Wait, I don't think that's true. all or nothing means that either all run or none run. With these file system changes, you can have some run and others don't, since there's no rollback. The current strategy is more like run until failure.

@jrieken
Copy link
Member

jrieken commented Jun 27, 2018

The problem is more the lack of composite undo and the lack of undoable file operations.

Yeah, I think it's still a desirable goal ;-)

@joaomoreno
Copy link
Member

It is... but aren't the docs wrong if they say it's all or nothing?

@jrieken
Copy link
Member

jrieken commented Jun 28, 2018

yeah, I was hoping we can fix it once this goes to stable API... I'll reopen and see what I can do there

@jrieken jrieken modified the milestones: June 2018, July 2018 Jun 28, 2018
@jrieken jrieken added under-discussion Issue is under discussion for relevance, priority, approach and removed polish Cleanup and polish issue labels Jun 28, 2018
@jrieken jrieken changed the title WorkspaceEdit: not specified that after one edit failed all consective edits will not be executed WorkspaceEdit for files isn't atomic/undoable Jun 28, 2018
@jrieken jrieken reopened this Jun 28, 2018
@jrieken
Copy link
Member

jrieken commented Jun 28, 2018

@bpasero Is it in reach to undo a file operation? Anything like that supported or thought of in the file/textfile service?

@bpasero
Copy link
Member

bpasero commented Jun 28, 2018

@jrieken the IFileService is probably not a good place for undo/redo, the ITextFileService might be a good fit, but obviously needs some infrastructure to implement this. I think the challenge is to undo delete operations, whereas move and create (once added) are probably easier to get right.

@aeschli
Copy link
Contributor

aeschli commented Jun 28, 2018

Slightly different topic, but also to be improved in the vscode.d.ts comment:

Note that all changes are applied in the same order in which

  • they have been added and that invalid sequences like 'delete file a' -> 'insert text in
  • file a' causes failure of the operation.

For text edits applied at the same offset, the rule is:
If multiple inserts are made with the same position, these strings appear in the resulting text in the order the 'insert' was made.

@jrieken jrieken closed this as completed Jul 26, 2018
jrieken added a commit that referenced this issue Jul 26, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Sep 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
under-discussion Issue is under discussion for relevance, priority, approach workspace-edit
Projects
None yet
Development

No branches or pull requests

5 participants