Skip to content
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

Refresh on Access does not work for Xtext editors #2385

Closed
cdietrich opened this issue Sep 20, 2019 · 12 comments
Closed

Refresh on Access does not work for Xtext editors #2385

cdietrich opened this issue Sep 20, 2019 · 12 comments
Assignees
Milestone

Comments

@cdietrich
Copy link
Contributor

cdietrich commented Sep 20, 2019

Refresh on Access does not work for Xtext editors

(2) configure workspace for refresh on access
(1) open a Xtext based dsl file
(2) modify on disk
(3) click into the editor

Expected behaviour:
Editor refreshes (e.g. as .java or .txt)
Actual behaviour:
Editor does not refresh

This is caused by the customization in

org.eclipse.xtext.ui.editor.model.XtextDocumentProvider.isSynchronized(Object)

i have no idea why the code there is like it is and what doing some copy&paste from superclass would break

Question: can the XtextDocumentProvider be fixed without breaking something else

@szarnekow
Copy link
Contributor

@szarnekow szarnekow self-assigned this Oct 25, 2019
@cdietrich
Copy link
Contributor Author

@szarnekow are you actively working on this?

@szarnekow
Copy link
Contributor

Not on the fix for the current impl in isolation, no

@cdietrich cdietrich transferred this issue from eclipse/xtext-eclipse Apr 17, 2023
@iloveeclipse
Copy link
Contributor

This is caused by the customization in
org.eclipse.xtext.ui.editor.model.XtextDocumentProvider.isSynchronized(Object)
i have no idea why the code there is like it is and what doing some copy&paste from superclass would break
Question: can the XtextDocumentProvider be fixed without breaking something else

That is what we've also just found. We plan to provide a PR that should fix that, current state is just not acceptable from the user point of view.

@mehmet-karaman
Copy link
Contributor

Removing the isSynchronized implementation and make use of its super implementation works. But for the case if the editor was dirty and the file was edited outside of eclipse, the user gets a dialog in which he can choose loading of the new content or ignore the change. If the user selects to ignore the changes, the dirty editor can't save it anymore, because the file is out of sync. So I am going to investigate this problem too.

mehmet-karaman added a commit to mehmet-karaman/xtext that referenced this issue Jul 23, 2024
This bugfix contains the fix for unsync workspace files wrt. the file
system (see the
DirtyStateEditorSupportIntegrationTest.testModifyFileInExternEditor) and
a one liner for beeing able to save the file when the changes were
ignored. (see the ignored test case
DirtyStateEditorSupportIntegrationTest.testModifyDirtyFileInExternEditor).

The issue for this fix can be found here:
eclipse-xtext#2385
mehmet-karaman added a commit to mehmet-karaman/xtext that referenced this issue Jul 23, 2024
This bugfix contains the fix for unsync workspace files wrt. the file
system (see the
DirtyStateEditorSupportIntegrationTest.testModifyFileInExternEditor) and
a one liner for beeing able to save the file when the changes were
ignored. (see the ignored test case
DirtyStateEditorSupportIntegrationTest.testModifyDirtyFileInExternEditor).

The issue for this fix can be found here:
eclipse-xtext#2385
mehmet-karaman added a commit to mehmet-karaman/xtext that referenced this issue Jul 24, 2024
This bugfix contains the fix for unsync workspace files wrt. the file
system (see the
DirtyStateEditorSupportIntegrationTest.testModifyFileInExternEditor) and
a one liner for beeing able to save the file when the changes were
ignored. (see the ignored test case
DirtyStateEditorSupportIntegrationTest.testModifyDirtyFileInExternEditor).

The issue for this fix can be found here:
eclipse-xtext#2385
mehmet-karaman added a commit to mehmet-karaman/xtext that referenced this issue Aug 9, 2024
This bugfix contains the fix for unsync workspace files wrt. the file
system (see the
DirtyStateEditorSupportIntegrationTest.testModifyFileInExternEditor) and
a one liner for beeing able to save the file when the changes were
ignored. (see the ignored test case
DirtyStateEditorSupportIntegrationTest.testModifyDirtyFileInExternEditor).

The issue for this fix can be found here:
eclipse-xtext#2385
mehmet-karaman added a commit to mehmet-karaman/xtext that referenced this issue Aug 21, 2024
This bugfix contains the fix for unsync workspace files wrt. the file
system (see the
DirtyStateEditorSupportIntegrationTest.testModifyFileInExternEditor) and
a one liner for beeing able to save the file when the changes were
ignored. (see the ignored test case
DirtyStateEditorSupportIntegrationTest.testModifyDirtyFileInExternEditor).

The issue for this fix can be found here:
eclipse-xtext#2385
mehmet-karaman added a commit to mehmet-karaman/xtext that referenced this issue Aug 21, 2024
This bugfix contains the fix for unsync workspace files wrt. the file
system (see the
DirtyStateEditorSupportIntegrationTest.testModifyFileInExternEditor) and
a one liner for beeing able to save the file when the changes were
ignored. (see the ignored test case
DirtyStateEditorSupportIntegrationTest.testModifyDirtyFileInExternEditor).

The issue for this fix can be found here:
eclipse-xtext#2385
mehmet-karaman added a commit to mehmet-karaman/xtext that referenced this issue Sep 2, 2024
This bugfix contains the fix for unsync workspace files wrt. the file
system (see the
DirtyStateEditorSupportIntegrationTest.testModifyFileInExternEditor) and
a one liner for beeing able to save the file when the changes were
ignored. (see the ignored test case
DirtyStateEditorSupportIntegrationTest.testModifyDirtyFileInExternEditor).

The issue for this fix can be found here:
eclipse-xtext#2385
mehmet-karaman added a commit to mehmet-karaman/xtext that referenced this issue Sep 3, 2024
This bugfix contains the fix for unsync workspace files wrt. the file
system (see the
DirtyStateEditorSupportIntegrationTest.testModifyFileInExternEditor) and
a one liner for beeing able to save the file when the changes were
ignored. (see the ignored test case
DirtyStateEditorSupportIntegrationTest.testModifyDirtyFileInExternEditor).

The issue for this fix can be found here:
eclipse-xtext#2385
mehmet-karaman added a commit to mehmet-karaman/xtext that referenced this issue Sep 3, 2024
This bugfix contains the fix for unsync workspace files wrt. the file
system (see the
DirtyStateEditorSupportIntegrationTest.testModifyFileInExternEditor) and
a one liner for beeing able to save the file when the changes were
ignored. (see the ignored test case
DirtyStateEditorSupportIntegrationTest.testModifyDirtyFileInExternEditor).

The issue for this fix can be found here:
eclipse-xtext#2385
mehmet-karaman added a commit to mehmet-karaman/xtext that referenced this issue Sep 3, 2024
This bugfix contains the fix for unsync workspace files wrt. the file
system (see the
DirtyStateEditorSupportIntegrationTest.testModifyFileInExternEditor) and
a one liner for beeing able to save the file when the changes were
ignored. (see the ignored test case
DirtyStateEditorSupportIntegrationTest.testModifyDirtyFileInExternEditor).

The issue for this fix can be found here:
eclipse-xtext#2385
szarnekow pushed a commit that referenced this issue Sep 5, 2024
This bugfix contains the fix for unsync workspace files wrt. the file
system (see the
DirtyStateEditorSupportIntegrationTest.testModifyFileInExternEditor) and
a one liner for beeing able to save the file when the changes were
ignored. (see the ignored test case
DirtyStateEditorSupportIntegrationTest.testModifyDirtyFileInExternEditor).

The issue for this fix can be found here:
#2385
@mehmet-karaman
Copy link
Contributor

@szarnekow
I guess this ticket can be closed now?

@szarnekow
Copy link
Contributor

Indeed. Thank you for the heads-up.

@szarnekow szarnekow added this to the Release_2.37 milestone Sep 5, 2024
@LorenzoBettini
Copy link
Contributor

@mehmet-karaman one of the added tests seems to be flaky (especially in macOS):

java.lang.AssertionError
	at org.junit.Assert.fail(Assert.java:87)
	at org.junit.Assert.assertTrue(Assert.java:42)
	at org.junit.Assert.assertFalse(Assert.java:65)
	at org.junit.Assert.assertFalse(Assert.java:75)
	at org.eclipse.xtext.ui.tests.editor.DirtyStateEditorSupportIntegrationTest.testModifyFileInExternEditor(DirtyStateEditorSupportIntegrationTest.java:148)

maybe some refresh should be explicitly executed before the assertion?

@mehmet-karaman
Copy link
Contributor

I am going to check this.

mehmet-karaman added a commit to mehmet-karaman/xtext that referenced this issue Oct 2, 2024
mehmet-karaman added a commit to mehmet-karaman/xtext that referenced this issue Oct 4, 2024
mehmet-karaman added a commit to mehmet-karaman/xtext that referenced this issue Oct 4, 2024
mehmet-karaman added a commit to mehmet-karaman/xtext that referenced this issue Oct 7, 2024
mehmet-karaman added a commit to mehmet-karaman/xtext that referenced this issue Oct 7, 2024
mehmet-karaman added a commit to mehmet-karaman/xtext that referenced this issue Oct 14, 2024
@LorenzoBettini
Copy link
Contributor

@mehmet-karaman sorry to go back to this, but org.eclipse.xtext.ui.tests.editor.DirtyStateEditorSupportIntegrationTest.testModifyFileInExternEditor() is still very flaky on GitHub Actions in macOS. There's still something wrong with that test (there's some missed synchronization...).

expected:<[stuff foo]> but was:<[]>
org.junit.ComparisonFailure: expected:<[stuff foo]> but was:<[]>
	at org.junit.Assert.assertEquals(Assert.java:117)
	at org.junit.Assert.assertEquals(Assert.java:146)
	at org.eclipse.xtext.ui.tests.editor.DirtyStateEditorSupportIntegrationTest.testModifyFileInExternEditor(DirtyStateEditorSupportIntegrationTest.java:155)

I guess that the assertEquals is using wrong arguments:

assertEquals(document.get(), "");

should be

assertEquals("", document.get());

shouldn't it?

@LorenzoBettini
Copy link
Contributor

Shouldn't syncUtil.waitForReconciler(editor); be executed before checking document's contents?

@mehmet-karaman
Copy link
Contributor

Thanks for the hints.. Created a new PR which contains these changes: #3275

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants