Search in sources :

Example 1 with RegionTraceMissingException

use of org.eclipse.xtext.formatting2.internal.RegionTraceMissingException in project xtext-core by eclipse.

the class AbstractFormatter2 method format.

@Override
public final List<ITextReplacement> format(FormatterRequest request) {
    try {
        initialize(request);
        XtextResource xtextResource = request.getTextRegionAccess().getResource();
        IFormattableDocument document = createFormattableRootDocument();
        try {
            format(xtextResource, document);
        } catch (RegionTraceMissingException e) {
            document = handleTraceMissing(document, e);
        }
        List<ITextReplacement> rendered = document.renderToTextReplacements();
        List<ITextReplacement> postprocessed = postProcess(document, rendered);
        return postprocessed;
    } finally {
        reset();
    }
}
Also used : RegionTraceMissingException(org.eclipse.xtext.formatting2.internal.RegionTraceMissingException) ITextReplacement(org.eclipse.xtext.formatting2.regionaccess.ITextReplacement) XtextResource(org.eclipse.xtext.resource.XtextResource)

Aggregations

RegionTraceMissingException (org.eclipse.xtext.formatting2.internal.RegionTraceMissingException)1 ITextReplacement (org.eclipse.xtext.formatting2.regionaccess.ITextReplacement)1 XtextResource (org.eclipse.xtext.resource.XtextResource)1