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()`](c14a2d8169/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()`](c14a2d8169/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()`](7467efda59/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.
The old JS-based Welcome Screen was removed and replaced with the Rusty one.
Co-authored-by: Adam Obuchowicz <adam.obuchowicz@enso.org>
Co-authored-by: Adam Obuchowicz <adam.obuchowicz@luna-lang.org>
* refactor: remove invalid comment in ide/lib.rs
* refactor: current_project() returns Option
* refactor: create IDE controller without project
* refactor: handle missing project param in Cloud environment
* refactor: store project name in searcher
So no need in current_project call
* chore: apply rustfmt
* chore: fix tests
* refactor: rename maybe_project_name to project_name
* refactor: move project_name to BackendService::LanguageServer
* refactor: do not use early return in integration.rs
* refactor: use CloneCell instead of RefCell for current_project
* refactor: store model::Project in Searcher controller
* refactor: use expect instead of unwrap in searcher tests
* feat: add new_with_project_model constructor for desktop controller
It might be useful in tests
* chore: fix searcher tests