Community
Participate
Working Groups
Build Identifier: The method #markEditorClean of DirtyStateEditorSupport tries to copy a 'clean' state into the dirty resource. When this method is called (twice) after saving XtextEditor, the 'clean' state obtained from the global index may actually be stale if concurrently executing XtextBuilder has not updated it yet. Please see the annotated call stack attached. Reproducible: Sometimes Steps to Reproduce: Because it seems to be a concurrency-related bug, I marked it as "Happens sometimes", but the following steps always reproduce the problem to me. 1. Import the attached projects into the workspace 2. Run the runtime workbench and make a project with files 'A.dmodel' and 'B.dmodel' with the following contents: A.dmodel: entity A {} B.dmodel: entity B extends A { parent : B } 3. Open 'A.dmodel' and 'B.dmodel'. Modify 'A.dmodel' contents to read 'entity A { parent : A }'. Notice the error tick on the 'B.dmodel' editor 4. Save the 'A.dmodel' editor. Undo the previous modification (or just remove the 'parent : A' feature). Notice there is still the error tick on the 'B.dmodel' editor (i.e. it has not been validated). When DirtyStateEditorSupport#modelChanged is called for 'A.dmodel' (in response to removing 'parent' feature) it compares the new resource description (which does not contain 'parent' feature) with the dirty resource description (which is supposed to contain 'parent' feature, but does not, because it reflects the previous 'stale' saved state as described above). Thus, it decides that no EObjectDescriptions have changed and does not announce dirty state change. Therefore no validation of dependent editors occurs.
Created attachment 207128 [details] Call stack
Created attachment 207129 [details] Sample language projects
Having lived with it for some time, I can say that the user experience may be quite confusing due to the bug... They may get no error annotations (in the dependent editors) when actually there are errors and they may be confronted with stale error annotations. Simply put, the validation of the language in question may seem broken from the user's point of view. It seems quite odd that DirtyStateEditorSupport#markEditorClean should take the resource description from the global index, introducing a timing dependency on XtextBuilder to update it after the file is saved. Why is this necessary? Why not just compute the description from the editor's underlying resource? /something like dirtyResource.copyState(dirtyResource.get())/ Thanks in advance.