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

fix: IllegalStateException: Synchronizer should apply to only a single document, which is the one it was instantiated for #1081

Merged
merged 1 commit into from
Aug 8, 2023

Conversation

angelozerr
Copy link
Contributor

@angelozerr angelozerr commented Aug 8, 2023

fix: IllegalStateException: Synchronizer should apply to only a single document, which is the one it was instantiated for

Fixes #752

I spend so many times to reproduce the problem without success (I have tried to change git branch to reload the document, I have tried to change encoding to try to change the document instance, etc, I cannot reproduce the problem)

I created a PR where:

  • I removed the check of teh document instance
  • I get the document from the virtual file when I need to add a document listener (when the language server must be restarted with already opened files) and when I remove the listener from the document to be sure that we work with the document from virtual file and not with a document which could be unused (which usecases does that?)

private final @Nonnull
URI fileUri;
private final @Nonnull LanguageServerWrapper languageServerWrapper;
private final @Nonnull Document document;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the field still necessary now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it is not an elegant code,but commons use of document listener (add/remove) is to do it for the same document instance. I use this document instance to remove the listener (even if it could be used).

document, which is the one it was instantiated for

Fixes redhat-developer#752

Signed-off-by: azerr <[email protected]>
@sonarcloud
Copy link

sonarcloud bot commented Aug 8, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@angelozerr angelozerr marked this pull request as ready for review August 8, 2023 09:48
@fbricon fbricon merged commit 70b5a55 into redhat-developer:main Aug 8, 2023
10 of 11 checks passed
@fbricon
Copy link
Contributor

fbricon commented Aug 8, 2023

thanks @angelozerr!

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