PsiFile (@NotNull PsiElement element, @NotNull Project project) { PsiFile file = InjectedLanguageManager.getInstance(project).getTopLevelFile(element); FileViewProvider viewProvider = file.getViewProvider(); return viewProvider.getPsi(viewProvider.getBaseLanguage()); }