Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Formatting configuration
Formatting configuration [message #1140199] Wed, 16 October 2013 07:36
Yoav Amit is currently offline Yoav AmitFriend
Messages: 3
Registered: October 2013
Junior Member

I'm having some problems when trying to apply specific formatting rules to my DSL.
I've implemented a class IndentFormatter which extends AbstractDeclarativeFormatter and has the following code in the configureFormatting() method:
	protected void configureFormatting(FormattingConfig c) {
		grammarAccess = (IndentGrammarAccess) getGrammarAccess();

In order to do so I've modified my DSL's MWE2 workflow file, specifically I changed the following line:
fragment = formatting.FormatterFragment auto-inject {}

to this:
fragment = formatting.FormatterFragment {} // using the old java based formatter

My DSL .xtext file looks like this:

Group: ID '{' '\n'+ greetings+=Greeting '}' '\n'+;
	'Hello' name=Title '.' lastName=ID '!' '\n';

Title: 'Mr' | 'Ms' | 'Mrs';

I run the plugin and wrote the following file:
Itemis {
Hello Mr. Dietrich!
Hello Mr. Stoll!

And after trying to format the code (by pressing Ctrl+Shift+F), this is the result I got:
Itemis { Hello Mr . Dietrich ! Hello Mr . Stoll ! }

Is there anything I forgot to do in order for the formatter rules to take affect? Currently it looks like nothing I wrote was ever applied...

Please note that the newline characters are actually a part of the language, and I think that's what causing the problem.
I even tired replacing the formatter configuration to this:

And still, I got the same behavior.

I'd appreciate your help!

[Updated on: Wed, 16 October 2013 16:33]

Report message to a moderator

Previous Topic:Terminal
Next Topic:using UUIDs in FragmentProvider
Goto Forum:

Current Time: Fri Dec 04 08:57:12 GMT 2020

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

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

Back to the top