Prevent Target Editor reverts for marker-only resource changes - #2414
Conversation
merks
left a comment
There was a problem hiding this comment.
That looks like a nice simple change to fix behavior that drives me crazy. 😕
|
Ah, that is that? Drove me also crazy, I always assumed that it is the XML language server. |
|
Ignore the license failure, it's been flaky again:
|
|
Big thanks @vlakn for this fix |
HeikoKlare
left a comment
There was a problem hiding this comment.
I did some manuel testing of the change (in particular that marker/bookmark changes do not revert changes of the editor content) and found everything to work fine so far.
Awesome to have this fixed. Thank you, @vlakn!
|
FYI, I manually test this in a self-hosted launch, first reproducing the problem (with the language server stuff in the target platform), then applying the patch to verify that the reverts don't happen, and then also verifying that if I edit the file via a different editor and save, the revert does happen. So this looks great! 🏆 🏅 |
Summary
The issue first surfaced with the m2e PDE integration, which triggers marker updates while editing a
.targetdefinition. These marker updates causeTargetEditorto revert the editor, discarding unsaved source-page input.The behavior is not specific to m2e. Creating a bookmark on the open
.targetfile also produces a marker-only resource delta and triggers the same revert.For example, enter any unsaved XML change in the source page and then create a bookmark on the
.targetfile. The Target Editor discards the working copy although the file content remains unchanged.This change prevents the Target Editor from reverting unsaved source-page edits when the workspace reports a marker-only change for the opened
.targetfile.Background
Commit 68642a1 extended
TargetEditor.doRevert()to also revert dirty text-editor pages.TargetEditor.InputHandler.resourceChanged()currently invokesdoRevert()for everyIResourceDelta.CHANGEDdelta on the target file. This includes marker-only deltas, although they do not alter the target definition content.With the m2e PDE integration installed, workspace refreshes and marker updates trigger such deltas. While editing the XML source page, typing a character such as
<then discards the unsaved working copy.Before
After