Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Position of Comments in a Line(How to manipulate the ordering of hidden and semantic regions)
Position of Comments in a Line [message #1849554] Mon, 24 January 2022 23:05
Eclipse UserFriend
Hi Eclipse forum,

Is it possible to always force comments to move to the end of their line during serialization? My dilemma is that I've parsed a model and used API commands to add some extra arguments to a line with a comment and the arguments were simply appended to the end of the line. This placed them after the comment which, despite being tagged as a semantic region, effectively makes them into comments upon serialization. To illustrate:

Original line:
keyword arg1 arg2 //SL_COMMENT

Desired line:
keyword arg1 arg2 arg3 //SL_COMMENT

Outcome:
keyword arg1 arg2 //SL_COMMENTarg3


A similar issue will also occur with ML_COMMENTS:

Original line:
keyword arg1 arg2 
//ML_COMMENT

Desired line:
keyword arg1 arg2 arg3 
//ML_COMMENT

Outcome:
keyword arg1 arg2 
//ML_COMMENTarg3


When comments are not involved, adding new arguments to a model via API commands behaves as expected. I've tried to address this via the formatter since the added arguments are still correctly treated as semantic regions. However, I don't see an obvious way to reorder the hidden and semantic regions. Additionally, using append and/or prepend commands to target the comment's hidden region does not seem to apply the spacing as specified.

Any suggestions or insights would be appreciated!
Previous Topic:Partial instance conversion between EMF<->Xtext
Next Topic:Formatting comma-separated list with new line & indent
Goto Forum:
  


Current Time: Thu Jul 03 04:36:20 EDT 2025

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

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

Back to the top