Пример #1
0
        public static DocumentState Create(
            DocumentInfo info,
            ParseOptions options,
            HostLanguageServices language,
            SolutionServices services)
        {
            var textSource = info.TextLoader != null
                ? CreateRecoverableText(info.TextLoader, info.Id, services, reportInvalidDataException : true)
                : CreateStrongText(TextAndVersion.Create(SourceText.From(string.Empty, Encoding.UTF8), VersionStamp.Default, info.FilePath));

            var treeSource = CreateLazyFullyParsedTree(
                textSource,
                info.Id.ProjectId,
                GetSyntaxTreeFilePath(info),
                options,
                language,
                services);

            // ownership of TextLoader information has moved to document state. clear out textloader the info is
            // holding on. otherwise, these information will be held onto unnecesarily by documentInfo even after
            // the info has changed by DocumentState.
            // we hold onto the info so that we don't need to duplicate all information info already has in the state
            info = info.WithTextLoader(null);

            return(new DocumentState(
                       languageServices: language,
                       solutionServices: services,
                       info: info,
                       options: options,
                       sourceTextOpt: null,
                       textSource: textSource,
                       treeSource: treeSource,
                       lazyChecksums: null));
        }
Пример #2
0
        public static DocumentState Create(
            DocumentInfo info,
            ParseOptions options,
            HostLanguageServices language,
            SolutionServices services)
        {
            var textSource = info.TextLoader != null
                ? CreateRecoverableText(info.TextLoader, info.Id, services, reportInvalidDataException : true)
                : CreateStrongText(TextAndVersion.Create(SourceText.From(string.Empty, Encoding.UTF8), VersionStamp.Default, info.FilePath));

            var treeSource = CreateLazyFullyParsedTree(
                textSource,
                info.Id.ProjectId,
                GetSyntaxTreeFilePath(info),
                options,
                language,
                services);

            // remove any initial loader so we don't keep source alive
            info = info.WithTextLoader(null);

            return(new DocumentState(
                       languageServices: language,
                       solutionServices: services,
                       info: info,
                       options: options,
                       sourceTextOpt: null,
                       textSource: textSource,
                       treeSource: treeSource,
                       lazyChecksums: null));
        }
Пример #3
0
        public static DocumentState Create(
            DocumentInfo info,
            ParseOptions options,
            HostLanguageServices language,
            SolutionServices services)
        {
            var textSource = info.TextLoader != null
                ? CreateRecoverableText(info.TextLoader, info.Id, services)
                : CreateStrongText(TextAndVersion.Create(SourceText.From(string.Empty, Encoding.UTF8), VersionStamp.Default, info.FilePath));

            var treeSource = CreateLazyFullyParsedTree(
                textSource,
                GetSyntaxTreeFilePath(info),
                options,
                languageServices: language);

            // remove any initial loader so we don't keep source alive
            info = info.WithTextLoader(null);

            return new DocumentState(
                languageServices: language,
                solutionServices: services,
                info: info,
                options: options,
                textSource: textSource,
                treeSource: treeSource);
        }
Пример #4
0
        public static DocumentState Create(
            DocumentInfo info,
            ParseOptions options,
            ILanguageServiceProvider language,
            SolutionServices services)
        {
            var textSource = info.TextLoader != null
                ? CreateRecoverableText(info.TextLoader, info.Id, services)
                : CreateStrongText(TextAndVersion.Create(SourceText.From(string.Empty), VersionStamp.Default, info.FilePath));

            var treeSource = CreateLazyFullyParsedTree(
                textSource,
                GetSyntaxTreeFilePath(info),
                options,
                workspaceServices: services.WorkspaceServices,
                languageServices: language);

            // remove any initial loader so we don't keep source alive
            info = info.WithTextLoader(null);

            return(new DocumentState(
                       languageServices: language,
                       solutionServices: services,
                       info: info,
                       options: options,
                       textSource: textSource,
                       treeSource: treeSource));
        }
Пример #5
0
        public static TextDocumentState Create(DocumentInfo info, SolutionServices services)
        {
            var textSource = info.TextLoader != null
                ? CreateRecoverableText(info.TextLoader, info.Id, services, reportInvalidDataException: false)
                : CreateStrongText(TextAndVersion.Create(SourceText.From(string.Empty, Encoding.UTF8), VersionStamp.Default, info.FilePath));

            // remove any initial loader so we don't keep source alive
            info = info.WithTextLoader(null);

            return new TextDocumentState(
                solutionServices: services,
                info: info,
                textSource: textSource);
        }
Пример #6
0
        public static TextDocumentState Create(DocumentInfo info, SolutionServices services)
        {
            var textSource = info.TextLoader != null
                ? CreateRecoverableText(info.TextLoader, info.Id, services, reportInvalidDataException : false)
                : CreateStrongText(TextAndVersion.Create(SourceText.From(string.Empty, Encoding.UTF8), VersionStamp.Default, info.FilePath));

            // remove any initial loader so we don't keep source alive
            info = info.WithTextLoader(null);

            return(new TextDocumentState(
                       solutionServices: services,
                       info: info,
                       textSource: textSource));
        }
Пример #7
0
        public static TextDocumentState Create(DocumentInfo info, SolutionServices services)
        {
            var textSource = info.TextLoader != null
                ? CreateRecoverableText(info.TextLoader, info.Id, services, reportInvalidDataException : false)
                : CreateStrongText(TextAndVersion.Create(SourceText.From(string.Empty, Encoding.UTF8), VersionStamp.Default, info.FilePath));

            // ownership of TextLoader information has moved to document state. clear out textloader the info is
            // holding on. otherwise, these information will be held onto unnecesarily by documentInfo even after
            // the info has changed by DocumentState.
            // we hold onto the info so that we don't need to duplicate all information info already has in the state
            info = info.WithTextLoader(null);

            return(new TextDocumentState(
                       solutionServices: services,
                       info: info,
                       sourceTextOpt: null,
                       textAndVersionSource: textSource,
                       lazyChecksums: null));
        }