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


C# Document.IsOpen方法代码示例

本文整理汇总了C#中Document.IsOpen方法的典型用法代码示例。如果您正苦于以下问题:C# Document.IsOpen方法的具体用法?C# Document.IsOpen怎么用?C# Document.IsOpen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Document的用法示例。


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

示例1: GetDiagnosticsAsync

        protected override async Task<IEnumerable<Diagnostic>> GetDiagnosticsAsync(Document document, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (!document.IsOpen())
            {
                return null;
            }

            if (document.SourceCodeKind == SourceCodeKind.Interactive)
            {
                // It's common to type usings in a submission that are intended for a future
                // submission.  We do not want to offer to remove these.
                return null;
            }

            var model = await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false);

            var service = document.GetLanguageService<IRemoveUnnecessaryImportsService>();
            var unnecessaryUsings = service.GetUnnecessaryImports(document, model, model.SyntaxTree.GetRoot(cancellationToken), cancellationToken);
            if (unnecessaryUsings == null)
            {
                return null;
            }

            var contiguousSpans = unnecessaryUsings.GetContiguousSpans();
            return CreateClassificationDiagnostics(contiguousSpans, model, document, cancellationToken).Concat(
                   CreateFixableDiagnostics(unnecessaryUsings, model, document, cancellationToken));
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:27,代码来源:RemoveUnnecessaryUsingsDiagnosticProvider.cs

示例2: SaveAsync

        protected async Task<bool> SaveAsync(
            Document document,
            ConditionalWeakTable<BranchId, ConditionalWeakTable<DocumentId, AbstractSyntaxTreeInfo>> cache,
            string persistenceName,
            string serializationFormat,
            CancellationToken cancellationToken)
        {
            var workspace = document.Project.Solution.Workspace;
            var infoTable = GetInfoTable(document.Project.Solution.BranchId, workspace, cache);

            // if it is forked document
            if (await document.IsForkedDocumentWithSyntaxChangesAsync(cancellationToken).ConfigureAwait(false))
            {
                infoTable.Remove(document.Id);
                infoTable.GetValue(document.Id, _ => this);
                return false;
            }

            // okay, cache this info if it is from opened document or persistence failed.
            var persisted = await SaveAsync(document, persistenceName, serializationFormat, this, cancellationToken).ConfigureAwait(false);
            if (!persisted || document.IsOpen())
            {
                var primaryInfoTable = GetInfoTable(workspace.PrimaryBranchId, workspace, cache);
                primaryInfoTable.Remove(document.Id);
                primaryInfoTable.GetValue(document.Id, _ => this);
            }

            return persisted;
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:29,代码来源:AbstractSyntaxTreeInfo.cs

示例3: GetDiagnosticsAsync

        protected override async Task<IEnumerable<Diagnostic>> GetDiagnosticsAsync(Document document, CancellationToken cancellationToken)
        {
            if (!document.IsOpen())
            {
                return null;
            }

            var model = await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false);
            var root = model.SyntaxTree.GetRoot(cancellationToken);

            var infos = model.GetDeclarationDiagnostics(cancellationToken).Where(d =>
                d.Id == CS0535 ||
                d.Id == CS0737 ||
                d.Id == CS0738).GroupBy(d => d.Location.SourceSpan).Select(g => g.First());

            var service = document.GetLanguageService<IImplementInterfaceService>();

            var diagnostics = new List<Diagnostic>();

            foreach (var error in infos)
            {
                cancellationToken.ThrowIfCancellationRequested();

                var espan = error.Location.SourceSpan;
                var token = root.FindToken(espan.Start);
                if (!token.Span.IntersectsWith(espan))
                {
                    continue;
                }

                var typeNode = token.Parent as TypeDeclarationSyntax;
                if (typeNode == null)
                {
                    continue;
                }

                IEnumerable<TypeSyntax> baseListTypes = typeNode.GetAllBaseListTypes(model, cancellationToken);

                foreach (var node in baseListTypes)
                {
                    if (service.GetCodeActions(
                        document,
                        model,
                        node,
                        cancellationToken).Any())
                    {
                        diagnostics.Add(CreateUserDiagnostic(document, node, cancellationToken));
                    }
                }
            }

            return diagnostics;
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:53,代码来源:ImplementInterfaceDiagnosticProvider.cs

示例4: GetDiagnosticsAsync

        protected override async Task<IEnumerable<Diagnostic>> GetDiagnosticsAsync(Document document, TextSpan span, CancellationToken cancellationToken)
        {
            if (!document.IsOpen())
            {
                return null;
            }

            var model = await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false);
            var root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false);
            var node = root.FindNode(span);

            List<Diagnostic> diagnostics = null;
            diagnostics = ProcessNode(document, model, node, diagnostics, cancellationToken);
            return diagnostics;
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:15,代码来源:SimplifyTypeNamesDiagnosticProvider.cs

