public TextBlockContentInfo Create(int version, IClassificationFormatMap classificationFormatMap, TextClassifierContext context, string contentType, TextElementFlags flags, double opacity) { if (classificationFormatMap == null) { throw new ArgumentNullException(nameof(classificationFormatMap)); } if (context == null) { throw new ArgumentNullException(nameof(context)); } if (contentType == null) { throw new ArgumentNullException(nameof(contentType)); } var ct = contentTypeRegistryService.GetContentType(contentType); if (ct == null) { throw new ArgumentException($"Invalid content type: {contentType}"); } if (!toAggregator.TryGetValue(ct, out var aggregator)) { toAggregator.Add(ct, aggregator = textClassifierAggregatorService.Create(ct)); } var tags = aggregator.GetTags(context).ToArray(); return(new TextBlockContentInfo(textElementFactory, version, classificationFormatMap, context.Text, tags, flags, opacity)); }
public FrameworkElement CreateTextElement(TreeViewNodeClassifierContext context, string contentType, bool filterOutNewLines, bool useNewFormatter) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (contentType == null) { throw new ArgumentNullException(nameof(contentType)); } var ct = contentTypeRegistryService.GetContentType(contentType); if (ct == null) { throw new ArgumentException($"Invalid content type: {contentType}"); } ITextClassifierAggregator aggregator; if (!toAggregator.TryGetValue(ct, out aggregator)) { toAggregator.Add(ct, aggregator = textClassifierAggregatorService.Create(ct)); } try { tagsList.AddRange(aggregator.GetTags(context)); return(TextElementFactory.Create(classificationFormatMap, context.Text, tagsList, useNewFormatter: useNewFormatter, filterOutNewLines: filterOutNewLines)); } finally { tagsList.Clear(); } }
public FrameworkElement CreateTextElement(IClassificationFormatMap classificationFormatMap, TextClassifierContext context, string contentType, TextElementFlags flags) { if (classificationFormatMap == null) { throw new ArgumentNullException(nameof(classificationFormatMap)); } if (context == null) { throw new ArgumentNullException(nameof(context)); } if (contentType == null) { throw new ArgumentNullException(nameof(contentType)); } var ct = contentTypeRegistryService.GetContentType(contentType); if (ct == null) { throw new ArgumentException($"Invalid content type: {contentType}"); } ITextClassifierAggregator aggregator; if (!toAggregator.TryGetValue(ct, out aggregator)) { toAggregator.Add(ct, aggregator = textClassifierAggregatorService.Create(ct)); } try { tagsList.AddRange(aggregator.GetTags(context)); return(TextElementFactory.Create(classificationFormatMap, context.Text, tagsList, flags)); } finally { tagsList.Clear(); } }
ITextClassifier GetTextClassifier(IContentType contentType) { if (!toClassifier.TryGetValue(contentType, out var completionClassifier)) { toClassifier.Add(contentType, completionClassifier = textClassifierAggregatorService.Create(contentType)); } return(completionClassifier); }
public TaggedTextElementProvider(IContentType contentType, ITextClassifierAggregatorService textClassifierAggregatorService, IClassificationFormatMap classificationFormatMap) { if (contentType == null) throw new ArgumentNullException(nameof(contentType)); if (textClassifierAggregatorService == null) throw new ArgumentNullException(nameof(textClassifierAggregatorService)); if (classificationFormatMap == null) throw new ArgumentNullException(nameof(classificationFormatMap)); classifierAggregator = textClassifierAggregatorService.Create(contentType); this.classificationFormatMap = classificationFormatMap; }
public TaggedTextElementProvider(IContentType contentType, ITextClassifierAggregatorService textClassifierAggregatorService, IClassificationFormatMap classificationFormatMap) { if (contentType is null) { throw new ArgumentNullException(nameof(contentType)); } if (textClassifierAggregatorService is null) { throw new ArgumentNullException(nameof(textClassifierAggregatorService)); } classifierAggregator = textClassifierAggregatorService.Create(contentType); this.classificationFormatMap = classificationFormatMap ?? throw new ArgumentNullException(nameof(classificationFormatMap)); }
public CompletionClassifierAggregator(ITextClassifierAggregatorService textClassifierAggregatorService, ICompletionClassifier[] completionClassifiers) { if (textClassifierAggregatorService == null) { throw new ArgumentNullException(nameof(textClassifierAggregatorService)); } if (completionClassifiers == null) { throw new ArgumentNullException(nameof(completionClassifiers)); } this.textClassifierAggregator = textClassifierAggregatorService.Create(new ITextClassifier[] { new TextClassifier(this) }); this.completionClassifiers = completionClassifiers; }
public TaggedTextElementProvider(ITextClassifierAggregatorService textClassifierAggregatorService, IClassificationFormatMap classificationFormatMap, ITextClassifier[] classifiers) { if (textClassifierAggregatorService == null) { throw new ArgumentNullException(nameof(textClassifierAggregatorService)); } if (classificationFormatMap == null) { throw new ArgumentNullException(nameof(classificationFormatMap)); } if (classifiers == null) { throw new ArgumentNullException(nameof(classifiers)); } this.classifier = textClassifierAggregatorService.Create(classifiers); this.classificationFormatMap = classificationFormatMap; }