use of org.eclipse.xtext.formatting2.regionaccess.internal.TextSegment in project xtext-xtend by eclipse.
the class RichStringFormatter method setNewLines.
protected void setNewLines(final IFormattableDocument doc, final int offset, final int length, final int indentationIncrease, final int indentationDecrease, final int newLines) {
IHiddenRegionFormatting _createHiddenRegionFormatting = doc.getFormatter().createHiddenRegionFormatting();
final Procedure1<IHiddenRegionFormatting> _function = (IHiddenRegionFormatting it) -> {
it.setIndentationIncrease(Integer.valueOf(indentationIncrease));
it.setIndentationDecrease(Integer.valueOf(indentationDecrease));
it.setNewLinesMin(Integer.valueOf(newLines));
it.setNewLinesDefault(Integer.valueOf(newLines));
it.setNewLinesMax(Integer.valueOf(newLines));
};
final IHiddenRegionFormatting fmt = ObjectExtensions.<IHiddenRegionFormatting>operator_doubleArrow(_createHiddenRegionFormatting, _function);
AbstractFormatter2 _formatter = doc.getFormatter();
ITextRegionAccess _textRegionAccess = this._iTextRegionExtensions.getTextRegionAccess();
TextSegment _textSegment = new TextSegment(_textRegionAccess, offset, length);
final ITextReplacer replacer = _formatter.createWhitespaceReplacer(_textSegment, fmt);
doc.addReplacer(replacer);
}
use of org.eclipse.xtext.formatting2.regionaccess.internal.TextSegment in project xtext-core by eclipse.
the class SubDocument method requireFitsInLine.
@Override
public IFormattableSubDocument requireFitsInLine(int offset, int length, int maxLineWidth) {
TextSegment segment = new TextSegment(getTextRegionAccess(), offset, length);
MaxLineWidthDocument document = new MaxLineWidthDocument(segment, this, maxLineWidth);
addReplacer(document);
return document;
}
use of org.eclipse.xtext.formatting2.regionaccess.internal.TextSegment in project xtext-core by eclipse.
the class RegionSetTest method testNoMergeConflic1.
@Test
public void testNoMergeConflic1() {
String expectation = "issues=\n" + "set=[[20,0], [20,1]]\n";
test(expectation, (TestableTextSegmentSet it) -> {
it.add(new TextSegment(null, 20, 0));
it.add(new TextSegment(null, 20, 1));
});
}
use of org.eclipse.xtext.formatting2.regionaccess.internal.TextSegment in project xtext-core by eclipse.
the class RegionSetTest method testNoMergeConflic2.
@Test
public void testNoMergeConflic2() {
String expectation = "issues=\n" + "set=[[20,0], [20,1]]\n";
test(expectation, (TestableTextSegmentSet it) -> {
it.add(new TextSegment(null, 20, 1));
it.add(new TextSegment(null, 20, 0));
});
}
use of org.eclipse.xtext.formatting2.regionaccess.internal.TextSegment in project xtext-core by eclipse.
the class RegionSetTest method testMergeConflic4.
@Test
public void testMergeConflic4() {
String expectation = "issues=mergeConflict:[20,2]<>[21,5]\n" + "set=[[21,5]]\n";
test(expectation, (TestableTextSegmentSet it) -> {
it.add(new TextSegment(null, 21, 5));
it.add(new TextSegment(null, 20, 2));
});
}
Aggregations