当前位置: 首页>>代码示例>>C#>>正文


C# CodeAnalysis.DocumentState类代码示例

本文整理汇总了C#中Microsoft.CodeAnalysis.DocumentState的典型用法代码示例。如果您正苦于以下问题:C# DocumentState类的具体用法?C# DocumentState怎么用?C# DocumentState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DocumentState类属于Microsoft.CodeAnalysis命名空间,在下文中一共展示了DocumentState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Document

        internal Document(Project project, DocumentState state)
        {
            Contract.ThrowIfNull(project);
            Contract.ThrowIfNull(state);

            this.Project = project;
            _state = state;
        }
开发者ID:vslsnap,项目名称:roslyn,代码行数:8,代码来源:Document.cs

示例2: TouchDocument

 public static CompilationTranslationAction TouchDocument(DocumentState oldState, DocumentState newState)
 {
     return new TouchDocumentAction(oldState, newState);
 }
开发者ID:RoryVL,项目名称:roslyn,代码行数:4,代码来源:Solution.CompilationTranslationAction.cs

示例3: RemoveDocument

 public static CompilationTranslationAction RemoveDocument(DocumentState state)
 {
     return new RemoveDocumentAction(state);
 }
开发者ID:RoryVL,项目名称:roslyn,代码行数:4,代码来源:Solution.CompilationTranslationAction.cs

示例4: GetLatestDependentVersions

        private void GetLatestDependentVersions(
            ImmutableDictionary<DocumentId, DocumentState> newDocumentStates,
            DocumentState oldDocument, DocumentState newDocument,
            bool recalculateDependentVersions, bool textChanged,
            out AsyncLazy<VersionStamp> dependentDocumentVersion, out AsyncLazy<VersionStamp> dependentSemanticVersion)
        {
            var recalculateDocumentVersion = false;
            var recalculateSemanticVersion = false;

            if (recalculateDependentVersions)
            {
                VersionStamp oldVersion;
                if (oldDocument.TryGetTextVersion(out oldVersion))
                {
                    VersionStamp documentVersion;
                    if (!this.lazyLatestDocumentVersion.TryGetValue(out documentVersion) || documentVersion == oldVersion)
                    {
                        recalculateDocumentVersion = true;
                    }

                    VersionStamp semanticVersion;
                    if (!this.lazyLatestDocumentTopLevelChangeVersion.TryGetValue(out semanticVersion) || semanticVersion == oldVersion)
                    {
                        recalculateSemanticVersion = true;
                    }
                }
            }

            dependentDocumentVersion = recalculateDocumentVersion ?
                new AsyncLazy<VersionStamp>(this.ComputeLatestDocumentVersionAsync, cacheResult: true) :
                textChanged ?
                    new AsyncLazy<VersionStamp>(newDocument.GetTextVersionAsync, cacheResult: true) :
                    this.lazyLatestDocumentVersion;

            dependentSemanticVersion = recalculateSemanticVersion ?
                new AsyncLazy<VersionStamp>(c => ComputeLatestDocumentTopLevelChangeVersionAsync(newDocumentStates, c), cacheResult: true) :
                textChanged ?
                    CreateLazyLatestDocumentTopLevelChangeVersion(newDocument, newDocumentStates) :
                    this.lazyLatestDocumentTopLevelChangeVersion;
        }
开发者ID:riversky,项目名称:roslyn,代码行数:40,代码来源:ProjectState.cs

示例5: UpdateDocument

        public ProjectState UpdateDocument(DocumentState newDocument, bool textChanged, bool recalculateDependentVersions)
        {
            Contract.Requires(this.ContainsDocument(newDocument.Id));

            var oldDocument = this.GetDocumentState(newDocument.Id);
            if (oldDocument == newDocument)
            {
                return this;
            }

            var newDocumentStates = this.DocumentStates.SetItem(newDocument.Id, newDocument);

            AsyncLazy<VersionStamp> dependentDocumentVersion;
            AsyncLazy<VersionStamp> dependentSemanticVersion;
            GetLatestDependentVersions(
                newDocumentStates, oldDocument, newDocument, recalculateDependentVersions, textChanged,
                out dependentDocumentVersion, out dependentSemanticVersion);

            return this.With(
                documentStates: newDocumentStates,
                latestDocumentVersion: dependentDocumentVersion,
                latestDocumentTopLevelChangeVersion: dependentSemanticVersion);
        }
开发者ID:riversky,项目名称:roslyn,代码行数:23,代码来源:ProjectState.cs

示例6: AddDocument

        public ProjectState AddDocument(DocumentState document)
        {
            Contract.Requires(!this.DocumentStates.ContainsKey(document.Id));

            return this.With(
                projectInfo: this.ProjectInfo.WithVersion(this.Version.GetNewerVersion()),
                documentIds: this.DocumentIds.Add(document.Id),
                documentStates: this.DocumentStates.Add(document.Id, document));
        }
开发者ID:riversky,项目名称:roslyn,代码行数:9,代码来源:ProjectState.cs

示例7: ComputeTopLevelChangeTextVersionAsync

 private static async Task<VersionStamp> ComputeTopLevelChangeTextVersionAsync(VersionStamp oldVersion, DocumentState newDocument, CancellationToken cancellationToken)
 {
     var newVersion = await newDocument.GetTopLevelChangeTextVersionAsync(cancellationToken).ConfigureAwait(false);
     return newVersion.GetNewerVersion(oldVersion);
 }
