formatting - indentation following newline [message #1771825] |
Thu, 31 August 2017 02:30  |
Eclipse User |
|
|
|
Hi,
I have very trivial issue, but i'm running out of time to research it :)
I am writing a formatter - I need to newline and indent a tag, but I cannot get both commands to run in same action:
//this should newline and indent 5 spaces - but only NL happens:
[code]
visual.material.format.prepend[setNewLines(1, 1, 2); space = Strings.repeat(" ", 5)]
[code ]
if I split the commands up they both run fine - but it i split command up like below only first one i called?
How do I fix it?
//works - is newlined
visual.material.format.prepend[setNewLines(1, 1, 2)]
/works - is indented
visual.material.format.prepend[space = Strings.repeat(" ", 5)]
|
|
|
|
|
|
Re: formatting - indentation following newline [message #1771868 is a reply to message #1771860] |
Thu, 31 August 2017 09:59  |
Eclipse User |
|
|
|
(the following works for me)
fix the grammar
( 'Material' material+=Material)*
class MyDslFormatter extends AbstractFormatter2 {
@Inject extension MyDslGrammarAccess
def dispatch void format(Visual visual, extension IFormattableDocument document) {
// TODO: format HiddenRegions around keywords, attributes, cross references, etc.
visual.getGeometry.format;
visual.getMaterial.forEach[format];
for (r : visual.allRegionsFor.keywords(visualAccess.materialKeyword_5_0)) {
r.prepend[newLine]
}
}
def dispatch void format(Texture m, extension IFormattableDocument document) {
m.prepend[newLine].append[newLine].surround[indent]
m.regionFor.keyword(textureAccess.pathToFileKeyword_2).prepend[newLine]
}
// TODO: implement for
}
|
|
|
Powered by
FUDForum. Page generated in 0.05520 seconds