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); } } }
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); }
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); }
public CompletionSuffixTextClassifier(IThemeClassificationTypeService themeClassificationTypeService) { if (themeClassificationTypeService == null) { throw new ArgumentNullException(nameof(themeClassificationTypeService)); } completionSuffixClassificationType = themeClassificationTypeService.GetClassificationType(TextColor.CompletionSuffix); }
public RoslynTagger(IThemeClassificationTypeService themeClassificationTypeService) { if (themeClassificationTypeService == null) { throw new ArgumentNullException(nameof(themeClassificationTypeService)); } this.defaultClassificationType = themeClassificationTypeService.GetClassificationType(TextColor.Error); this.roslynClassificationTypes = RoslynClassificationTypes.GetClassificationTypeInstance(themeClassificationTypeService); }
public CompletionClassifier(IThemeClassificationTypeService themeClassificationTypeService) { if (themeClassificationTypeService == null) { throw new ArgumentNullException(nameof(themeClassificationTypeService)); } this.themeClassificationTypeService = themeClassificationTypeService; this.punctuationClassificationType = themeClassificationTypeService.GetClassificationType(TextColor.Punctuation); }
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)); } }
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, 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; }
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)); }
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); }
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); }
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); }
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; } } } }
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++; } } } }
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); }
UriClassificationTaggerProvider(IViewTagAggregatorFactoryService viewTagAggregatorFactoryService, IThemeClassificationTypeService themeClassificationTypeService) { this.viewTagAggregatorFactoryService = viewTagAggregatorFactoryService; classificationTag = new ClassificationTag(themeClassificationTypeService.GetClassificationType(TextColor.Url)); }
OpenFromGACTextClassifierProvider(IThemeClassificationTypeService themeClassificationTypeService) { this.gacMatchHighlightClassificationType = themeClassificationTypeService.GetClassificationType(TextColor.GacMatchHighlight); }
public LineNumberMargin(IWpfTextViewHost wpfTextViewHost, IClassificationFormatMapService classificationFormatMapService, IThemeClassificationTypeService themeClassificationTypeService, ITextFormatterProvider textFormatterProvider) : base(PredefinedMarginNames.LineNumber, wpfTextViewHost, classificationFormatMapService, textFormatterProvider) { this.lineNumberClassificationType = themeClassificationTypeService.GetClassificationType(TextColor.LineNumber); }
public LineNumberMargin(IWpfTextViewHost wpfTextViewHost, IClassificationFormatMapService classificationFormatMapService, IThemeClassificationTypeService themeClassificationTypeService, ITextFormatterProvider textFormatterProvider) : base(PredefinedMarginNames.LineNumber, wpfTextViewHost, classificationFormatMapService, textFormatterProvider) { lineNumberClassificationType = themeClassificationTypeService.GetClassificationType(TextColor.LineNumber); }
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); }
public CompletionClassifier(IThemeClassificationTypeService themeClassificationTypeService) { if (themeClassificationTypeService == null) throw new ArgumentNullException(nameof(themeClassificationTypeService)); this.themeClassificationTypeService = themeClassificationTypeService; punctuationClassificationType = themeClassificationTypeService.GetClassificationType(TextColor.Punctuation); }
OpenFromGACTextClassifierProvider(IThemeClassificationTypeService themeClassificationTypeService) { gacMatchHighlightClassificationType = themeClassificationTypeService.GetClassificationType(TextColor.GacMatchHighlight); }
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); }