Skip to main content



      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 09:34 Go to next message
Eclipse UserFriend
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 10:34 Go to previous messageGo to next message
Eclipse UserFriend
regionForFeature /region.forFeature on the parent should do the trick

[Updated on: Wed, 03 June 2015 11:08] by Moderator

Re: How to format datatype rules with Formatter2 [message #1697495 is a reply to message #1697390] Thu, 04 June 2015 07:46 Go to previous messageGo to next message
Eclipse UserFriend
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 11:41 Go to previous messageGo to next message
Eclipse UserFriend
can you please find a bug for that?
Re: How to format datatype rules with Formatter2 [message #1697552 is a reply to message #1697532] Thu, 04 June 2015 15:51 Go to previous messageGo to next message
Eclipse UserFriend
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 16:01 Go to previous messageGo to next message
Eclipse UserFriend
open a ticket here https://bugs.eclipse.org/bugs/enter_bug.cgi?product=TMF&component=Xtext
Re: How to format datatype rules with Formatter2 [message #1697616 is a reply to message #1697553] Fri, 05 June 2015 08:18 Go to previous messageGo to next message
Eclipse UserFriend
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 12:05 Go to previous message
Eclipse UserFriend
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 May 13 13:56:57 EDT 2025

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

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

Back to the top