PsiElement (@NotNull PsiFile hostFile, int offset) { if (hostFile instanceof PsiCompiledElement) return null; Project project = hostFile.getProject(); if (InjectedLanguageManager.getInstance(project).isInjectedFragment(hostFile)) return null; PsiDocumentManager documentManager = PsiDocumentManager.getInstance(project); Trinity<PsiElement, PsiElement, Language> result = tryOffset(hostFile, offset, documentManager); return result.first; }