FormattingService (@NotNull PsiFile file, boolean isExplicit, boolean isCompleteFile) { FormattingService formattingService = ContainerUtil.find( FormattingService.EP_NAME.getExtensionList(), s -> (isExplicit || s.getFeatures().contains(FormattingService.Feature.AD_HOC_FORMATTING)) && (isCompleteFile || s.getFeatures().contains(FormattingService.Feature.FORMAT_FRAGMENTS)) && s.canFormat(file) ); LOG.assertTrue(formattingService != null, "At least 1 formatting service which can handle PsiFile " + file.getName() + " should be registered."); return formattingService; }