public static SourceGeneratedDocumentState Create(
            SourceGeneratedDocumentIdentity documentIdentity,
            SourceText generatedSourceText,
            ParseOptions parseOptions,
            HostLanguageServices languageServices,
            SolutionServices solutionServices)
        {
            var textAndVersion = TextAndVersion.Create(generatedSourceText, VersionStamp.Create());
            var textSource     = new ConstantValueSource <TextAndVersion>(textAndVersion);
            var treeSource     = CreateLazyFullyParsedTree(
                textSource,
                documentIdentity.DocumentId.ProjectId,
                documentIdentity.FilePath,
                parseOptions,
                languageServices);

            return(new SourceGeneratedDocumentState(
                       documentIdentity,
                       languageServices,
                       solutionServices,
                       documentServiceProvider: null,
                       new DocumentInfo.DocumentAttributes(
                           documentIdentity.DocumentId,
                           name: documentIdentity.HintName,
                           folders: SpecializedCollections.EmptyReadOnlyList <string>(),
                           parseOptions.Kind,
                           filePath: documentIdentity.FilePath,
                           isGenerated: true,
                           designTimeOnly: false),
                       parseOptions,
                       textSource,
                       treeSource));
        }
 private SourceGeneratedDocumentState(
     SourceGeneratedDocumentIdentity documentIdentity,
     HostLanguageServices languageServices,
     SolutionServices solutionServices,
     IDocumentServiceProvider?documentServiceProvider,
     DocumentInfo.DocumentAttributes attributes,
     ParseOptions options,
     ValueSource <TextAndVersion> textSource,
     ValueSource <TreeAndVersion> treeSource)
     : base(languageServices, solutionServices, documentServiceProvider, attributes, options, sourceText: null, textSource, treeSource)
 {
     Identity = documentIdentity;
 }