當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。