How to react on external changes of the AST [message #1849910] |
Tue, 08 February 2022 12:00 |
|
I'm coming from this SO question -> https://stackoverflow.com/q/70987069/3222340
Following the Coffee Editor example for the EMFCloud project (https://github.com/eclipse-emfcloud/coffee-editor) we're trying that our Language Server is able to react on external changes done in the Semantic Model by other EMFCloud components (i.e. Tree editor in Theia, GLSP, etc). So, for example, a rename operation done in the tree editor results in a change in my textual representation. Using the greeting example, if my textual representation looks like this:
Hello Foo !
Hello Bar !
Then someone changes "Foo" with "Baz" in the tree editor. Finally I'd like to react to that change in the Language Server and show the following in my text editor:
Hello Baz!
Hello Bar !
Currently we're at a point where the Language Server is able to save the semantic model (AST) in the EMFCloud.ModelServer so other editors can open it and work with it (i.e. rename elements).
The next step we would like to achieve is that the Language Server reacts on a rename operation in one of the nodes of our AST (as simplest example).
So far we're able to listen to model changes in the Language Server, however we don't know how to proceed (mainly because a lack of knowledge in the internal structures of Xtext's LS). Our guess on what to do would be the following:
1. Model Server sends new model to Language Server (via subscription mechanism)
2. The Language Server replaces the AST with the new model
3. Serialize the new AST and cache it into a Document (?)
At this point the text file (opened by the editor) is not in sync with the internal AST
4.a Maybe the Language Server forwards the serialization (text representation) to the editor (?)
4.b Maybe the Language Server overwrites the text file in the workspace (?)
Some guidance would be really appreciated
|
|
|
|
Powered by
FUDForum. Page generated in 0.07845 seconds