PsiElementVisitor (@NotNull ProblemsHolder holder, boolean isOnTheFly) { if (!HighlightingFeature.TEXT_BLOCKS.isAvailable(holder.getFile())) return PsiElementVisitor.EMPTY_VISITOR; return new JavaElementVisitor() { @Override public void visitLiteralExpression(@NotNull PsiLiteralExpression expression) { String[] lines = PsiLiteralUtil.getTextBlockLines(expression); if (lines == null) return; int tabSize = CodeStyle.getSettings(expression.getProject()).getTabSize(JavaFileType.INSTANCE); if (tabSize == 1) return; int start = expression.getText().indexOf('\n'); if (start == -1) return; start++; MixedIndentModel indentModel = MixedIndentModel.create(lines); if (indentModel == null) return; int indexToReport = indentModel.myInconsistencyIdx; List<LocalQuickFix> fixes = new SmartList<>(new MakeIndentConsistentFix(IndentType.SPACES), new MakeIndentConsistentFix(IndentType.TABS), new MakeIndentConsistentFix(tabSize, IndentType.SPACES)); if (indentModel.canReplaceWithTabs(tabSize)) { fixes.add(new MakeIndentConsistentFix(tabSize, IndentType.TABS)); } holder.registerProblem(expression, new TextRange(start + indexToReport, start + indexToReport + 1), JavaBundle.message("inspection.inconsistent.text.block.indent.message"), fixes.toArray(LocalQuickFix.EMPTY_ARRAY)); } }; }