private void AddClassification(TextSpan textSpan, SyntaxClassification kind)
 {
     if (textSpan.Length > 0)
     {
         _classificationSpans.Add(new SyntaxClassificationSpan(textSpan, kind));
     }
 }
Ejemplo n.º 2
0
        private IClassificationType GetClassificationType(SyntaxClassification classification)
        {
            switch (classification)
            {
            case SyntaxClassification.Whitespace:
                return(_classificationService.WhiteSpace);

            case SyntaxClassification.Comment:
                return(_classificationService.Comment);

            case SyntaxClassification.Keyword:
                return(_classificationService.Keyword);

            case SyntaxClassification.Punctuation:
                return(_classificationService.Punctuation);

            case SyntaxClassification.Identifier:
                return(_classificationService.Identifier);

            case SyntaxClassification.StringLiteral:
                return(_classificationService.StringLiteral);

            case SyntaxClassification.NumberLiteral:
                return(_classificationService.NumberLiteral);

            default:
                throw ExceptionBuilder.UnexpectedValue(classification);
            }
        }
        private IClassificationType GetClassification(SyntaxClassification kind)
        {
            switch (kind)
            {
            case SyntaxClassification.Whitespace:
                return(_classificationTypes.WhiteSpace);

            case SyntaxClassification.Comment:
                return(_classificationTypes.Comment);

            case SyntaxClassification.Keyword:
                return(_classificationTypes.Keyword);

            case SyntaxClassification.Punctuation:
                return(_classificationTypes.Punctuation);

            case SyntaxClassification.Identifier:
                return(_classificationTypes.Identifier);

            case SyntaxClassification.StringLiteral:
                return(_classificationTypes.StringLiteral);

            case SyntaxClassification.NumberLiteral:
                return(_classificationTypes.NumberLiteral);

            default:
                throw new ArgumentOutOfRangeException(nameof(kind));
            }
        }
Ejemplo n.º 4
0
        public static void AddClassification(
            this ICollection <ClassificationSpan> classifications,
            SnapshotSpan snapshotSpan,
            SyntaxClassification classification,
            IClassificationType type)
        {
            var span = new Span(classification.Start, classification.Length);

            classifications.Add(new ClassificationSpan(
                                    new SnapshotSpan(snapshotSpan.Snapshot, span),
                                    type));
        }
 private void AddClassification(SyntaxTrivia trivia, SyntaxClassification kind)
 {
     AddClassification(trivia.Span, kind);
 }
 private void AddClassification(SyntaxToken token, SyntaxClassification kind)
 {
     AddClassification(token.Span, kind);
 }
Ejemplo n.º 7
0
 public SyntaxClassificationSpan(TextSpan span, SyntaxClassification classification)
 {
     Span           = span;
     Classification = classification;
 }