开发者ID:riversky,项目名称:roslyn,代码行数:5,代码来源:ProjectState.cs

示例8: CreateLazyLatestDocumentTopLevelChangeVersion

 private AsyncLazy<VersionStamp> CreateLazyLatestDocumentTopLevelChangeVersion(DocumentState newDocument, ImmutableDictionary<DocumentId, DocumentState> newDocumentStates)
 {
     VersionStamp oldVersion;
     if (this.lazyLatestDocumentTopLevelChangeVersion.TryGetValue(out oldVersion))
     {
         return new AsyncLazy<VersionStamp>(c => ComputeTopLevelChangeTextVersionAsync(oldVersion, newDocument, c), cacheResult: true);
     }
     else
     {
         return new AsyncLazy<VersionStamp>(c => ComputeLatestDocumentTopLevelChangeVersionAsync(newDocumentStates, c), cacheResult: true);
     }
 }
开发者ID:riversky,项目名称:roslyn,代码行数:12,代码来源:ProjectState.cs

示例9: FreezePartialStateWithTree

            public CompilationTracker FreezePartialStateWithTree(Solution solution, DocumentState docState, SyntaxTree tree, CancellationToken cancellationToken)
            {
                ProjectState inProgressProject;
                Compilation inProgressCompilation;

                GetPartialCompilationState(solution, docState.Id, out inProgressProject, out inProgressCompilation, cancellationToken);

                if (!inProgressCompilation.SyntaxTrees.Contains(tree))
                {
                    var existingTree = inProgressCompilation.SyntaxTrees.FirstOrDefault(t => t.FilePath == tree.FilePath);
                    if (existingTree != null)
                    {
                        inProgressCompilation = inProgressCompilation.ReplaceSyntaxTree(existingTree, tree);
                        inProgressProject = inProgressProject.UpdateDocument(docState, textChanged: false, recalculateDependentVersions: false);
                    }
                    else
                    {
                        inProgressCompilation = inProgressCompilation.AddSyntaxTrees(tree);
                        Debug.Assert(!inProgressProject.DocumentIds.Contains(docState.Id));
                        inProgressProject = inProgressProject.AddDocument(docState);
                    }
                }

                // The user is asking for an in progress snap.  We don't want to create it and then a
                // have the compilation immediately disappear.  So we force it to stay around with a ConstantValueSource
                return new CompilationTracker(inProgressProject,
                    new FinalState(new ConstantValueSource<Compilation>(inProgressCompilation)));
            }
开发者ID:riversky,项目名称:roslyn,代码行数:28,代码来源:Solution.CompilationTracker.cs

示例10: WithDocumentState

        private SolutionState WithDocumentState(DocumentState newDocument, bool textChanged = false, bool recalculateDependentVersions = false)
        {
            if (newDocument == null)
            {
                throw new ArgumentNullException(nameof(newDocument));
            }

            CheckContainsDocument(newDocument.Id);

            if (newDocument == this.GetDocumentState(newDocument.Id))
            {
                // old and new documents are the same instance
                return this;
            }

            return this.TouchDocument(newDocument.Id, p => p.UpdateDocument(newDocument, textChanged, recalculateDependentVersions));
        }
开发者ID:tvsonar,项目名称:roslyn,代码行数:17,代码来源:SolutionState.cs

示例11: UpdateDocumentInCompilationAsync

 private static async Task<Compilation> UpdateDocumentInCompilationAsync(
     Compilation compilation,
     DocumentState oldDocument,
     DocumentState newDocument,
     CancellationToken cancellationToken)
 {
     return compilation.ReplaceSyntaxTree(
         await oldDocument.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(false),
         await newDocument.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(false));
 }
开发者ID:tvsonar,项目名称:roslyn,代码行数:10,代码来源:SolutionState.cs

示例12: Document

 internal Document(Project project, DocumentState state) :
     base(project, state)
 {
 }
开发者ID:orthoxerox,项目名称:roslyn,代码行数:4,代码来源:Document.cs

示例13: AddDocument

        private Solution AddDocument(DocumentState state)
        {
            if (state == null)
            {
                throw new ArgumentNullException(nameof(state));
            }

            CheckContainsProject(state.Id.ProjectId);

            var oldProject = this.GetProjectState(state.Id.ProjectId);
            var newProject = oldProject.AddDocument(state);

            return this.ForkProject(
                newProject,
                CompilationTranslationAction.AddDocument(state),
                newLinkedFilesMap: CreateLinkedFilesMapWithAddedDocuments(newProject, SpecializedCollections.SingletonEnumerable(state.Id)));
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:17,代码来源:Solution.cs

示例14: DocumentBranch

 internal DocumentBranch(SourceText text, DocumentState state)
 {
     this.Text = text;
     this.State = state;
 }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:5,代码来源:DocumentState.cs

示例15: AddDocument

        private Solution AddDocument(DocumentState state)
        {
            if (state == null)
            {
                throw new ArgumentNullException("document");
            }

            CheckContainsProject(state.Id.ProjectId);

            var oldProject = this.GetProjectState(state.Id.ProjectId);
            var newProject = oldProject.AddDocument(state);

            return this.ForkProject(newProject, CompilationTranslationAction.AddDocument(state), withDocumentListChange: true);
        }
开发者ID:pheede,项目名称:roslyn,代码行数:14,代码来源:Solution.cs


注:本文中的Microsoft.CodeAnalysis.DocumentState类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。