예제 #1
0
        public IEnumerable <ITagSpan <IClassificationTag> > GetTags(NormalizedSnapshotSpanCollection spans)
        {
            var context = buffer.TryGetSignatureHelpClassifierContext();

            Debug.Assert(context != null);
            if (context == null || context.Session.IsDismissed)
            {
                yield break;
            }

            if (context.Type == SignatureHelpClassifierContextTypes.ParameterName)
            {
                var paramContext = (ParameterNameSignatureHelpClassifierContext)context;
                var parameter    = paramContext.Parameter as Parameter;
                if (parameter?.Name != null)
                {
                    var snapshot = buffer.CurrentSnapshot;
                    var span     = new Span(paramContext.NameOffset, parameter.Name.Length);
                    Debug.Assert(span.End <= snapshot.Length);
                    if (span.End > snapshot.Length)
                    {
                        yield break;
                    }

                    var tag = new ClassificationTag(themeClassificationTypeService.GetClassificationType(TextColor.Parameter));
                    yield return(new TagSpan <IClassificationTag>(new SnapshotSpan(snapshot, span), tag));
                }
            }
            else if (context.Type == SignatureHelpClassifierContextTypes.ParameterDocumentation)
            {
                var paramContext = (ParameterDocumentationSignatureHelpClassifierContext)context;
                var parameter    = paramContext.Parameter as Parameter;
                if (parameter != null)
                {
                    var snapshot       = buffer.CurrentSnapshot;
                    var snapshotLength = snapshot.Length;
                    int pos            = 0;
                    foreach (var taggedText in parameter.DocumentationTaggedText)
                    {
                        var span = new Span(pos, taggedText.Text.Length);
                        Debug.Assert(span.End <= snapshotLength);
                        if (span.End > snapshotLength)
                        {
                            yield break;
                        }
                        var color = TextTagsHelper.ToTextColor(taggedText.Tag);
                        var tag   = new ClassificationTag(themeClassificationTypeService.GetClassificationType(color));
                        yield return(new TagSpan <IClassificationTag>(new SnapshotSpan(snapshot, span), tag));

                        pos = span.End;
                    }
                    Debug.Assert(pos == parameter.Documentation.Length);
                }
            }
        }
예제 #2
0
 public ReplCustomLineNumberMarginOwner(IReplEditor2 replEditor, IThemeClassificationTypeService themeClassificationTypeService)
 {
     if (replEditor == null)
     {
         throw new ArgumentNullException(nameof(replEditor));
     }
     if (themeClassificationTypeService == null)
     {
         throw new ArgumentNullException(nameof(themeClassificationTypeService));
     }
     this.replEditor = replEditor;
     this.replLineNumberInput1ClassificationType = themeClassificationTypeService.GetClassificationType(TextColor.ReplLineNumberInput1);
     this.replLineNumberInput2ClassificationType = themeClassificationTypeService.GetClassificationType(TextColor.ReplLineNumberInput2);
     this.replLineNumberOutputClassificationType = themeClassificationTypeService.GetClassificationType(TextColor.ReplLineNumberOutput);
 }
예제 #3
0
 public static IClassificationType GetClassificationType(IClassificationTypeRegistryService classificationTypeRegistryService, IThemeClassificationTypeService themeClassificationTypeService, object color)
 {
     if (color is TextColor)
     {
         return(themeClassificationTypeService.GetClassificationType((TextColor)color));
     }
     if (color is IClassificationType ct)
     {
         return(ct);
     }
     if (color is string classificationTypeName)
     {
         return(classificationTypeRegistryService.GetClassificationType(classificationTypeName) ?? themeClassificationTypeService.GetClassificationType(TextColor.Text));
     }
     return(themeClassificationTypeService.GetClassificationType(TextColor.Text));
 }
 public FilterMatchCompletionClassifier(IThemeClassificationTypeService themeClassificationTypeService)
 {
     if (themeClassificationTypeService == null)
     {
         throw new ArgumentNullException(nameof(themeClassificationTypeService));
     }
     completionMatchHighlightClassificationType = themeClassificationTypeService.GetClassificationType(TextColor.CompletionMatchHighlight);
 }
예제 #5
0
 public CompletionSuffixTextClassifier(IThemeClassificationTypeService themeClassificationTypeService)
 {
     if (themeClassificationTypeService == null)
     {
         throw new ArgumentNullException(nameof(themeClassificationTypeService));
     }
     completionSuffixClassificationType = themeClassificationTypeService.GetClassificationType(TextColor.CompletionSuffix);
 }
