Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Formatter adds line breaks
Formatter adds line breaks [message #1116523] Wed, 25 September 2013 15:01 Go to next message
Michael Speen is currently offline Michael SpeenFriend
Messages: 2
Registered: September 2013
Junior Member
Hi,
I have problem with formatter. It places line breaks where it should not be. I haven't defined any new lines in my xtext definition file or in my formatter class.

my unformated code is:
    set instance servicename
    public total=count this uses-redundant Service OTHER
    public up=count this uses-redundant Service OTHER with OTHER.working


and after I auto-format it, it adds line break like this:
    set instance servicename
    public total = count this uses-redundant Service OTHER
    public up = count this uses-redundant Service OTHER with
  OTHER . working


I've tried to add something like c.setNoLinewrap().after("with");
And the result is:
    set instance servicename
    public total = count this uses-redundant Service OTHER
    public up = count this uses-redundant Service OTHER with OTHER 
 . working

Linewrap is defined to 500.

Any suggestion will help.
Re: Formatter adds line breaks [message #1117286 is a reply to message #1116523] Thu, 26 September 2013 09:23 Go to previous messageGo to next message
Moritz Eysholdt is currently offline Moritz EysholdtFriend
Messages: 161
Registered: July 2009
Location: Kiel, Germany
Senior Member
it looks like org.eclipse.xtext.formatting.impl.FormattingConfig.setAutoLinewrap(int) has somehow been set to a lower value than 500. Your observation that suppressing the line wrap at one location postpones it to after the token indicates it's an autolinewrap.
Re: Formatter adds line breaks [message #1117555 is a reply to message #1117286] Thu, 26 September 2013 15:07 Go to previous message
Michael Speen is currently offline Michael SpeenFriend
Messages: 2
Registered: September 2013
Junior Member
Thanks for replying. Im sure that I have autolinewrap setted for 500, because i have several longer lines than this one.

Same probbem occured in another part of my code where I have two same functions (attribute definitions). First is ok without any line breaks but the second one is inside of IF statement with added line break..

I have no idea why is there a line break at line 3/4. As i said abowe - I have no libebreak defined in my *.xtext or formatter class.
Code before autoformatting:
public var="global" with looping
IF true THAN
public var="global" with looping
END

Code afterautoformatting:
public var = "global" with looping
IF true THEN
   public var = 
     "global" with looping
END
Previous Topic:Old vs new serializer
Next Topic:Xtext in RCP Application
Goto Forum:
  


Current Time: Wed Apr 24 23:52:17 GMT 2024

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

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

Back to the top