PsiElement (@Nullable PsiElement element, int minOffset) { if (element == null) { return null; } for (PsiElement e = element; e != null && e.getTextRange().getStartOffset() >= minOffset; e = e.getPrevSibling()) { if (e instanceof PsiWhiteSpace || e instanceof PsiComment) { continue; } return e; } return null; }