예제 #6
0
 public RoslynTagger(IThemeClassificationTypeService themeClassificationTypeService)
 {
     if (themeClassificationTypeService == null)
     {
         throw new ArgumentNullException(nameof(themeClassificationTypeService));
     }
     this.defaultClassificationType = themeClassificationTypeService.GetClassificationType(TextColor.Error);
     this.roslynClassificationTypes = RoslynClassificationTypes.GetClassificationTypeInstance(themeClassificationTypeService);
 }
예제 #7
0
 public CompletionClassifier(IThemeClassificationTypeService themeClassificationTypeService)
 {
     if (themeClassificationTypeService == null)
     {
         throw new ArgumentNullException(nameof(themeClassificationTypeService));
     }
     this.themeClassificationTypeService = themeClassificationTypeService;
     this.punctuationClassificationType  = themeClassificationTypeService.GetClassificationType(TextColor.Punctuation);
 }
예제 #8
0
 public RoslynTagger(ITextBuffer textBuffer, IThemeClassificationTypeService themeClassificationTypeService, IRoslynDocumentChangedService roslynDocumentChangedService)
 {
     if (themeClassificationTypeService is null)
     {
         throw new ArgumentNullException(nameof(themeClassificationTypeService));
     }
     this.textBuffer                               = textBuffer ?? throw new ArgumentNullException(nameof(textBuffer));
     defaultClassificationType                     = themeClassificationTypeService.GetClassificationType(TextColor.Error);
     roslynClassificationTypes                     = RoslynClassificationTypes.GetClassificationTypeInstance(themeClassificationTypeService);
     this.roslynDocumentChangedService             = roslynDocumentChangedService ?? throw new ArgumentNullException(nameof(roslynDocumentChangedService));
     roslynDocumentChangedService.DocumentChanged += RoslynDocumentChangedService_DocumentChanged;
 }
 public IEnumerable <TextClassificationTag> GetTags(TextClassifierContext context)
 {
     if (!context.Colorize)
     {
         yield break;
     }
     foreach (var spanData in context.Colors)
     {
         var ct = spanData.Data as IClassificationType ?? themeClassificationTypeService.GetClassificationType(spanData.Data as TextColor? ?? TextColor.Text);
         yield return(new TextClassificationTag(spanData.Span, ct));
     }
 }
예제 #10
0
        IEnumerable <TextRunPropertiesAndSpan> CreateTextRunPropertiesAndSpans(ImmutableArray <TaggedText> taggedParts, IClassificationFormatMap classificationFormatMap, IThemeClassificationTypeService themeClassificationTypeService)
        {
            int pos = 0;

            foreach (var part in taggedParts)
            {
                var color = TextTagsHelper.ToTextColor(part.Tag);
                var classificationType = themeClassificationTypeService.GetClassificationType(color);
                yield return(new TextRunPropertiesAndSpan(new Span(pos, part.Text.Length), classificationFormatMap.GetTextProperties(classificationType)));

                pos += part.Text.Length;
            }
        }
예제 #11
0
 public FilterMatchCompletionClassifier(IThemeClassificationTypeService themeClassificationTypeService, CompletionCollection completionSet)
 {
     if (themeClassificationTypeService == null)
     {
         throw new ArgumentNullException(nameof(themeClassificationTypeService));
     }
     if (completionSet == null)
     {
         throw new ArgumentNullException(nameof(completionSet));
     }
     this.completionMatchHighlightClassificationType = themeClassificationTypeService.GetClassificationType(TextColor.CompletionMatchHighlight);
     this.completionSet = completionSet;
 }
예제 #12
0
        TextFormattingRunProperties GetTextFormattingRunProperties(object color)
        {
            if (!syntaxHighlight)
            {
                color = BoxedTextColor.Text;
            }
            var classificationType = color as IClassificationType;

            if (classificationType == null)
            {
                var textColor = color as TextColor? ?? TextColor.Text;
                classificationType = themeClassificationTypeService.GetClassificationType(textColor);
            }
            return(classificationFormatMap.GetTextProperties(classificationType));
        }
예제 #13
0
        public IEnumerable <TextClassificationTag> GetTags(TextClassifierContext context)
        {
            var tagContext = context as TaggedTextClassifierContext;

            if (tagContext == null)
            {
                yield break;
            }
            int pos = 0;

            foreach (var part in tagContext.TaggedParts)
            {
                var color = TextTagsHelper.ToTextColor(part.Tag);
                int len   = part.Text.Length;
                yield return(new TextClassificationTag(new Span(pos, len), themeClassificationTypeService.GetClassificationType(color)));

                pos += len;
            }
            Debug.Assert(pos == context.Text.Length);
        }
