How to define different indentation levels in the same document with Xtext formatter -


is possible format document follows, using xtext formatting? can see, test children indented 4 spaces while external children indented 2 spaces only. using xtext 2.12.0.

test my_prog {     device = "my_device";     param = 0; }  external {   path = "my_path";   file = "my_file"; } 

you try work custom replacers, dont know if work nested block though

def dispatch void format(external model, extension iformattabledocument document) {     model.regionfor.keyword("}").prepend[newline]     (l : model.ids) {         val region = l.regionfor.feature(mydslpackage.literals.idx__name)         region.prepend[newline]         val r = new abstracttextreplacer(document, region) {             override createreplacements(itextreplacercontext it) {                 val offset = region.offset                 it.addreplacement(region.textregionaccess.rewriter.createreplacement(offset, 0, "  "))                             }         }         addreplacer(r)     } } 

Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -