microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.17k stars 29.29k forks source link

Notebooks do not offer conflict resolution on save, whereas regular files do, despite notebooks also supporting diffs. #227198

Open a-stewart opened 2 months ago

a-stewart commented 2 months ago

If you have a file conflict on save, with a regular file you get the message:

Failed to save '{0}': The content of the file is newer. Please compare your version with the file contents or overwrite the content of the file with your changes. Compare Overwrite

https://github.com/microsoft/vscode/blob/main/src/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.ts#L127

Whereas with a Notebook you get the similar message, but without the option to view the diff:

Failed to save '{0}': The content of the file is newer. Do you want to overwrite the file with your changes? Overwrite Discard

https://github.com/microsoft/vscode/blob/main/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopy.ts#L1143

Given that Notebooks do support side by side diffs, should this prompt now be updated to show the same message for Notebooks as it does for text files and offer resolution via a diff editor?

rebornix commented 1 month ago

This makes good sense to me, thanks for the suggestion!

bpasero commented 1 month ago

This needs to be implemented per working copy owner I would think, i.e. the storedFileWorkingCopy delegates to a handler that implements this flow. I don't think this can be implemented in a generic way because it needs to open working copy specific editors.

Happy to review a PR in this area 👍