PsiClass (PsiElement element) { final PsiSnippetDocTag snippet = PsiTreeUtil.getParentOfType(element, PsiSnippetDocTag.class); final AtomicReference<PsiElement> injected = new AtomicReference<>(); final InjectedLanguageManager injectionManager = InjectedLanguageManager.getInstance(getProject()); injectionManager.enumerate(snippet, (injectedPsi, places) -> { injected.set(injectedPsi); }); return PsiTreeUtil.findChildOfType(injected.get(), PsiClass.class); }