XExpression (@NotNull Project project, @NotNull Document document, @Nullable Language language, @NotNull EvaluationMode mode) { PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(document); if (psiFile instanceof JavaCodeFragment) { return new XExpressionImpl(document.getText(), language, StringUtil.nullize(((JavaCodeFragment)psiFile).importsToString()), mode); } return super.createExpression(project, document, language, mode); }