示例5: PrecalculateAdvancedInfoAsync

        private static async Task PrecalculateAdvancedInfoAsync(Document document, CancellationToken cancellationToken)
        {
            // we do not support precalculating opened file.
            if (document.IsOpen())
            {
                return;
            }

            // we already have information. move on
            if (await SyntaxTreeIdentifierInfo.IdentifierSetPrecalculatedAsync(document, cancellationToken).ConfigureAwait(false))
            {
                return;
            }

            await SyntaxTreeIdentifierInfo.SaveIdentifierSetAsync(document, cancellationToken).ConfigureAwait(false);
        }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:16,代码来源:SyntaxTreeInfo.cs

示例6: AnalyzeDocumentAsync

            public async Task AnalyzeDocumentAsync(Document document, SyntaxNode bodyOpt, InvocationReasons reasons, CancellationToken cancellationToken)
            {
                // method body change
                if (bodyOpt != null || !document.IsOpen())
                {
                    return;
                }

                // get semantic version for the project this document belongs to
                var newVersion = await document.Project.GetDependentSemanticVersionAsync(cancellationToken).ConfigureAwait(false);
                // check whether we already saw semantic version change
                if (_map.TryGetValue(document.Id, out var oldVersion) && oldVersion == newVersion)
                {
                    return;
                }

                // update to new version
                _map[document.Id] = newVersion;
                _owner.RaiseOpenDocumentSemanticChangedEvent(document);
            }
开发者ID:GuilhermeSa,项目名称:roslyn,代码行数:20,代码来源:SemanticChangeNotificationService.cs

示例7: GetFirstDiagnosticWithFixAsync

        public async Task<FirstDiagnosticResult> GetFirstDiagnosticWithFixAsync(Document document, TextSpan range, bool considerSuppressionFixes, CancellationToken cancellationToken)
        {
            if (document == null || !document.IsOpen())
            {
                return default(FirstDiagnosticResult);
            }

            using (var diagnostics = SharedPools.Default<List<DiagnosticData>>().GetPooledObject())
            {
                var fullResult = await _diagnosticService.TryAppendDiagnosticsForSpanAsync(document, range, diagnostics.Object, cancellationToken: cancellationToken).ConfigureAwait(false);
                foreach (var diagnostic in diagnostics.Object)
                {
                    cancellationToken.ThrowIfCancellationRequested();

                    if (!range.IntersectsWith(diagnostic.TextSpan))
                    {
                        continue;
                    }

                    // REVIEW: 2 possible designs. 
                    // 1. find the first fix and then return right away. if the lightbulb is actually expanded, find all fixes for the line synchronously. or
                    // 2. kick off a task that finds all fixes for the given range here but return once we find the first one. 
                    // at the same time, let the task to run to finish. if the lightbulb is expanded, we just simply use the task to get all fixes.
                    //
                    // first approach is simpler, so I will implement that first. if the first approach turns out to be not good enough, then
                    // I will try the second approach which will be more complex but quicker
                    var hasFix = await ContainsAnyFix(document, diagnostic, considerSuppressionFixes, cancellationToken).ConfigureAwait(false);
                    if (hasFix)
                    {
                        return new FirstDiagnosticResult(!fullResult, hasFix, diagnostic);
                    }
                }

                return new FirstDiagnosticResult(!fullResult, false, default(DiagnosticData));
            }
        }