예제 #14
0
        public IEnumerable <ITagSpan <IClassificationTag> > GetTags(NormalizedSnapshotSpanCollection spans)
        {
            var signature = session.SelectedSignature as Signature;

            if (signature == null)
            {
                yield break;
            }

            var  usePrettyPrintedContent = buffer.GetUsePrettyPrintedContent();
            var  snapshot       = buffer.CurrentSnapshot;
            var  snapshotLength = snapshot.Length;
            bool lenOk          = usePrettyPrintedContent ? snapshotLength == signature.PrettyPrintedContent.Length : snapshotLength == signature.Content.Length;

            Debug.Assert(lenOk);
            if (!lenOk)
            {
                yield break;
            }

            int pos            = 0;
            var taggedTextColl = usePrettyPrintedContent ? signature.PrettyPrintedContentTaggedText : signature.ContentTaggedText;

            foreach (var taggedText in taggedTextColl)
            {
                var span = new Span(pos, taggedText.Text.Length);
                Debug.Assert(span.End <= snapshotLength);
                if (span.End > snapshotLength)
                {
                    yield break;
                }
                var color = TextTagsHelper.ToTextColor(taggedText.Tag);
                var tag   = new ClassificationTag(themeClassificationTypeService.GetClassificationType(color));
                yield return(new TagSpan <IClassificationTag>(new SnapshotSpan(snapshot, span), tag));

                pos = span.End;
            }
            Debug.Assert(usePrettyPrintedContent ? pos == signature.PrettyPrintedContent.Length : pos == signature.Content.Length);
        }
		public CompletionSuffixTextClassifier(IThemeClassificationTypeService themeClassificationTypeService) {
			if (themeClassificationTypeService == null)
				throw new ArgumentNullException(nameof(themeClassificationTypeService));
			completionSuffixClassificationType = themeClassificationTypeService.GetClassificationType(TextColor.CompletionSuffix);
		}
예제 #16
0
 OpenDocumentListTextClassifierProvider(IThemeClassificationTypeService themeClassificationTypeService)
 {
     documentListMatchHighlightClassificationType = themeClassificationTypeService.GetClassificationType(TextColor.DocumentListMatchHighlight);
 }
        public IEnumerable <TextClassificationTag> GetTags(TextClassifierContext context)
        {
            var tagContext = context as TaggedTextClassifierContext;

            Debug.Assert(tagContext != null);
            if (tagContext == null)
            {
                yield break;
            }
            if (tagContext.TaggedParts.Length == 0)
            {
                yield break;
            }
            var part = tagContext.TaggedParts[0];

            if (part.Tag == TextTags.Text)
            {
                var partText = part.Text;
                // Eg. "AddHandler statement\r\n[...]" contains CRLF
                int endOfLineIndex = partText.IndexOf("\r\n");
                if (endOfLineIndex < 0)
                {
                    endOfLineIndex = partText.Length;
                }
                foreach (var s in keywordSuffixes)
                {
                    if (partText.IndexOf(s, 0, endOfLineIndex, StringComparison.Ordinal) == endOfLineIndex - s.Length)
                    {
                        yield return(new TextClassificationTag(new Span(0, endOfLineIndex - s.Length), themeClassificationTypeService.GetClassificationType(TextColor.Keyword)));

                        break;
                    }
                }
            }
        }
		AppSettingsSearchTextClassifierProvider(IThemeClassificationTypeService themeClassificationTypeService) {
			appSettingsTextMatchHighlightClassificationType = themeClassificationTypeService.GetClassificationType(TextColor.AppSettingsTextMatchHighlight);
		}
예제 #19
0
 RoslynClassificationTypes(IThemeClassificationTypeService themeClassificationTypeService)
 {
     Comment                            = themeClassificationTypeService.GetClassificationType(TextColor.Comment);
     Delegate                           = themeClassificationTypeService.GetClassificationType(TextColor.Delegate);
     Enum                               = themeClassificationTypeService.GetClassificationType(TextColor.Enum);
     EnumField                          = themeClassificationTypeService.GetClassificationType(TextColor.EnumField);
     ExcludedCode                       = themeClassificationTypeService.GetClassificationType(TextColor.ExcludedCode);
     ExtensionMethod                    = themeClassificationTypeService.GetClassificationType(TextColor.ExtensionMethod);
     InstanceEvent                      = themeClassificationTypeService.GetClassificationType(TextColor.InstanceEvent);
     InstanceField                      = themeClassificationTypeService.GetClassificationType(TextColor.InstanceField);
     InstanceMethod                     = themeClassificationTypeService.GetClassificationType(TextColor.InstanceMethod);
     InstanceProperty                   = themeClassificationTypeService.GetClassificationType(TextColor.InstanceProperty);
     Interface                          = themeClassificationTypeService.GetClassificationType(TextColor.Interface);
     Keyword                            = themeClassificationTypeService.GetClassificationType(TextColor.Keyword);
     Label                              = themeClassificationTypeService.GetClassificationType(TextColor.Label);
     LiteralField                       = themeClassificationTypeService.GetClassificationType(TextColor.LiteralField);
     Local                              = themeClassificationTypeService.GetClassificationType(TextColor.Local);
     MethodGenericParameter             = themeClassificationTypeService.GetClassificationType(TextColor.MethodGenericParameter);
     Module                             = themeClassificationTypeService.GetClassificationType(TextColor.Module);
     Namespace                          = themeClassificationTypeService.GetClassificationType(TextColor.Namespace);
     Number                             = themeClassificationTypeService.GetClassificationType(TextColor.Number);
     Operator                           = themeClassificationTypeService.GetClassificationType(TextColor.Operator);
     Parameter                          = themeClassificationTypeService.GetClassificationType(TextColor.Parameter);
     PreprocessorKeyword                = themeClassificationTypeService.GetClassificationType(TextColor.PreprocessorKeyword);
     PreprocessorText                   = themeClassificationTypeService.GetClassificationType(TextColor.PreprocessorText);
     Punctuation                        = themeClassificationTypeService.GetClassificationType(TextColor.Punctuation);
     SealedType                         = themeClassificationTypeService.GetClassificationType(TextColor.SealedType);
     StaticEvent                        = themeClassificationTypeService.GetClassificationType(TextColor.StaticEvent);
     StaticField                        = themeClassificationTypeService.GetClassificationType(TextColor.StaticField);
     StaticMethod                       = themeClassificationTypeService.GetClassificationType(TextColor.StaticMethod);
     StaticProperty                     = themeClassificationTypeService.GetClassificationType(TextColor.StaticProperty);
     StaticType                         = themeClassificationTypeService.GetClassificationType(TextColor.StaticType);
     String                             = themeClassificationTypeService.GetClassificationType(TextColor.String);
     Text                               = themeClassificationTypeService.GetClassificationType(TextColor.Text);
     Type                               = themeClassificationTypeService.GetClassificationType(TextColor.Type);
     TypeGenericParameter               = themeClassificationTypeService.GetClassificationType(TextColor.TypeGenericParameter);
     ValueType                          = themeClassificationTypeService.GetClassificationType(TextColor.ValueType);
     VerbatimString                     = themeClassificationTypeService.GetClassificationType(TextColor.VerbatimString);
     XmlDocCommentAttributeName         = themeClassificationTypeService.GetClassificationType(TextColor.XmlDocCommentAttributeName);
     XmlDocCommentAttributeQuotes       = themeClassificationTypeService.GetClassificationType(TextColor.XmlDocCommentAttributeQuotes);
     XmlDocCommentAttributeValue        = themeClassificationTypeService.GetClassificationType(TextColor.XmlDocCommentAttributeValue);
     XmlDocCommentCDataSection          = themeClassificationTypeService.GetClassificationType(TextColor.XmlDocCommentCDataSection);
     XmlDocCommentComment               = themeClassificationTypeService.GetClassificationType(TextColor.XmlDocCommentComment);
     XmlDocCommentDelimiter             = themeClassificationTypeService.GetClassificationType(TextColor.XmlDocCommentDelimiter);
     XmlDocCommentEntityReference       = themeClassificationTypeService.GetClassificationType(TextColor.XmlDocCommentEntityReference);
     XmlDocCommentName                  = themeClassificationTypeService.GetClassificationType(TextColor.XmlDocCommentName);
     XmlDocCommentProcessingInstruction = themeClassificationTypeService.GetClassificationType(TextColor.XmlDocCommentProcessingInstruction);
     XmlDocCommentText                  = themeClassificationTypeService.GetClassificationType(TextColor.XmlDocCommentText);
     XmlLiteralAttributeName            = themeClassificationTypeService.GetClassificationType(TextColor.XmlLiteralAttributeName);
     XmlLiteralAttributeQuotes          = themeClassificationTypeService.GetClassificationType(TextColor.XmlLiteralAttributeQuotes);
     XmlLiteralAttributeValue           = themeClassificationTypeService.GetClassificationType(TextColor.XmlLiteralAttributeValue);
     XmlLiteralCDataSection             = themeClassificationTypeService.GetClassificationType(TextColor.XmlLiteralCDataSection);
     XmlLiteralComment                  = themeClassificationTypeService.GetClassificationType(TextColor.XmlLiteralComment);
     XmlLiteralDelimiter                = themeClassificationTypeService.GetClassificationType(TextColor.XmlLiteralDelimiter);
     XmlLiteralEmbeddedExpression       = themeClassificationTypeService.GetClassificationType(TextColor.XmlLiteralEmbeddedExpression);
     XmlLiteralEntityReference          = themeClassificationTypeService.GetClassificationType(TextColor.XmlLiteralEntityReference);
     XmlLiteralName                     = themeClassificationTypeService.GetClassificationType(TextColor.XmlLiteralName);
     XmlLiteralProcessingInstruction    = themeClassificationTypeService.GetClassificationType(TextColor.XmlLiteralProcessingInstruction);
     XmlLiteralText                     = themeClassificationTypeService.GetClassificationType(TextColor.XmlLiteralText);
 }
        public IEnumerable <TextClassificationTag> GetTags(TextClassifierContext context)
        {
            var tagContext = context as TaggedTextClassifierContext;

            if (tagContext == null)
            {
                yield break;
            }
            if (tagContext.TaggedParts.Length == 0)
            {
                yield break;
            }
            var part = tagContext.TaggedParts[0];

            if (part.Tag == TextTags.Text)
            {
                var partText = part.Text;
                // Eg. "AddHandler statement\r\n[...]" contains CRLF
                int endOfLineIndex = partText.IndexOf("\r\n");
                if (endOfLineIndex < 0)
                {
                    endOfLineIndex = partText.Length;
                }
                foreach (var s in keywordSuffixes)
                {
                    int endOfKeywordPart = endOfLineIndex - s.Length;
                    if (partText.IndexOf(s, 0, endOfLineIndex, StringComparison.Ordinal) == endOfKeywordPart)
                    {
                        var keywords      = part.Text.Substring(0, endOfKeywordPart);
                        int keywordOffset = 0;
                        while (keywordOffset < keywords.Length)
                        {
                            if (keywords[keywordOffset] == ' ')
                            {
                                keywordOffset++;
                                continue;
                            }
                            int end = keywords.IndexOf(' ', keywordOffset);
                            if (end < 0)
                            {
                                end = keywords.Length;
                            }
                            int keywordLen = end - keywordOffset;
                            if (keywordLen > 0)
                            {
                                yield return(new TextClassificationTag(new Span(keywordOffset, keywordLen), themeClassificationTypeService.GetClassificationType(TextColor.Keyword)));
                            }
                            keywordOffset += keywordLen;
                        }
                        break;
                    }
                }
            }
        }
