Beispiel #1
0
        /// <summary>
        /// Initializes a new instance with the specified properties.
        /// </summary>
        /// <param name="moniker">The unique, non-localized identifier for the
        /// completion set.</param>
        /// <param name="displayName">The localized name of the completion set.
        /// </param>
        /// <param name="applicableTo">The tracking span to which the
        /// completions apply.</param>
        /// <param name="completions">The list of completions.</param>
        /// <param name="options">The options to use for filtering and
        /// selecting items.</param>
        /// <param name="comparer">The comparer to use to order the provided
        /// completions.</param>
        public FuzzyCompletionSet(string moniker, string displayName, ITrackingSpan applicableTo, IEnumerable<DynamicallyVisibleCompletion> completions, CompletionOptions options, IComparer<Completion> comparer)
            : base(moniker, displayName, applicableTo, null, null)
        {
            _completions = new BulkObservableCollection<Completion>();
            _completions.AddRange(completions.OrderBy(c => c, comparer));
            _comparer = new FuzzyStringMatcher(options.SearchMode);

            _shouldFilter = options.FilterCompletions;
            _shouldHideAdvanced = options.HideAdvancedMembers;

            if (_shouldFilter | _shouldHideAdvanced) {
                _filteredCompletions = new FilteredObservableCollection<Completion>(_completions);

                foreach (var c in _completions.Cast<DynamicallyVisibleCompletion>()) {
                    c.Visible = !_shouldHideAdvanced || !IsAdvanced(c);
                }
                _filteredCompletions.Filter(IsVisible);
            }
        }
Beispiel #2
0
 public LibraryNodeVisitor(JNavigateToItemProvider itemProvider, INavigateToCallback navCallback, string searchValue)
 {
     _itemProvider = itemProvider;
     _navCallback = navCallback;
     _searchValue = searchValue;
     _path.Push(null);
     _comparer = new FuzzyStringMatcher(JToolsPackage.Instance.AdvancedEditorOptionsPage.SearchMode);
     _regexComparer = new FuzzyStringMatcher(FuzzyMatchMode.RegexIgnoreCase);
 }