Beispiel #1
0
        private void ClassifyToken(SyntaxToken token)
        {
            var span = token.Span;

            if (ShouldAddSpan(span))
            {
                var type = ClassificationHelpers.GetClassification(token);

                if (type != null)
                {
                    AddClassification(span, type);

                    // Additionally classify static symbols
                    if (
                        token.Kind() == SyntaxKind.IdentifierToken &&
                        ClassificationHelpers.IsStaticallyDeclared(token)
                        )
                    {
                        AddClassification(span, ClassificationTypeNames.StaticSymbol);
                    }
                }
            }

            ClassifyTriviaList(token.LeadingTrivia);
            ClassifyTriviaList(token.TrailingTrivia);
        }
Beispiel #2
0
        private void ClassifyToken(SyntaxToken token)
        {
            var span = token.Span;

            if (ShouldAddSpan(span))
            {
                var type = ClassificationHelpers.GetClassification(token);

                if (type != null)
                {
                    AddClassification(span, type);
                }
            }

            foreach (var trivia in token.LeadingTrivia)
            {
                _cancellationToken.ThrowIfCancellationRequested();
                ClassifyTrivia(trivia);
            }

            foreach (var trivia in token.TrailingTrivia)
            {
                _cancellationToken.ThrowIfCancellationRequested();
                ClassifyTrivia(trivia);
            }
        }
Beispiel #3
0
        private void ClassifyToken(SyntaxToken token)
        {
            var span = token.Span;

            if (span.Length != 0 && textSpan.OverlapsWith(span))
            {
                var type = ClassificationHelpers.GetClassification(token);

                if (type != null)
                {
                    AddClassification(span, type);
                }
            }

            foreach (var trivia in token.LeadingTrivia)
            {
                cancellationToken.ThrowIfCancellationRequested();
                ClassifyTrivia(trivia);
            }

            foreach (var trivia in token.TrailingTrivia)
            {
                cancellationToken.ThrowIfCancellationRequested();
                ClassifyTrivia(trivia);
            }
        }
        public override void AddLexicalClassifications(SourceText text, TextSpan textSpan, List <ClassifiedSpan> result, CancellationToken cancellationToken)
        {
            using var _ = ArrayBuilder <ClassifiedSpan> .GetInstance(out var temp);

            ClassificationHelpers.AddLexicalClassifications(text, textSpan, temp, cancellationToken);
            AddRange(temp, result);
        }
 public override void AddLexicalClassifications(
     SourceText text,
     TextSpan textSpan,
     ArrayBuilder <ClassifiedSpan> result,
     CancellationToken cancellationToken
     ) =>
 ClassificationHelpers.AddLexicalClassifications(
     text,
     textSpan,
     result,
     cancellationToken
     );
Beispiel #6
0
        private void ClassifyToken(SyntaxToken token)
        {
            var span = token.Span;

            if (ShouldAddSpan(span))
            {
                var type = ClassificationHelpers.GetClassification(token);

                if (type != null)
                {
                    AddClassification(span, type);
                }
            }

            ClassifyTriviaList(token.LeadingTrivia);
            ClassifyTriviaList(token.TrailingTrivia);
        }
 public override string?GetSyntacticClassificationForIdentifier(SyntaxToken identifier)
 => ClassificationHelpers.GetSyntacticClassificationForIdentifier(identifier);
 public override ClassifiedSpan FixClassification(SourceText rawText, ClassifiedSpan classifiedSpan)
 => ClassificationHelpers.AdjustStaleClassification(rawText, classifiedSpan);