Active editor doesn't detect when content on disk is newer
#7,036 opened on Jan 31, 2020
Description
Description
There is an inconsistency between Theia and VS Code, in that in doesn't detect if content of a file is newer when modified outside of Theia.
This happens also when you programmatically try to change the content of the active editor. Please see:
https://github.com/zowe/vscode-extension-for-zowe/blob/c7cd5c8a021ebe24b040d9c98c1d06dc99e3a3e7/src/extension.ts#L1700-L1738
In here, the editBuilder.delete(deleteRange); and editBuilder.insert(startPosition, oldDocText); don't mark the file as dirty, so when we call save() on the document, it doesn't actually generate the Compare. This works as expected in VS Code.
Reproduction Steps
In VS Code:
- open a file
- edit without saving
- open same file outside VS Code (I used Notepad)
- edit and save in Notepad
- save in VS Code
- Error is generated because content of the file is newer on disk
- from here, I am able to resolve this merge conflict by selecting Compare

In Theia, following exact same steps, the result is different:
- merge conflict is not generated and Theia silently saves the content and overwrites the file.

OS and Theia version: v 0.11.0 (built from source and ran on localhost) Nightly build (ran from docker theiaide/theia:next) Windows 10 Pro Chrome Version 78.0.3904.97 (Official Build) (64-bit)
Diagnostics: N/A