Example #1
0
        private static IEnumerable <CompletionItemWithHighlight> GetHighlightedList(
            IEnumerable <ExtendedFilterResult> filterResults,
            string filterText,
            CompletionHelper completionHelper,
            bool highlightMatchingPortions)
        {
            var highlightedList = new List <CompletionItemWithHighlight>();

            foreach (var item in filterResults)
            {
                var highlightedSpans = highlightMatchingPortions
                    ? completionHelper.GetHighlightedSpans(item.VSCompletionItem.DisplayText, filterText, CultureInfo.CurrentCulture)
                    : ImmutableArray <TextSpan> .Empty;
                highlightedList.Add(new CompletionItemWithHighlight(item.VSCompletionItem, highlightedSpans.Select(s => s.ToSpan()).ToImmutableArray()));
            }

            return(highlightedList);
        }