开发者ID:binsys,项目名称:roslyn,代码行数:36,代码来源:CodeFixService.cs

示例8: AnalysisEnabled

 private static bool AnalysisEnabled(Document document)
 {
     // change it to check active file (or visible files), not open files if active file tracking is enabled.
     // otherwise, use open file.
     return document.IsOpen();
 }
开发者ID:Rickinio,项目名称:roslyn,代码行数:6,代码来源:DiagnosticIncrementalAnalyzer_IncrementalAnalyzer.cs

示例9: LoadAsync

        public static async Task<SyntaxTreeIdentifierInfo> LoadAsync(Document document, CancellationToken cancellationToken)
        {
            var workspace = document.Project.Solution.Workspace;
            var infoTable = GetInfoTable(document.Project.Solution.BranchId, workspace);
            var version = await document.GetSyntaxVersionAsync(cancellationToken).ConfigureAwait(false);

            // first look to see if we already have the info in the live cache
            SyntaxTreeIdentifierInfo info;
            if (infoTable.TryGetValue(document.Id, out info) && info.Version == version)
            {
                return info;
            }

            // we know cached information is invalid, delete it.
            infoTable.Remove(document.Id);

            // now, check primary cache to see whether we have a hit
            var primaryInfoTable = GetInfoTable(workspace.PrimaryBranchId, workspace);
            if (primaryInfoTable.TryGetValue(document.Id, out info) && info.Version == version)
            {
                return info;
            }

            // check whether we can re-use persisted data
            info = await LoadAsync(document, PersistenceName, SerializationFormat, ReadFrom, cancellationToken).ConfigureAwait(false);
            if (info != null)
            {
                // check whether we need to cache it
                if (document.IsOpen())
                {
                    Contract.Requires(!await document.IsForkedDocumentWithSyntaxChangesAsync(cancellationToken).ConfigureAwait(false));
                    primaryInfoTable.Remove(document.Id);
                    primaryInfoTable.GetValue(document.Id, _ => info);
                }

                return info;
            }

            return null;
        }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:40,代码来源:SyntaxTreeIdentifierInfo.cs

示例10: AnalyzeDocumentAsync

        private async Task AnalyzeDocumentAsync(Document document, VersionArgument versions, ImmutableHashSet<string> diagnosticIds, bool skipClosedFileChecks, CancellationToken cancellationToken)
        {
            try
            {
                var root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false);
                var fullSpan = root == null ? null : (TextSpan?)root.FullSpan;

                var userDiagnosticDriver = new DiagnosticAnalyzerDriver(document, fullSpan, root, this, cancellationToken);
                bool openedDocument = document.IsOpen();

                foreach (var stateSet in _stateManager.GetOrUpdateStateSets(document.Project))
                {
                    if (SkipRunningAnalyzer(document.Project.CompilationOptions, userDiagnosticDriver, openedDocument, skipClosedFileChecks, stateSet))
                    {
                        await ClearExistingDiagnostics(document, stateSet, StateType.Document, cancellationToken).ConfigureAwait(false);
                        continue;
                    }

                    if (ShouldRunAnalyzerForStateType(stateSet.Analyzer, StateType.Document, diagnosticIds))
                    {
                        var data = await _executor.GetDocumentAnalysisDataAsync(userDiagnosticDriver, stateSet, versions).ConfigureAwait(false);
                        if (data.FromCache)
                        {
                            RaiseDiagnosticsUpdated(StateType.Document, document.Id, stateSet, new SolutionArgument(document), data.Items);
                            continue;
                        }

                        if (openedDocument)
                        {
                            _memberRangeMap.Touch(stateSet.Analyzer, document, versions.TextVersion);
                        }

                        var state = stateSet.GetState(StateType.Document);
                        await state.PersistAsync(document, data.ToPersistData(), cancellationToken).ConfigureAwait(false);

                        RaiseDocumentDiagnosticsUpdatedIfNeeded(StateType.Document, document, stateSet, data.OldItems, data.Items);
                    }
                }

                _solutionCrawlerAnalysisState.OnDocumentAnalyzed(document);
            }
            catch (Exception e) when (FatalError.ReportUnlessCanceled(e))
            {
                throw ExceptionUtilities.Unreachable;
            }
        }
