PsiElementVisitor (@NotNull ProblemsHolder holder, boolean isOnTheFly, @NotNull LocalInspectionToolSession session) { if (myConfigurations.isEmpty()) return PsiElementVisitor.EMPTY_VISITOR; final PsiFile file = holder.getFile(); final FileType fileType = file.getFileType(); if (fileType instanceof PlainTextLikeFileType) return PsiElementVisitor.EMPTY_VISITOR; final Project project = holder.getProject(); final InspectionProfileImpl profile = (mySessionProfile != null && !isOnTheFly) ? mySessionProfile : InspectionProfileManager.getInstance(project).getCurrentProfile(); final List<Configuration> configurations = new SmartList<>(); for (Configuration configuration : myConfigurations) { if (configuration.getFileType() != fileType && !configuration.getMatchOptions().isSearchInjectedCode()) continue; final ToolsImpl tools = profile.getToolsOrNull(configuration.getUuid(), project); if (tools != null && tools.isEnabled(file)) { configurations.add(configuration); register(configuration); } } if (configurations.isEmpty()) return PsiElementVisitor.EMPTY_VISITOR; Set<SmartPsiElementPointer<?>> duplicates = ContainerUtil.newConcurrentSet(); final Map<Configuration, Matcher> compiledPatterns = checkOutCompiledPatterns(configurations, project, holder, duplicates); session.putUserData(COMPILED_PATTERNS, compiledPatterns); return new SSBasedVisitor(compiledPatterns, holder, duplicates); }