Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to format datatype rules with Formatter2 (XText version 2.9)
How to format datatype rules with Formatter2 [message #1697370] Wed, 03 June 2015 13:34 Go to next message
Jiang Li is currently offline Jiang LiFriend
Messages: 27
Registered: November 2014
Junior Member
I have already tried Formatter2 of XText 2.9. It works well. But i could not find any way to format the datatype rules.

e.g. following grammar
Expression:
      value=Real
;

Real:
      INT '.' INT
;


I hope to format the rule 'Real' so that there are no white spaces existing before and after '.'

The method "regionFor(EObject).*" works only for EObject. The datatype rule 'Real' generates only "String" insteadof "EObject".

How can i format the datatype rules? Is there any other formatting method for datatype rules?
Re: How to format datatype rules with Formatter2 [message #1697390 is a reply to message #1697370] Wed, 03 June 2015 14:34 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
regionForFeature /region.forFeature on the parent should do the trick

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Wed, 03 June 2015 15:08]

Report message to a moderator

Re: How to format datatype rules with Formatter2 [message #1697495 is a reply to message #1697390] Thu, 04 June 2015 11:46 Go to previous messageGo to next message
Jiang Li is currently offline Jiang LiFriend
Messages: 27
Registered: November 2014
Junior Member
Christian Dietrich wrote on Wed, 03 June 2015 14:34
regionForFeature /region.forFeature on the parent should do the trick


I could not find the method "regionForFeature".
Do you mean "regionFor(expression) .feature(Literals.Expression_Value)"?
I use just this method. It can only append/prepend white spaces around "Real" instead of around '.' within the "Real".
Re: How to format datatype rules with Formatter2 [message #1697532 is a reply to message #1697495] Thu, 04 June 2015 15:41 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
can you please find a bug for that?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to format datatype rules with Formatter2 [message #1697552 is a reply to message #1697532] Thu, 04 June 2015 19:51 Go to previous messageGo to next message
Jiang Li is currently offline Jiang LiFriend
Messages: 27
Registered: November 2014
Junior Member
Christian Dietrich wrote on Thu, 04 June 2015 15:41
can you please find a bug for that?


do you mean "file" a bug for that ? Rolling Eyes
Re: How to format datatype rules with Formatter2 [message #1697553 is a reply to message #1697552] Thu, 04 June 2015 20:01 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
open a ticket here https://bugs.eclipse.org/bugs/enter_bug.cgi?product=TMF&component=Xtext

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to format datatype rules with Formatter2 [message #1697616 is a reply to message #1697553] Fri, 05 June 2015 12:18 Go to previous messageGo to next message
Jiang Li is currently offline Jiang LiFriend
Messages: 27
Registered: November 2014
Junior Member
Christian Dietrich wrote on Thu, 04 June 2015 20:01
open a ticket here https://bugs.eclipse.org/bugs/enter_bug.cgi?product=TMF&component=Xtext


Done Smile
Re: How to format datatype rules with Formatter2 [message #1842760 is a reply to message #1697616] Wed, 30 June 2021 16:05 Go to previous message
Stanislav Tartakowski is currently offline Stanislav TartakowskiFriend
Messages: 5
Registered: October 2015
Junior Member
You need to define a ValueConverter for Real DataType in your IValueConverterService class. Here you can override toValue where you programmatically remove the spaces. This is applied on formatting.
Previous Topic:How to make the LSP server print more debug logs?
Next Topic:Issues with Xtext and Epsilon
Goto Forum:
  


Current Time: Tue Apr 23 17:59:43 GMT 2024

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

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

Back to the top