Formatter - indent after enter

Hallo,
I have a problem with the indent of the cursor after pressing enter in my custom language. It works as long as the FormattingModelBuilder is not included:

DEFINITION {
     A_REFERENCE
     |(cursor is here)
}


However, when I include my FormattingModelBuilder, the following:

DEFINITION {
     A_REFERENCE
|(cursor is here)
}

After formatting A_REFERENCE is indented correctly. No other elements are allowed in the braces. Is the FormattingModel and the blocks responsible for indenting the cursor or do I have to additionally implement an EnterHandler?

Thanks for any help,
Sebastian

0
3 comments

Hi Sebastian,

You need to implement getChildAttributes() in your implementation of Block.

Cheers,
Colin

1
Avatar
Sebastian Sprenger

Hallo Colin,
thank you. it does exactly what I wanted.
Cheers,
Sebastian

0

Hi,

I am facing the kind of same problem. I have used SpacingBuilder for created spacing between or line breaks between two tokens. I am able to provide line breaks between two tokens but after line break the next token should take some space.
I have provided Alignment.createAlignment() but it is aligning next token in the same line.

Can you help me to solve this issue.

0

Please sign in to leave a comment.