FormattingModel (@NotNull FormattingContext formattingContext) { final PsiFile psiFile = formattingContext.getContainingFile(); CodeStyleSettings settings = formattingContext.getCodeStyleSettings(); PsiElement element = formattingContext.getPsiElement(); if (psiFile.getViewProvider() instanceof TemplateLanguageFileViewProvider viewProvider) { if (isTemplateFile(psiFile)) { Language templateDataLanguage = viewProvider.getTemplateDataLanguage(); if (templateDataLanguage != psiFile.getLanguage()) { return createDataLanguageFormattingModel( viewProvider.getPsi(templateDataLanguage), templateDataLanguage, settings, psiFile, Indent.getNoneIndent()); } } else if (element instanceof OuterLanguageElement && isOuterLanguageElement(element)) { try { FormattingModel model = createTemplateFormattingModel(psiFile, viewProvider, (OuterLanguageElement)element, settings, Indent.getNoneIndent()); if (model != null) return model; } catch (FragmentedTemplateException ie) { return createDummyModel(new ReadOnlyBlock(element.getNode()), settings, psiFile); } } } return super.createModel(formattingContext); }