boolean (Object element, @Nullable PsiElement context) { if (!(element instanceof PsiElement p)) return false; PsiFile file = p.getContainingFile().getOriginalFile(); char[] chars = file.textToCharArray(); for (int offset = p.getTextOffset() - 1; offset >= 0; offset--) { char c = chars[offset]; if (c == '\n') return true; if (!StringUtil.isWhiteSpace(c)) return false; } return true; }