PsiElementVisitor (final @NotNull ProblemsHolder holder, boolean isOnTheFly) { return new PsiElementVisitor() { @Override public void visitFile(@NotNull PsiFile file) { if (!file.getLanguage().equals(file.getViewProvider().getBaseLanguage())) { // There is a possible case that more than a single virtual file/editor contains more than one language (e.g. php and html). // We want to process a virtual file once than, hence, ignore all non-base psi files. return; } VirtualFile virtualFile = file.getVirtualFile(); if (virtualFile == null || !AbstractConvertLineSeparatorsAction.shouldProcess(virtualFile)) { return; } Project project = holder.getProject(); String projectLineSeparator = FileDocumentManager.getInstance().getLineSeparator(null, project); Set<String> allLineSeparators = LoadTextUtil.detectAllLineSeparators(virtualFile); if (allLineSeparators.size() > 1 || !allLineSeparators.isEmpty() && !allLineSeparators.contains(projectLineSeparator)) { List<String> allSorted = ContainerUtil.sorted(allLineSeparators); String presentableSeparators = StringUtil.join(allSorted, sep->StringUtil.escapeStringCharacters(sep), ", "); holder.registerProblem( file, AnalysisBundle.message("inspection.message.line.separators.in.current.file.differ.from.project.defaults", presentableSeparators, StringUtil.escapeStringCharacters(projectLineSeparator)), new ChangeLineSeparatorFix()); } } }; }