FormattingModel (PsiFile file, CodeStyleSettings settings, XmlFormattingPolicy xmlFormattingPolicy, List<? extends PsiElement> elements, Indent indent) { try { return createTemplateFormattingModelInternal(file, settings, xmlFormattingPolicy, elements, indent); } catch (FragmentedTemplateException fte) { assert elements.size() > 0; int start = Integer.MAX_VALUE; int end = -1; for (PsiElement element : elements) { TextRange range = element.getTextRange(); if (range.getStartOffset() < start) start = range.getStartOffset(); if (range.getEndOffset() > end) end = range.getEndOffset(); } return createDummyModel(new CompositeTemplateBlock(new TextRange(start, end)), settings, file); } }