Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Line breaks in the Formatter
Line breaks in the Formatter [message #1108357] Fri, 13 September 2013 18:47 Go to next message
Erick Fonseca is currently offline Erick FonsecaFriend
Messages: 68
Registered: December 2011
Member
I wrote a custom AbstractDeclarativeFormatter with appropriate line breaks and indentation for my DSL. For example, I configured the formatter to insert a line break after semicolons with

    DSLGrammarAccess ga = (DSLGrammarAccess) getGrammarAccess();

    for (Keyword semicolon : ga.findKeywords(";"))
        config.setLinewrap().after(semicolon);


Now, the problem is that when I select some text and auto-format it (with CTRL + SHIFT + F), it will add a new line break where there is already one, instead of just leaving it. So, if my code is like this:

some_function();
another_function();


auto-formatting will leave it as

some_function();

another_function();



when the original was already correct.

Is there a way to avoid this behavior?
Re: Line breaks in the Formatter [message #1228132 is a reply to message #1108357] Mon, 06 January 2014 13:39 Go to previous messageGo to next message
Marc Herrmann is currently offline Marc HerrmannFriend
Messages: 19
Registered: November 2013
Junior Member
I have the same problem Sad can someone help pls?
Re: Line breaks in the Formatter [message #1230253 is a reply to message #1228132] Sat, 11 January 2014 12:56 Go to previous messageGo to next message
Marc Herrmann is currently offline Marc HerrmannFriend
Messages: 19
Registered: November 2013
Junior Member
Does nobody has this problem? Sad
Re: Line breaks in the Formatter [message #1230262 is a reply to message #1230253] Sat, 11 January 2014 13:35 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13628
Registered: July 2009
Senior Member
In doubt file a bug with an example attached

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Line breaks in the Formatter [message #1233712 is a reply to message #1230262] Mon, 20 January 2014 10:17 Go to previous messageGo to next message
Marc Herrmann is currently offline Marc HerrmannFriend
Messages: 19
Registered: November 2013
Junior Member
How can I do that?
Re: Line breaks in the Formatter [message #1249674 is a reply to message #1233712] Tue, 18 February 2014 14:00 Go to previous messageGo to next message
Marc Herrmann is currently offline Marc HerrmannFriend
Messages: 19
Registered: November 2013
Junior Member
Can noone help?
Re: Line breaks in the Formatter [message #1249695 is a reply to message #1249674] Tue, 18 February 2014 14:29 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13628
Registered: July 2009
Senior Member
In doubt file a bug please. The formatting api is "not nice" anyway

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic: Ant Script to Create Xtext Project as Plugin
Next Topic:XXJvmModelInferrer is not getting called
Goto Forum:
  


Current Time: Fri Oct 23 05:33:44 GMT 2020

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

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

Back to the top