Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtext - Formatting - SetIndentation(How to use SetIndentationIncrement and SetIndentation)
Xtext - Formatting - SetIndentation [message #644246] Fri, 10 December 2010 08:40 Go to next message
Philipp Missing name is currently offline Philipp Missing nameFriend
Messages: 7
Registered: November 2010
Junior Member
I'm implementing a formatting configuration for my DSL and faced some problems with the indentation.

I have simply implemented:

c.setIndentationIncrement().before(f.getStatementRule());
c.setIndentationDecrement().after(f.getStatementRule());

Until only StatementRules are processed everything works well, but if once a other rule applies the indentation is damaged. It seems that the indentation tends to be negative.


In the following example the keyword PROCEDURE stays for the other rule, as mentioned above.

macro test2

   VAR a := 0

   IF a THEN
      a := a
   ENDIF

   VAR b := 0

PROCEDURE proc
   a := a
ENDPROCEDURE

PROCEDURE proc2
   a := a
ENDPROCEDURE

IF a THEN
   a := a
ENDIF

VAR c := 0

PROCEDURE proc3
a := a
ENDPROCEDURE

IF a THEN
a := a
ENDIF

PROCEDURE proc4
a := a
ENDPROCEDURE


I have found a methode SetIndentation that isn't descripted in the help.

Does each rule has to be marked with SetIndentation to the current indentation?
Re: Xtext - Formatting - SetIndentation [message #644776 is a reply to message #644246] Tue, 14 December 2010 08:35 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Philipp,

please file a bug and attach a reproducable example. Thanks in advance.
Meanwhile you could try to use setIndentation().between(..) in
conjunction with findKeywordPairs(..).

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 10.12.10 09:40, schrieb Philipp:
> I'm implementing a formatting configuration for my DSL and faced some
> problems with the indentation.
>
> I have simply implemented:
>
> c.setIndentationIncrement().before(f.getStatementRule());
> c.setIndentationDecrement().after(f.getStatementRule());
> Until only StatementRules are processed everything works well, but if
> once a other rule applies the indentation is damaged. It seems that the
> indentation tends to be negative.
>
>
> In the following example the keyword PROCEDURE stays for the other rule,
> as mentioned above.
>
> macro test2
>
> VAR a := 0
>
> IF a THEN
> a := a
> ENDIF
>
> VAR b := 0
>
> PROCEDURE proc
> a := a
> ENDPROCEDURE
>
> PROCEDURE proc2
> a := a
> ENDPROCEDURE
>
> IF a THEN
> a := a
> ENDIF
>
> VAR c := 0
>
> PROCEDURE proc3
> a := a
> ENDPROCEDURE
>
> IF a THEN
> a := a
> ENDIF
>
> PROCEDURE proc4
> a := a
> ENDPROCEDURE
>
> I have found a methode SetIndentation that isn't descripted in the help.
> Does each rule has to be marked with SetIndentation to the current
> indentation?
>
Re: Xtext - Formatting - SetIndentation [message #645139 is a reply to message #644246] Wed, 15 December 2010 16:39 Go to previous message
Henrik Lindberg is currently offline Henrik LindbergFriend
Messages: 2509
Registered: July 2009
Senior Member
I struggled with the same problem. I am not 100 sure but I think the
decrement may work, but not the increment - that is why you get to see
negative increments.

In my case, I did not find a workaround, as there is no distinct end token.

Please let me know if you are logging an issue for this.
- henrik

On 12/10/10 9:40 AM, Philipp wrote:
> I'm implementing a formatting configuration for my DSL and faced some
> problems with the indentation.
>
> I have simply implemented:
>
> c.setIndentationIncrement().before(f.getStatementRule());
> c.setIndentationDecrement().after(f.getStatementRule());
> Until only StatementRules are processed everything works well, but if
> once a other rule applies the indentation is damaged. It seems that the
> indentation tends to be negative.
Previous Topic:model to text and comments
Next Topic:Cross-Reference to other files in project
Goto Forum:
  


Current Time: Fri Apr 19 07:26:14 GMT 2024

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

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

Back to the top