SmartPointerElementInfo (@NotNull PsiFile containingFile, @NotNull ProperTextRange range, boolean forInjected) { Project project = containingFile.getProject(); if (containingFile.getViewProvider() instanceof FreeThreadedFileViewProvider) { PsiLanguageInjectionHost host = InjectedLanguageManager.getInstance(project).getInjectionHost(containingFile); if (host != null) { SmartPsiElementPointer<PsiLanguageInjectionHost> hostPointer = SmartPointerManager.getInstance(project).createSmartPsiElementPointer(host); return new InjectedSelfElementInfo(project, containingFile, range, containingFile, hostPointer); } } if (!forInjected && range.equals(containingFile.getTextRange())) return new FileElementInfo(containingFile); return new SelfElementInfo(range, Identikit.fromTypes(PsiElement.class, null, Language.ANY), containingFile, forInjected); }