예제 #21
0
        public IEnumerable <CompletionClassificationTag> GetTags(CompletionClassifierContext context)
        {
            var completion = context.Completion as RoslynCompletion;

            if (completion == null)
            {
                yield break;
            }
            var color = completion.CompletionItem.Tags.ToCompletionKind().ToTextColor();

            if (color != TextColor.Text)
            {
                var  text        = context.DisplayText;
                bool seenSpecial = false;
                for (int textOffset = 0; textOffset < text.Length;)
                {
                    int specialIndex = text.IndexOfAny(punctuationChars, textOffset);
                    int len          = specialIndex < 0 ? text.Length - textOffset : specialIndex - textOffset;
                    if (len > 0)
                    {
                        bool wasSpecialCaseString = false;
                        if (seenSpecial)
                        {
                            var s = text.Substring(textOffset, len);
                            if (s == VBOf)
                            {
                                yield return(new CompletionClassificationTag(new Span(textOffset, 2), themeClassificationTypeService.GetClassificationType(TextColor.Keyword)));

                                wasSpecialCaseString = true;
                            }
                        }
                        if (!wasSpecialCaseString)
                        {
                            yield return(new CompletionClassificationTag(new Span(textOffset, len), themeClassificationTypeService.GetClassificationType(color)));
                        }
                        textOffset += len;
                    }

                    if (specialIndex >= 0)
                    {
                        seenSpecial = true;
                        yield return(new CompletionClassificationTag(new Span(textOffset, 1), punctuationClassificationType));

                        textOffset++;
                    }
                }
            }
        }
