-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
Merge editor and auto save #152841
Comments
Sounds interesting, we should try it out! |
Adding a new capability is quite easy, but adoption would not be very elegant: basically the merge editor when resolving the text model reference would have to update the working copy's capabilities ad-hoc and keep it up to date based on conflicts. It would have make sure to restore the original capabilities when being disposed. Might be a bit confusing for users because this also means that when you open the original file, auto save will not work, pending conflict resolution. But that is the price for sharing the same model I guess... |
Yeah, I am a bit worried if that out-weights the gains, esp once we have the message to warn you when closing with unresolved conflicts |
With auto save enabled, the editor would not have a way to override closing of the editor because the editor is not dirty when the save occured. And even if we had a way to override closing, the fact that the editor opens dirty and is saved would still change the file right away. I think the problematic part is:
I see no other way solving this than blocking auto save for as long as there are conflicts, or at least as long as the merge editor is being used to edit the file. The only alternative solution (I think we briefly discussed) is to find a way to NOT render merge decorations in the result editor without having to modify the file. |
60b7514 makes this a lot better, editor remains dirty, even with auto save. I wonder if we could sell this without further changes... |
I was wondering about the same and I think it's OK except for the fact that we are actually saving the file... E.g you see dirty, you save successfully, and still see dirty. That doesn't sound right tbh |
Hm yeah, maybe a topic for UX call. One could argue though that the merge editor simply needs more actions to get out of dirty state than just saving, you need to take action on all conflicts too and you cannot just do that by saving. We already have this problem irrespective of auto save because with those recent changes, the merge editor will remain dirty, even when saved, as long as there are conflicts. Slightly related, I wonder if the merge editors |
When opening a merge editor we take a snapshot of the result model. We use that snapshort to discard all merge changes so that you also restore the init state - independent of intermediate saves, #152841 (comment)
👍 I have implemented that in the |
@bpasero Given the "Discard" option I don't see a reason to do something special for preventing auto-save. Tho, what we would need is a way to trigger the |
@jrieken maybe a new optional method/property on |
Pro |
Yeah I like the idea of having a single property to drive this. To clarify: I would not marry this with dirty states, but if an editor decides to not implement the confirm handler, we simply do what we did before: check if the editor is dirty and bring up a generic confirm dialog if it is dirty. |
This is set dynamically whenever unhandled conflicts are detected. It unsets itself when merging is done so that the normal save-close-handler comes to place #152841
This is set dynamically whenever unhandled conflicts are detected. It unsets itself when merging is done so that the normal save-close-handler comes to place #152841
Closing - there is now a revert command to go back to the opening-time state |
To verify
|
(wasn't sure if we already had an issue for this)
In my mind, the merge editor should not auto save but stay dirty even when auto save is enabled. Especially since it opens dirty right when you click it, auto save fires right after.
Question is: should auto save still be supported if all conflicts are resolved? Maybe that would be a nice model:
I think there is missing working copy support for this because currently auto save is driven by a capability:
vscode/src/vs/workbench/browser/parts/editor/editorAutoSave.ts
Lines 94 to 96 in 75362a6
We could introduce a new capability
CanAutoSave
. But unsure how to wire this through because currently the merge editor uses the same text file model working copy as a normal editor.Thoughts?
The text was updated successfully, but these errors were encountered: