PsiFile (@NotNull String name, @NotNull FileType fileType, Language language, @NotNull Language targetLanguage, @NotNull CharSequence text, long modificationStamp, boolean physical, boolean markAsCopy) { LightVirtualFile lightVirtualFile = new LightVirtualFile(name, fileType, text, modificationStamp); ParserDefinition parserDefinition = LanguageParserDefinitions.INSTANCE.forLanguage(language); FileViewProviderFactory factory = LanguageFileViewProviders.INSTANCE.forLanguage(language); FileViewProvider viewProvider = factory != null ? factory.createFileViewProvider(lightVirtualFile, language, myManager, physical) : null; if (viewProvider == null) viewProvider = new SingleRootFileViewProvider(myManager, lightVirtualFile, physical); if (parserDefinition != null){ PsiFile psiFile = viewProvider.getPsi(targetLanguage); if (psiFile != null) { if(markAsCopy) { markGenerated(psiFile); } return psiFile; } } SingleRootFileViewProvider singleRootFileViewProvider = new SingleRootFileViewProvider(myManager, lightVirtualFile, physical); PsiPlainTextFileImpl plainTextFile = new PsiPlainTextFileImpl(singleRootFileViewProvider); if(markAsCopy) CodeEditUtil.setNodeGenerated(plainTextFile.getNode(), true); return plainTextFile; }