예제 #22
0
		RoslynClassificationTypes(IThemeClassificationTypeService themeClassificationTypeService) {
			Comment = themeClassificationTypeService.GetClassificationType(TextColor.Comment);
			Delegate = themeClassificationTypeService.GetClassificationType(TextColor.Delegate);
			Enum = themeClassificationTypeService.GetClassificationType(TextColor.Enum);
			EnumField = themeClassificationTypeService.GetClassificationType(TextColor.EnumField);
			ExcludedCode = themeClassificationTypeService.GetClassificationType(TextColor.ExcludedCode);
			ExtensionMethod = themeClassificationTypeService.GetClassificationType(TextColor.ExtensionMethod);
			InstanceEvent = themeClassificationTypeService.GetClassificationType(TextColor.InstanceEvent);
			InstanceField = themeClassificationTypeService.GetClassificationType(TextColor.InstanceField);
			InstanceMethod = themeClassificationTypeService.GetClassificationType(TextColor.InstanceMethod);
			InstanceProperty = themeClassificationTypeService.GetClassificationType(TextColor.InstanceProperty);
			Interface = themeClassificationTypeService.GetClassificationType(TextColor.Interface);
			Keyword = themeClassificationTypeService.GetClassificationType(TextColor.Keyword);
			Label = themeClassificationTypeService.GetClassificationType(TextColor.Label);
			LiteralField = themeClassificationTypeService.GetClassificationType(TextColor.LiteralField);
			Local = themeClassificationTypeService.GetClassificationType(TextColor.Local);
			MethodGenericParameter = themeClassificationTypeService.GetClassificationType(TextColor.MethodGenericParameter);
			Module = themeClassificationTypeService.GetClassificationType(TextColor.Module);
			Namespace = themeClassificationTypeService.GetClassificationType(TextColor.Namespace);
			Number = themeClassificationTypeService.GetClassificationType(TextColor.Number);
			Operator = themeClassificationTypeService.GetClassificationType(TextColor.Operator);
			Parameter = themeClassificationTypeService.GetClassificationType(TextColor.Parameter);
			PreprocessorKeyword = themeClassificationTypeService.GetClassificationType(TextColor.PreprocessorKeyword);
			PreprocessorText = themeClassificationTypeService.GetClassificationType(TextColor.PreprocessorText);
			Punctuation = themeClassificationTypeService.GetClassificationType(TextColor.Punctuation);
			SealedType = themeClassificationTypeService.GetClassificationType(TextColor.SealedType);
			StaticEvent = themeClassificationTypeService.GetClassificationType(TextColor.StaticEvent);
			StaticField = themeClassificationTypeService.GetClassificationType(TextColor.StaticField);
			StaticMethod = themeClassificationTypeService.GetClassificationType(TextColor.StaticMethod);
			StaticProperty = themeClassificationTypeService.GetClassificationType(TextColor.StaticProperty);
			StaticType = themeClassificationTypeService.GetClassificationType(TextColor.StaticType);
			String = themeClassificationTypeService.GetClassificationType(TextColor.String);
			Text = themeClassificationTypeService.GetClassificationType(TextColor.Text);
			Type = themeClassificationTypeService.GetClassificationType(TextColor.Type);
			TypeGenericParameter = themeClassificationTypeService.GetClassificationType(TextColor.TypeGenericParameter);
			ValueType = themeClassificationTypeService.GetClassificationType(TextColor.ValueType);
			VerbatimString = themeClassificationTypeService.GetClassificationType(TextColor.VerbatimString);
			XmlDocCommentAttributeName = themeClassificationTypeService.GetClassificationType(TextColor.XmlDocCommentAttributeName);
			XmlDocCommentAttributeQuotes = themeClassificationTypeService.GetClassificationType(TextColor.XmlDocCommentAttributeQuotes);
			XmlDocCommentAttributeValue = themeClassificationTypeService.GetClassificationType(TextColor.XmlDocCommentAttributeValue);
			XmlDocCommentCDataSection = themeClassificationTypeService.GetClassificationType(TextColor.XmlDocCommentCDataSection);
			XmlDocCommentComment = themeClassificationTypeService.GetClassificationType(TextColor.XmlDocCommentComment);
			XmlDocCommentDelimiter = themeClassificationTypeService.GetClassificationType(TextColor.XmlDocCommentDelimiter);
			XmlDocCommentEntityReference = themeClassificationTypeService.GetClassificationType(TextColor.XmlDocCommentEntityReference);
			XmlDocCommentName = themeClassificationTypeService.GetClassificationType(TextColor.XmlDocCommentName);
			XmlDocCommentProcessingInstruction = themeClassificationTypeService.GetClassificationType(TextColor.XmlDocCommentProcessingInstruction);
			XmlDocCommentText = themeClassificationTypeService.GetClassificationType(TextColor.XmlDocCommentText);
			XmlLiteralAttributeName = themeClassificationTypeService.GetClassificationType(TextColor.XmlLiteralAttributeName);
			XmlLiteralAttributeQuotes = themeClassificationTypeService.GetClassificationType(TextColor.XmlLiteralAttributeQuotes);
			XmlLiteralAttributeValue = themeClassificationTypeService.GetClassificationType(TextColor.XmlLiteralAttributeValue);
			XmlLiteralCDataSection = themeClassificationTypeService.GetClassificationType(TextColor.XmlLiteralCDataSection);
			XmlLiteralComment = themeClassificationTypeService.GetClassificationType(TextColor.XmlLiteralComment);
			XmlLiteralDelimiter = themeClassificationTypeService.GetClassificationType(TextColor.XmlLiteralDelimiter);
			XmlLiteralEmbeddedExpression = themeClassificationTypeService.GetClassificationType(TextColor.XmlLiteralEmbeddedExpression);
			XmlLiteralEntityReference = themeClassificationTypeService.GetClassificationType(TextColor.XmlLiteralEntityReference);
			XmlLiteralName = themeClassificationTypeService.GetClassificationType(TextColor.XmlLiteralName);
			XmlLiteralProcessingInstruction = themeClassificationTypeService.GetClassificationType(TextColor.XmlLiteralProcessingInstruction);
			XmlLiteralText = themeClassificationTypeService.GetClassificationType(TextColor.XmlLiteralText);
		}
 AppSettingsTreeViewNodeSearchTextClassifierProvider(IThemeClassificationTypeService themeClassificationTypeService)
 {
     appSettingsTreeViewNodeMatchHighlightClassificationType = themeClassificationTypeService.GetClassificationType(TextColor.AppSettingsTreeViewNodeMatchHighlight);
 }
		IEnumerable<TextRunPropertiesAndSpan> CreateTextRunPropertiesAndSpans(ImmutableArray<TaggedText> taggedParts, IClassificationFormatMap classificationFormatMap, IThemeClassificationTypeService themeClassificationTypeService) {
			int pos = 0;
			foreach (var part in taggedParts) {
				var color = TextTagsHelper.ToTextColor(part.Tag);
				var classificationType = themeClassificationTypeService.GetClassificationType(color);
				yield return new TextRunPropertiesAndSpan(new Span(pos, part.Text.Length), classificationFormatMap.GetTextProperties(classificationType));
				pos += part.Text.Length;
			}
		}
		public FilterMatchCompletionClassifier(IThemeClassificationTypeService themeClassificationTypeService) {
			if (themeClassificationTypeService == null)
				throw new ArgumentNullException(nameof(themeClassificationTypeService));
			completionMatchHighlightClassificationType = themeClassificationTypeService.GetClassificationType(TextColor.CompletionMatchHighlight);
		}
