예제 #1
0
        public VSCommandShortcuts Filter(VSCommandShortcuts commands)
        {
            var result = commands
                         .Where(command => command.CommandText.IndexOf(this.searchCriteria, this.stringComparison) >= 0);

            return(new VSCommandShortcuts(result));
        }
예제 #2
0
        public VSCommandShortcuts Filter(VSCommandShortcuts commands)
        {
            var result = commands
                         .Select(command => (command: command, match: patternMatcher.TryMatch(command.CommandText)))
                         .Where(tuple => tuple.match != null)
                         .OrderBy(tuple => tuple.match)
                         .Select(tuple => tuple.command);

            return(new VSCommandShortcuts(result));
        }
예제 #3
0
        public uint SearchCommands(string searchCriteria, bool matchCase = true)
        {
            if (string.IsNullOrWhiteSpace(searchCriteria))
            {
                return(0);
            }

            var commandsFilter = new CommandsFilterFactory().GetCommandsFilter(searchCriteria, matchCase);

            this.Commands = commandsFilter.Filter(this.allCommandsCache);

            return((uint)this.Commands.Count);
        }
        private void PopulateCommands(IServiceProvider serviceProvider)
        {
            var queryEngine = new VSShortcutQueryEngine(serviceProvider);

            queryEngine.GetAllCommandsAsync().ContinueWith((task) =>
            {
                var allCommands = task.Result;

                var allCommandShortcuts = allCommands
                                          .Where(command => !string.IsNullOrWhiteSpace(command?.CanonicalName))
                                          .SelectMany(command => GenerateCommandsShortcuts(command));

                this.allCommands = new VSCommandShortcuts(allCommandShortcuts);
                this.Commands    = this.allCommands.Clone();
            });
        }
예제 #5
0
        private void PopulateCommands()
        {
            queryEngine.GetAllCommandsAsync().ContinueWith((task) =>
            {
                // Pull all command shortcuts into a temporary var
                IEnumerable <Command> allCommands = task.Result;

                // Remove all commands with no valid name
                // and convert them to the CommandShortcut objects
                IEnumerable <CommandShortcut> allCommandShortcuts = allCommands
                                                                    .Where(command => !string.IsNullOrWhiteSpace(command?.CanonicalName))
                                                                    .SelectMany(command => GenerateCommandsShortcuts(command));

                // Update the local commands cache
                this.allCommandsCache = new VSCommandShortcuts(allCommandShortcuts);

                // Update the backing object on the Toolwindow control (with a clone of the cache)
                this.Commands = this.allCommandsCache.Clone();
            });
        }
예제 #6
0
 public void ClearSearch()
 {
     this.Commands = this.allCommandsCache.Clone();
 }