public LibraryNodeVisitor(PythonToolsService pyService, PythonNavigateToItemProvider itemProvider, INavigateToCallback navCallback, string searchValue) { _pyService = pyService; _itemProvider = itemProvider; _navCallback = navCallback; _searchValue = searchValue; _path.Push(null); _comparer = new FuzzyStringMatcher(_pyService.AdvancedOptions.SearchMode); _regexComparer = new FuzzyStringMatcher(FuzzyMatchMode.RegexIgnoreCase); }
/// <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> /// <param name="matchInsertionText">If true, matches user input against /// the insertion text; otherwise, uses the display text.</param> public FuzzyCompletionSet( string moniker, string displayName, ITrackingSpan applicableTo, IEnumerable <DynamicallyVisibleCompletion> completions, CompletionOptions options, IComparer <Completion> comparer, bool matchInsertionText = false ) : base(moniker, displayName, applicableTo, null, null) { _matchInsertionText = matchInsertionText; _completions = new BulkObservableCollection <Completion>(); _completions.AddRange(completions .Where(c => c != null && !string.IsNullOrWhiteSpace(c.DisplayText)) .OrderBy(c => c, comparer) ); _comparer = new FuzzyStringMatcher(options.SearchMode); _shouldFilter = options.FilterCompletions; _shouldHideAdvanced = options.HideAdvancedMembers && !_completions.All(IsAdvanced); if (!_completions.Any()) { _completions = null; } if (_completions != null && _shouldFilter | _shouldHideAdvanced) { _filteredCompletions = new FilteredObservableCollection <Completion>(_completions); foreach (var c in _completions.Cast <DynamicallyVisibleCompletion>()) { c.Visible = !_shouldHideAdvanced || !IsAdvanced(c); } _filteredCompletions.Filter(IsVisible); } CommitByDefault = DefaultCommitByDefault; }
/// <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> /// <param name="matchInsertionText">If true, matches user input against /// the insertion text; otherwise, uses the display text.</param> public FuzzyCompletionSet( string moniker, string displayName, ITrackingSpan applicableTo, IEnumerable<DynamicallyVisibleCompletion> completions, CompletionOptions options, IComparer<Completion> comparer, bool matchInsertionText = false ) : base(moniker, displayName, applicableTo, null, null) { _matchInsertionText = matchInsertionText; _completions = new BulkObservableCollection<Completion>(); _completions.AddRange(completions .Where(c => c != null && !string.IsNullOrWhiteSpace(c.DisplayText)) .OrderBy(c => c, comparer) ); _comparer = new FuzzyStringMatcher(options.SearchMode); _shouldFilter = options.FilterCompletions; _shouldHideAdvanced = options.HideAdvancedMembers && !_completions.All(IsAdvanced); if (!_completions.Any()) { _completions = null; } if (_completions != null && _shouldFilter | _shouldHideAdvanced) { _filteredCompletions = new FilteredObservableCollection<Completion>(_completions); foreach (var c in _completions.Cast<DynamicallyVisibleCompletion>()) { c.Visible = !_shouldHideAdvanced || !IsAdvanced(c); } _filteredCompletions.Filter(IsVisible); } CommitByDefault = DefaultCommitByDefault; }