예제 #26
0
 UriClassificationTaggerProvider(IViewTagAggregatorFactoryService viewTagAggregatorFactoryService, IThemeClassificationTypeService themeClassificationTypeService)
 {
     this.viewTagAggregatorFactoryService = viewTagAggregatorFactoryService;
     classificationTag = new ClassificationTag(themeClassificationTypeService.GetClassificationType(TextColor.Url));
 }
예제 #27
0
 OpenFromGACTextClassifierProvider(IThemeClassificationTypeService themeClassificationTypeService)
 {
     this.gacMatchHighlightClassificationType = themeClassificationTypeService.GetClassificationType(TextColor.GacMatchHighlight);
 }
예제 #28
0
 public LineNumberMargin(IWpfTextViewHost wpfTextViewHost, IClassificationFormatMapService classificationFormatMapService, IThemeClassificationTypeService themeClassificationTypeService, ITextFormatterProvider textFormatterProvider)
     : base(PredefinedMarginNames.LineNumber, wpfTextViewHost, classificationFormatMapService, textFormatterProvider)
 {
     this.lineNumberClassificationType = themeClassificationTypeService.GetClassificationType(TextColor.LineNumber);
 }
예제 #29
0
		public LineNumberMargin(IWpfTextViewHost wpfTextViewHost, IClassificationFormatMapService classificationFormatMapService, IThemeClassificationTypeService themeClassificationTypeService, ITextFormatterProvider textFormatterProvider)
			: base(PredefinedMarginNames.LineNumber, wpfTextViewHost, classificationFormatMapService, textFormatterProvider) {
			lineNumberClassificationType = themeClassificationTypeService.GetClassificationType(TextColor.LineNumber);
		}
예제 #30
0
		public ReplCustomLineNumberMarginOwner(IReplEditor2 replEditor, IThemeClassificationTypeService themeClassificationTypeService) {
			if (replEditor == null)
				throw new ArgumentNullException(nameof(replEditor));
			if (themeClassificationTypeService == null)
				throw new ArgumentNullException(nameof(themeClassificationTypeService));
			this.replEditor = replEditor;
			replLineNumberInput1ClassificationType = themeClassificationTypeService.GetClassificationType(TextColor.ReplLineNumberInput1);
			replLineNumberInput2ClassificationType = themeClassificationTypeService.GetClassificationType(TextColor.ReplLineNumberInput2);
			replLineNumberOutputClassificationType = themeClassificationTypeService.GetClassificationType(TextColor.ReplLineNumberOutput);
		}