开发者ID:nevinclement,项目名称:roslyn,代码行数:46,代码来源:DiagnosticIncrementalAnalyzer.cs

示例11: GetSemanticModelForNodeAsync

            public async Task<SemanticModel> GetSemanticModelForNodeAsync(Document document, SyntaxNode node, CancellationToken cancellationToken = default(CancellationToken))
            {
                var syntaxFactsService = document.Project.LanguageServices.GetService<ISyntaxFactsService>();
                var semanticFactsService = document.Project.LanguageServices.GetService<ISemanticFactsService>();

                if (syntaxFactsService == null || semanticFactsService == null || node == null)
                {
                    // it only works if we can track member
                    return await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false);
                }

                if (IsPrimaryBranch(document) && !document.IsOpen())
                {
                    // for ones in primary branch, we only support opened documents (mostly to help typing scenario)
                    return await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false);
                }

                var versionMap = GetVersionMapFromBranchOrPrimary(document.Project.Solution.Workspace, document.Project.Solution.BranchId);

                var projectId = document.Project.Id;
                var version = await document.Project.GetDependentSemanticVersionAsync(cancellationToken).ConfigureAwait(false);

                CompilationSet compilationSet;
                using (gate.DisposableRead())
                {
                    versionMap.TryGetValue(projectId, out compilationSet);
                }

                // this is first time
                if (compilationSet == null)
                {
                    // update the cache
                    await AddVersionCacheAsync(document.Project, version, cancellationToken).ConfigureAwait(false);

                    // get the base one
                    return await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false);
                }

                // we have compilation set check whether it is something we can use
                if (version.Equals(compilationSet.Version))
                {
                    Compilation oldCompilation;
                    if (!compilationSet.Compilation.TryGetValue(out oldCompilation))
                    {
                        await AddVersionCacheAsync(document.Project, version, cancellationToken).ConfigureAwait(false);

                        // get the base one
                        return await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false);
                    }

                    // first check whether the set has this document
                    SyntaxTree oldTree;
                    if (!compilationSet.Trees.TryGetValue(document.Id, out oldTree))
                    {
                        // noop.
                        return await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false);
                    }

                    // Yes, we have compilation we might be able to re-use
                    var root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false);
                    if (root.SyntaxTree == oldTree)
                    {
                        // the one we have and the one in the document is same one. but tree in other file might
                        // have changed (no top level change). in that case, just use one from the document.
                        return await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false);
                    }

                    // let's track member that we can re-use
                    var member = syntaxFactsService.GetContainingMemberDeclaration(root, node.SpanStart);
                    if (!syntaxFactsService.IsMethodLevelMember(member))
                    {
                        // oops, given node is not something we can support
                        return await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false);
                    }

                    // check whether we already have speculative semantic model for this
                    var cachedModel = GetCachedSemanticModel(oldCompilation, member);
                    if (cachedModel != null)
                    {
                        // Yes!
                        return cachedModel;
                    }

                    // alright, we have member id. find same member from old compilation
                    var memberId = syntaxFactsService.GetMethodLevelMemberId(root, member);
                    var oldRoot = await oldTree.GetRootAsync(cancellationToken).ConfigureAwait(false);

                    var oldMember = syntaxFactsService.GetMethodLevelMember(oldRoot, memberId);
                    var oldModel = oldCompilation.GetSemanticModel(oldTree);

                    SemanticModel model;
                    if (!semanticFactsService.TryGetSpeculativeSemanticModel(oldModel, oldMember, member, out model))
                    {
                        return await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false);
                    }

                    // cache the new speculative semantic model for the given node
                    Contract.ThrowIfNull(model);
                    return CacheSemanticModel(oldCompilation, member, model);
                }
//.........这里部分代码省略.........
开发者ID:jerriclynsjohn,项目名称:roslyn,代码行数:101,代码来源:SemanticModelWorkspaceServiceFactory.cs

