PsiFile (@Nullable PsiElement element) { if (element == null) return null; final PsiFile containingFile = element.getContainingFile(); if (containingFile == null) return null; final FileViewProvider viewProvider = containingFile.getViewProvider(); return viewProvider.getPsi(viewProvider.getBaseLanguage()); }