FormattingModelBuilder (@NotNull Language language, @NotNull PsiElement context) { for (LanguageFormattingRestriction each : LanguageFormattingRestriction.EP_NAME.getExtensionList()) { if (!each.isFormatterAllowed(context)) return null; } FormattingModelBuilder builder = findCustomFormattingModelBuilder(language, context); if (builder == null) { builder = forLanguage(language); } Formatter formatter = Formatter.getInstance(); PsiFile file = context.getContainingFile(); builder = ExternalFormatProcessor.useExternalFormatter(file) ? formatter.createExternalFormattingModelBuilder(file, builder) : builder; builder = formatter.isEligibleForVirtualFormatting(context) ? formatter.wrapForVirtualFormatting(context, builder) : builder; return builder; }