Language () { final int offset = getEditor().getCaretModel().getPrimaryCaret().getOffset(); final PsiElement element = PsiUtilCore.getElementAtOffset(getFile(), offset); 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 injected.get().getLanguage(); }