boolean (Object what, PsiElement context) { if (!(what instanceof PsiElement p)) return false; if (p instanceof PsiComment) return false; // just in case int point = p.getTextOffset(); PsiDocumentManager docMgr = PsiDocumentManager.getInstance(p.getProject()); final PsiFile file = p.getContainingFile().getOriginalFile(); Document doc = docMgr.getDocument(file); String indentCharacters = file.getViewProvider() instanceof FreeThreadedFileViewProvider ? " \t>" : " \t"; if (doc != null) { CharSequence chs = doc.getCharsSequence(); char c; do { // scan to the left for a EOL point -= 1; if (point < 0) return true; // we're at BOF c = chs.charAt(point); if (c == '\n') return true; } while (indentCharacters.indexOf(c) >= 0); } return false; }