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

Error on startup: Error during sending text change to Language Server: Peer has replied with an error: Error { code: 3003, message: "Invalid version… #3094

Closed
mwu-tow opened this issue Aug 12, 2021 · 0 comments · Fixed by #3186

Comments

@mwu-tow
Copy link
Contributor

mwu-tow commented Aug 12, 2021

 [E] Error during sending text change to Language Server: Peer has replied with an error: Error { code: 3003, message: "Invalid version [client version: bcc470b676b3f06ca5d7e1cf11a16d2be704736d881c695312041433, server version: a3bce320ed6d6db336387c643002fcdf6b7c49acd349f549948bb21e]", data: None }.
@mwu-tow mwu-tow transferred this issue from enso-org/ide Oct 28, 2021
akavel added a commit that referenced this issue Dec 13, 2021
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:

 1. The automatic addition of `import Standard.Visualization` line, [done internally when opening a new project in `controller::Project::initialize()`](https://github.com/enso-org/enso/blob/c14a2d81698217349394597fea778fd86bba47df/app/gui/src/controller/project.rs#L137-L141), was not reaching the Language Server. The cause of it was a race condition with [`self.model.subscribe()` in `Module::runner()`](https://github.com/enso-org/enso/blob/c14a2d81698217349394597fea778fd86bba47df/app/gui/src/model/module/synchronized.rs#L268). 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 the `subscribe()` call synchronous during the initialization of a project, instead of scheduling it for a non-deterministic later time.
 2. There was [a bug in `synchronized::Module::edit_for_snipped()`](https://github.com/enso-org/enso/blob/7467efda592ab5d7ce29122af20020293f9ceacf/app/gui/src/model/module/synchronized.rs#L362), making it erroneously "optimize out" any code insertions detected by `TextEdit::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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant