boolean (@NotNull final PsiFile file, final int offset) { if (PsiUtilCore.getLanguageAtOffset(file, offset).isKindOf(JavaLanguage.INSTANCE)) { PsiElement element = file.findElementAt(offset); if (element instanceof PsiWhiteSpace && offset > 0) { element = file.findElementAt(offset-1); } return PsiTreeUtil.getParentOfType(element, PsiComment.class, false) != null; } return false; }