-
Notifications
You must be signed in to change notification settings - Fork 323
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 some edits not being sent to LangServ #3186
Fix some edits not being sent to LangServ #3186
Conversation
…v-digest-mismatch-180558676
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only minor issues, please fix them before merging (they don't require re-review I think).
app/gui/CHANGELOG.md
Outdated
- [Fixed "Invalid version" error during sending text change to Language | ||
Server.][3186] The error happened during project opening and after new node | ||
creation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the first place, I would say that an error in the console is fixed, because the user will notice rather log in the console than the error in Language Server communication.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️ thanks! done
Pull Request Description
Some edits were not being sent by IDE to Language Server, resulting in 3003 "Invalid version" errors being returned by LangServ, and forcing full invalidation (resynchronization) of text contents in LangServ.
This change fixes such errors observed when opening a new project, creating a new project, or adding a new node to a project.
Fixes #3094
Important Notes
The root cause showed up to be actually two separate issues, both of them reproduced by an "opening a new project" scenario:
import Standard.Visualization
line, done internally when opening a new project incontroller::Project::initialize()
, was not reaching the Language Server. The cause of it was a race condition withself.model.subscribe()
inModule::runner()
. In particular, the addition of the import was executed before the subscription, which resulted in an edition notification being lost and not sent to LangServer. The fix employed for this is to make thesubscribe()
call synchronous during the initialization of a project, instead of scheduling it for a non-deterministic later time.synchronized::Module::edit_for_snipped()
, making it erroneously "optimize out" any code insertions detected byTextEdit::from_prefix_postfix_differences()
. The fix employed for this was to improve the "optimizing out" condition, together with adding an accompanying test case verifying correct behavior (protecting against a future regression).Additionally, as a drive-by improvement, some statements in
ParsedSourceFile<>::serialize()
were reordered, to make them better match how the actual contents of an .enso file are structured, and thus make it easier to read/analyze the code.Checklist
Please include the following checklist in your PR: