Beispiel #1
0
        private static Task <SemanticModel> GetSemanticModelForNodeAsync(
            ISemanticModelService semanticModelService, ISyntaxFactsService syntaxFactService,
            Document document, SyntaxNode node, TextSpan span, CancellationToken cancellationToken)
        {
            // check whether given span is a valid span to do speculative binding
            var speculativeBindingSpan = syntaxFactService.GetMemberBodySpanForSpeculativeBinding(node);

            if (!speculativeBindingSpan.Contains(span))
            {
                return(document.GetSemanticModelAsync(cancellationToken));
            }

            return(semanticModelService.GetSemanticModelForNodeAsync(document, node, cancellationToken));
        }