Ejemplo n.º 1
0
        public static ClassifiedTextElement ToClassifiedTextElement(
            this IEnumerable <TaggedText> parts,
            ITaggedTextMappingService mappingService)
        {
            var inlines = parts.ToClassifiedTextRuns(mappingService);

            return(inlines.ToClassifiedTextElement());
        }
Ejemplo n.º 2
0
 public ClassifiableDeferredContent(
     IList <TaggedText> content,
     ClassificationTypeMap typeMap,
     ITaggedTextMappingService mappingService)
 {
     this.ClassifiableContent = content;
     _typeMap        = typeMap;
     _mappingService = mappingService;
 }
Ejemplo n.º 3
0
        public static IList <ClassifiedTextRun> ToClassifiedTextRuns(
            this IEnumerable <TaggedText> parts,
            ITaggedTextMappingService mappingService)
        {
            var classifiedTexts = parts.Select(p =>
                                               new ClassifiedText(
                                                   p.Tag.ToClassificationTypeName(mappingService),
                                                   p.ToVisibleDisplayString(includeLeftToRightMarker: true)));

            return(classifiedTexts.ToClassifiedTextRuns());
        }
Ejemplo n.º 4
0
        public static TextBlock ToTextBlock(
            this IEnumerable <TaggedText> parts,
            ClassificationTypeMap typeMap,
            ITaggedTextMappingService mappingService,
            string classificationFormatMap = null)
        {
            classificationFormatMap = classificationFormatMap ?? "tooltip";

            var inlines = parts.ToInlines(typeMap, mappingService, classificationFormatMap);

            return(inlines.ToTextBlock(typeMap, classificationFormatMap));
        }
Ejemplo n.º 5
0
        public static IList <Inline> ToInlines(
            this IEnumerable <TaggedText> parts,
            ClassificationTypeMap typeMap,
            ITaggedTextMappingService mappingService,
            string classificationFormatMap = null)
        {
            var classifiedTexts = parts.Select(p =>
                                               new ClassifiedText(
                                                   p.Tag.ToClassificationTypeName(mappingService),
                                                   p.ToVisibleDisplayString(includeLeftToRightMarker: true)));

            return(classifiedTexts.ToInlines(typeMap, classificationFormatMap));
        }
Ejemplo n.º 6
0
        public static IEnumerable <ClassifiedSpan> ToClassifiedSpans(
            this IEnumerable <TaggedText> parts,
            ITaggedTextMappingService mappingService)
        {
            var index = 0;

            foreach (var part in parts)
            {
                var text = part.ToString();
                var classificationTypeName = part.Tag.ToClassificationTypeName(mappingService);

                yield return(new ClassifiedSpan(new TextSpan(index, text.Length), classificationTypeName));

                index += text.Length;
            }
        }
Ejemplo n.º 7
0
        public static IList <ClassificationSpan> ToClassificationSpans(
            this IEnumerable <TaggedText> parts,
            ITextSnapshot textSnapshot,
            ClassificationTypeMap typeMap,
            ITaggedTextMappingService mappingService)
        {
            var result = new List <ClassificationSpan>();

            var index = 0;

            foreach (var part in parts)
            {
                var text = part.ToString();
                result.Add(new ClassificationSpan(
                               new SnapshotSpan(textSnapshot, new Microsoft.VisualStudio.Text.Span(index, text.Length)),
                               typeMap.GetClassificationType(part.Tag.ToClassificationTypeName(mappingService))));

                index += text.Length;
            }

            return(result);
        }
#pragma warning restore 67

        public SignatureHelpClassifier(ITextBuffer subjectBuffer, ClassificationTypeMap typeMap)
        {
            _subjectBuffer            = subjectBuffer;
            _typeMap                  = typeMap;
            _taggedTextMappingService = PrimaryWorkspace.Workspace.Services.GetLanguageServices(LanguageNames.Hlsl).GetRequiredService <ITaggedTextMappingService>();
        }
Ejemplo n.º 9
0
 public static string ToClassificationTypeName(this string taggedTextTag, ITaggedTextMappingService mappingService)
 {
     return(mappingService.GetClassificationTypeName(taggedTextTag));
 }
Ejemplo n.º 10
0
 public static TextBlock ToTextBlock(this TaggedText part, ClassificationTypeMap typeMap, ITaggedTextMappingService mappingService)
 {
     return(SpecializedCollections.SingletonEnumerable(part).ToTextBlock(typeMap, mappingService));
 }