示例12: ParseIfOpen

 private void ParseIfOpen(Document document)
 {
     if (document != null && document.IsOpen())
     {
         this.Parse(document);
     }
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:7,代码来源:BackgroundParser.cs

示例13: AnalyzeSyntaxAsync

        private async Task AnalyzeSyntaxAsync(Document document, ImmutableHashSet<string> diagnosticIds, CancellationToken cancellationToken)
        {
            try
            {
                if (!CheckOptions(document.Project, document.IsOpen()))
                {
                    return;
                }

                var textVersion = await document.GetTextVersionAsync(cancellationToken).ConfigureAwait(false);
                var dataVersion = await document.GetSyntaxVersionAsync(cancellationToken).ConfigureAwait(false);
                var versions = new VersionArgument(textVersion, dataVersion);

                var root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false);
                var fullSpan = root == null ? null : (TextSpan?)root.FullSpan;

                var openedDocument = document.IsOpen();

                var stateSets = _stateManager.GetOrUpdateStateSets(document.Project);
                var analyzers = stateSets.Select(s => s.Analyzer);

                var userDiagnosticDriver = new DiagnosticAnalyzerDriver(
                    document, fullSpan, root, this, analyzers, ConcurrentAnalysis, ReportSuppressedDiagnostics, cancellationToken);

                foreach (var stateSet in stateSets)
                {
                    if (await SkipRunningAnalyzerAsync(document.Project, stateSet.Analyzer, openedDocument, skipClosedFileCheck: false, cancellationToken: cancellationToken).ConfigureAwait(false))
                    {
                        await ClearExistingDiagnostics(document, stateSet, StateType.Syntax, cancellationToken).ConfigureAwait(false);
                        continue;
                    }

                    if (ShouldRunAnalyzerForStateType(stateSet.Analyzer, StateType.Syntax, diagnosticIds))
                    {
                        var data = await _executor.GetSyntaxAnalysisDataAsync(userDiagnosticDriver, stateSet, versions).ConfigureAwait(false);
                        if (data.FromCache)
                        {
                            RaiseDiagnosticsCreatedFromCacheIfNeeded(StateType.Syntax, document, stateSet, data.Items);
                            continue;
                        }

                        var state = stateSet.GetState(StateType.Syntax);
                        await state.PersistAsync(document, data.ToPersistData(), cancellationToken).ConfigureAwait(false);

                        RaiseDocumentDiagnosticsUpdatedIfNeeded(StateType.Syntax, document, stateSet, data.OldItems, data.Items);
                    }
                }
            }
            catch (Exception e) when (FatalError.ReportUnlessCanceled(e))
            {
                throw ExceptionUtilities.Unreachable;
            }
        }
开发者ID:vcsjones,项目名称:roslyn,代码行数:53,代码来源:DiagnosticIncrementalAnalyzer.cs

