public bool?MatchesFilterText(CompletionItem item, string filterText, CompletionTriggerInfo triggerInfo, CompletionFilterReason filterReason)
            {
                // If the user hasn't typed anything, and this item was preselected, or was in the
                // MRU list, then we definitely want to include it.
                if (filterText.Length == 0)
                {
                    if (item.Preselect || _completionService.GetMRUIndex(item) < 0)
                    {
                        return(true);
                    }
                }

                if (IsAllDigits(filterText))
                {
                    // The user is just typing a number.  We never want this to match against
                    // anything we would put in a completion list.
                    return(false);
                }

                var match = _patternMatcher.MatchPatternFirstOrNullable(
                    _completionService.GetCultureSpecificQuirks(item.FilterText),
                    _completionService.GetCultureSpecificQuirks(filterText));

                return(match != null);
            }
示例#2
0
        protected PatternMatch?GetMatch(CompletionItem item, string filterText)
        {
            var patternMatcher = this.GetPatternMatcher(_completionService.GetCultureSpecificQuirks(filterText), CultureInfo.CurrentCulture);
            var match          = patternMatcher.GetFirstMatch(_completionService.GetCultureSpecificQuirks(item.FilterText));

            if (match != null)
            {
                return(match);
            }

            // Start with the culture-specific comparison, and fall back to en-US.
            if (!CultureInfo.CurrentCulture.Equals(EnUSCultureInfo))
            {
                patternMatcher = this.GetFallbackPatternMatcher(_completionService.GetCultureSpecificQuirks(filterText));
                match          = patternMatcher.GetFirstMatch(_completionService.GetCultureSpecificQuirks(item.FilterText));
                if (match != null)
                {
                    return(match);
                }
            }

            return(null);
        }