예제 #31
0
		public CompletionClassifier(IThemeClassificationTypeService themeClassificationTypeService) {
			if (themeClassificationTypeService == null)
				throw new ArgumentNullException(nameof(themeClassificationTypeService));
			this.themeClassificationTypeService = themeClassificationTypeService;
			punctuationClassificationType = themeClassificationTypeService.GetClassificationType(TextColor.Punctuation);
		}
예제 #32
0
		OpenFromGACTextClassifierProvider(IThemeClassificationTypeService themeClassificationTypeService) {
			gacMatchHighlightClassificationType = themeClassificationTypeService.GetClassificationType(TextColor.GacMatchHighlight);
		}
예제 #33
0
        public IEnumerable <TextClassificationTag> GetTags(TextClassifierContext context)
        {
            var completionContext = context as CompletionDisplayTextClassifierContext;

            if (completionContext == null)
            {
                yield break;
            }
            var completion = completionContext.Completion as RoslynCompletion;

            if (completion == null)
            {
                yield break;
            }
            var completionSet = completionContext.CompletionSet as RoslynCompletionSet;

            if (completionSet == null)
            {
                yield break;
            }

            // The completion API doesn't create tagged text so try to extract that information
            // from the string so we get nice colorized text.

            var color = completion.CompletionItem.Tags.ToCompletionKind().ToTextColor();
            var text  = context.Text;

            // Check if the namespace or enclosing class name is part of the text
            if (text.IndexOf('.') < 0)
            {
                // The common case is just an identifier, and in that case, the tag is correct
                int punctIndex = text.IndexOfAny(punctuationChars, 0);
                if (punctIndex < 0)
                {
                    yield return(new TextClassificationTag(new Span(0, text.Length), themeClassificationTypeService.GetClassificationType(color)));

                    yield break;
                }

                // Check for CLASS<> or METHOD()
                if (punctIndex + 2 == text.Length && text.IndexOfAny(punctuationChars, punctIndex + 1) == punctIndex + 1)
                {
                    yield return(new TextClassificationTag(new Span(0, punctIndex), themeClassificationTypeService.GetClassificationType(color)));

                    yield return(new TextClassificationTag(new Span(punctIndex, 2), punctuationClassificationType));

                    yield break;
                }

                // Check for Visual Basic generics special case
                const string VBOf = "(Of …)";
                if (text.Length - VBOf.Length == punctIndex && text.EndsWith(VBOf))
                {
                    yield return(new TextClassificationTag(new Span(0, punctIndex), themeClassificationTypeService.GetClassificationType(color)));

                    yield return(new TextClassificationTag(new Span(punctIndex, 1), punctuationClassificationType));

                    yield return(new TextClassificationTag(new Span(punctIndex + 1, 2), themeClassificationTypeService.GetClassificationType(TextColor.Keyword)));

                    yield return(new TextClassificationTag(new Span(punctIndex + VBOf.Length - 1, 1), punctuationClassificationType));

                    yield break;
                }
            }

            // The text is usually identical to the description and it's classified
            var description = completionSet.GetDescriptionAsync(completion).GetAwaiter().GetResult();
            var indexes     = GetMatchIndexes(completion, description);

            if (indexes != null)
            {
                int pos      = 0;
                var parts    = description.TaggedParts;
                int endIndex = indexes.Value.Value;
                for (int i = indexes.Value.Key; i <= endIndex; i++)
                {
                    var part = parts[i];
                    if (part.Tag == TextTags.LineBreak)
                    {
                        break;
                    }
                    var color2 = TextTagsHelper.ToTextColor(part.Tag);
                    yield return(new TextClassificationTag(new Span(pos, part.Text.Length), themeClassificationTypeService.GetClassificationType(color2)));

                    pos += part.Text.Length;
                }
                if (pos < text.Length)
                {
                    // The remaining text is unknown, just use the tag color
                    yield return(new TextClassificationTag(Span.FromBounds(pos, text.Length), themeClassificationTypeService.GetClassificationType(color)));
                }
                yield break;
            }

            // Give up, use the same color for all the text
            yield return(new TextClassificationTag(new Span(0, text.Length), themeClassificationTypeService.GetClassificationType(color)));
        }
		OpenDocumentListTextClassifierProvider(IThemeClassificationTypeService themeClassificationTypeService) {
			documentListMatchHighlightClassificationType = themeClassificationTypeService.GetClassificationType(TextColor.DocumentListMatchHighlight);
		}