Пример #1
0
        protected override Tuple <ITextSnapshot, List <ITagSpan <IClassificationTag> > > GetTags(SnapshotSyntaxTree snapshotSyntaxTree, CancellationToken cancellationToken)
        {
            var semanticTags          = new List <ITagSpan <IClassificationTag> >();
            var semanticTaggerVisitor = new SemanticTaggerVisitor(_classificationService, snapshotSyntaxTree.Snapshot, semanticTags, cancellationToken);

            semanticTaggerVisitor.VisitCompilationUnit((CompilationUnitSyntax)snapshotSyntaxTree.SyntaxTree.Root);

            return(Tuple.Create(snapshotSyntaxTree.Snapshot, semanticTags));
        }
Пример #2
0
        protected override Tuple <ITextSnapshot, List <ITagSpan <IClassificationTag> > > GetTags(ITextSnapshot snapshot, CancellationToken cancellationToken)
        {
            var semanticTags = new List <ITagSpan <IClassificationTag> >();

            SemanticModel semanticModel;

            if (snapshot.TryGetSemanticModel(cancellationToken, out semanticModel))
            {
                var semanticTaggerVisitor = new SemanticTaggerVisitor(semanticModel, _classificationService, snapshot, semanticTags, cancellationToken);
                semanticTaggerVisitor.VisitCompilationUnit((CompilationUnitSyntax)semanticModel.SyntaxTree.Root);
            }

            return(Tuple.Create(snapshot, semanticTags));
        }