use of org.eclipse.xtext.formatting2.regionaccess.ISemanticRegionFinder in project xtext-xtend by eclipse.
the class XtendFormatter method _format.
protected void _format(final XtendFunction func, @Extension final IFormattableDocument format) {
this.formatAnnotations(func, format, XbaseFormatterPreferenceKeys.newLineAfterMethodAnnotations);
this.formatModifiers(func, format);
boolean _isEmpty = func.getTypeParameters().isEmpty();
boolean _not = (!_isEmpty);
if (_not) {
final Procedure1<IHiddenRegionFormatter> _function = (IHiddenRegionFormatter it) -> {
it.noSpace();
};
format.append(this.textRegionExtensions.regionFor(func).keyword("<"), _function);
EList<JvmTypeParameter> _typeParameters = func.getTypeParameters();
for (final JvmTypeParameter arg : _typeParameters) {
{
format.<JvmTypeParameter>format(arg);
final Procedure1<IHiddenRegionFormatter> _function_1 = (IHiddenRegionFormatter it) -> {
it.noSpace();
};
final Procedure1<IHiddenRegionFormatter> _function_2 = (IHiddenRegionFormatter it) -> {
it.oneSpace();
};
format.append(format.prepend(this.textRegionExtensions.immediatelyFollowing(arg).keyword(","), _function_1), _function_2);
}
}
final Procedure1<IHiddenRegionFormatter> _function_1 = (IHiddenRegionFormatter it) -> {
it.noSpace();
};
final Procedure1<IHiddenRegionFormatter> _function_2 = (IHiddenRegionFormatter it) -> {
it.oneSpace();
};
format.append(format.prepend(this.textRegionExtensions.regionFor(func).keyword(">"), _function_1), _function_2);
}
final ISemanticRegion nameNode = this.textRegionExtensions.regionFor(func).feature(XtendPackage.Literals.XTEND_FUNCTION__NAME);
ISemanticRegionFinder _immediatelyFollowing = null;
if (nameNode != null) {
_immediatelyFollowing = nameNode.immediatelyFollowing();
}
ISemanticRegion _keyword = null;
if (_immediatelyFollowing != null) {
_keyword = _immediatelyFollowing.keyword("(");
}
final ISemanticRegion open = _keyword;
final ISemanticRegion close = this.textRegionExtensions.regionFor(func).keyword(")");
final Procedure1<IHiddenRegionFormatter> _function_3 = (IHiddenRegionFormatter it) -> {
it.oneSpace();
};
format.<JvmTypeReference>append(func.getReturnType(), _function_3);
final Procedure1<IHiddenRegionFormatter> _function_4 = (IHiddenRegionFormatter it) -> {
it.noSpace();
};
format.prepend(open, _function_4);
XExpression _expression = func.getExpression();
boolean _tripleNotEquals = (_expression != null);
if (_tripleNotEquals) {
format.append(close, XbaseFormatterPreferenceKeys.bracesInNewLine);
}
this.formatCommaSeparatedList(func.getParameters(), open, close, format);
format.<JvmTypeReference>format(func.getReturnType());
format.<XExpression>format(func.getExpression());
}
Aggregations