CodeFragmentFactory (final TextWithImports text, final PsiElement context) { CodeFragmentFactory factory = ReadAction.compute(() -> getCodeFragmentFactory(context, text.getFileType())); return new CodeFragmentFactoryContextWrapper(factory); }