Language Server: How to react on external changes of the AST #122
Replies: 2 comments 3 replies
-
It looks like you are facing a "single source of truth" related issue. I strongly suggest you first have a look at Maximilian's talk on https://www.youtube.com/watch?v=yxS-Xsx-4Tw to understand what I am talking about... The EMF.cloud model server has some mechanics to reload a modified file on the server which should help. See eclipse-emfcloud/emfcloud-modelserver#115 But it is very important that you defined your model modification flow, and which is the source of truth for your model, and listen to any modification at this source from other participants. |
Beta Was this translation helpful? Give feedback.
-
@agonzalezgaliana please mark the question as answered if it is resolved for you, thank you! |
Beta Was this translation helpful? Give feedback.
-
I'm coming from the following SO question
As you can see, our requirement is to be able to model our model instances (only one *.ecore for the whole application) by means of different editors (Theia Tree editor and Textual representation by means of Xtext). Very similar to the Coffee editor, but (unfortunately) not exactly as how the Coffee editor works with the textual representation. As I understand from playing around with the Coffee editor (and by taking a look to the code), the textual modeling in the Coffee editor does not model a coffee machine (Coffee.ecore) but a workflow (Workflow.ecore) that somehow has some dependencies on the machine objects of the Coffee.ecore. The workflow modeling is somehow isolated and only when the *.coffee files are changed in our workspace, the Language Server reloads the coffee models and validates the workflow model against the machines.
In our case, we expect the Language Server (and hence the textual representation) to react on changes done in our model by means of the Theia Tree editor (i.e. the name of a tree node changes -> textual representation is adapted)
So far we're able to listen to model changes in the Language Server (coming from the Model 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:
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 (?)
We were wondering if anyone has faced a similar situation so maybe the solution could be shared here with us. We know that maybe the questions are too specific from the Xtext project, but we're also looking for similar experiences inside an EMFCloud modeling solution.
Kind regards.
Beta Was this translation helpful? Give feedback.
All reactions