示例14: AnalyzeDocumentAsync

            private async Task AnalyzeDocumentAsync(Document document, VersionArgument versions, ImmutableHashSet<string> diagnosticIds, bool skipClosedFileChecks, CancellationToken cancellationToken)
            {
                try
                {
                    var root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false);
                    var fullSpan = root == null ? null : (TextSpan?)root.FullSpan;

                    var userDiagnosticDriver = new DiagnosticAnalyzerDriver(document, fullSpan, root, _diagnosticLogAggregator, cancellationToken);
                    bool openedDocument = document.IsOpen();
                    var options = document.Project.CompilationOptions;

                    foreach (var providerAndId in await _analyzersAndState.GetAllProviderAndIdsAsync(document.Project, cancellationToken).ConfigureAwait(false))
                    {
                        var provider = providerAndId.Key;
                        var providerId = providerAndId.Value;

                        if (IsAnalyzerSuppressed(provider, options, userDiagnosticDriver))
                        {
                            await HandleSuppressedAnalyzerAsync(document, StateType.Document, providerId, provider, cancellationToken).ConfigureAwait(false);
                        }
                        else if (ShouldRunProviderForStateType(StateType.Document, provider, userDiagnosticDriver, diagnosticIds) &&
                            (skipClosedFileChecks || ShouldRunProviderForClosedFile(openedDocument, provider)))
                        {
                            var data = await _executor.GetDocumentAnalysisDataAsync(provider, providerId, versions, userDiagnosticDriver).ConfigureAwait(false);
                            if (data.FromCache)
                            {
                                RaiseDiagnosticsUpdated(StateType.Document, document.Id, providerId, new SolutionArgument(document), data.Items);
                                continue;
                            }

                            if (openedDocument)
                            {
                                _memberRangeMap.Touch(providerId, document, versions.TextVersion);
                            }

                            var state = _analyzersAndState.GetOrCreateDiagnosticState(StateType.Document, providerId, provider, document.Project.Id, document.Project.Language);
                            await state.PersistAsync(document, data.ToPersistData(), cancellationToken).ConfigureAwait(false);

                            RaiseDiagnosticsUpdatedIfNeeded(StateType.Document, document, providerId, data.OldItems, data.Items);
                        }
                    }
                }
                catch (Exception e) when (FatalError.ReportUnlessCanceled(e))
                {
                    throw ExceptionUtilities.Unreachable;
                }
            }
开发者ID:JinGuoGe,项目名称:roslyn,代码行数:47,代码来源:DiagnosticAnalyzerService.IncrementalAnalyzer.cs

示例15: AnalyzeSyntaxAsync

        private async Task AnalyzeSyntaxAsync(Document document, ImmutableHashSet<string> diagnosticIds, bool skipClosedFileChecks, CancellationToken cancellationToken)
        {
            try
            {
                if (!skipClosedFileChecks && !CheckOption(document.Project.Solution.Workspace, document.Project.Language, document.IsOpen()))
                {
                    return;
                }

                var textVersion = await document.GetTextVersionAsync(cancellationToken).ConfigureAwait(false);
                var dataVersion = await document.GetSyntaxVersionAsync(cancellationToken).ConfigureAwait(false);
                var versions = new VersionArgument(textVersion, dataVersion);

                var root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false);
                var fullSpan = root == null ? null : (TextSpan?)root.FullSpan;

                var userDiagnosticDriver = new DiagnosticAnalyzerDriver(document, fullSpan, root, this, cancellationToken);
                var openedDocument = document.IsOpen();

                foreach (var stateSet in _stateManger.GetOrUpdateStateSets(document.Project))
                {
                    if (userDiagnosticDriver.IsAnalyzerSuppressed(stateSet.Analyzer))
                    {
                        await HandleSuppressedAnalyzerAsync(document, stateSet, StateType.Syntax, cancellationToken).ConfigureAwait(false);
                    }
                    else if (await ShouldRunAnalyzerForStateTypeAsync(userDiagnosticDriver, stateSet.Analyzer, StateType.Syntax, diagnosticIds).ConfigureAwait(false) &&
                        (skipClosedFileChecks || ShouldRunAnalyzerForClosedFile(openedDocument, stateSet.Analyzer)))
                    {
                        var data = await _executor.GetSyntaxAnalysisDataAsync(userDiagnosticDriver, stateSet, versions).ConfigureAwait(false);
                        if (data.FromCache)
                        {
                            RaiseDiagnosticsUpdated(StateType.Syntax, document.Id, stateSet, new SolutionArgument(document), data.Items);
                            continue;
                        }

                        var state = stateSet.GetState(StateType.Syntax);
                        await state.PersistAsync(document, data.ToPersistData(), cancellationToken).ConfigureAwait(false);

                        RaiseDocumentDiagnosticsUpdatedIfNeeded(StateType.Syntax, document, stateSet, data.OldItems, data.Items);
                    }
                }
            }
            catch (Exception e) when (FatalError.ReportUnlessCanceled(e))
            {
                throw ExceptionUtilities.Unreachable;
            }
        }
开发者ID:ehsansajjad465,项目名称:roslyn,代码行数:47,代码来源:DiagnosticIncrementalAnalyzer.cs


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