Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to react on external changes of the AST
How to react on external changes of the AST [message #1849910] Tue, 08 February 2022 12:00 Go to next message
Alejandro González is currently offline Alejandro GonzálezFriend
Messages: 8
Registered: November 2021
Location: Aachen, Germany
Junior Member
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
Re: How to react on external changes of the AST [message #1852035 is a reply to message #1849910] Tue, 26 April 2022 18:53 Go to previous message
Alejandro González is currently offline Alejandro GonzálezFriend
Messages: 8
Registered: November 2021
Location: Aachen, Germany
Junior Member
We were able to find out a possible way to react to external changes. I've described it in an answer in the SO question
Previous Topic:Custom Syntax Colouring for ide
Next Topic:NullPointerException in Xtext IDE project after removing generate model statement from grammar
Goto Forum:
  


Current Time: Mon Oct 03 01:09:10 GMT 2022

Powered by FUDForum. Page generated in 0.01775 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top