From 884fa3b9139a078310ed9a6162ad06c7306c8b2d Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 20 Jun 2018 17:25:23 +0100 Subject: [PATCH] use existing command hashmap over linear array search Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/autocomplete/CommandProvider.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/autocomplete/CommandProvider.js b/src/autocomplete/CommandProvider.js index 4b24e98605..891ef97d65 100644 --- a/src/autocomplete/CommandProvider.js +++ b/src/autocomplete/CommandProvider.js @@ -44,9 +44,9 @@ export default class CommandProvider extends AutocompleteProvider { let matches = []; if (command[0] !== command[1]) { // The input looks like a command with arguments, perform exact match - const match = COMMANDS.find((o) => o.command === command[1]); - if (match) { - matches = [match]; + const name = command[1].substr(1); // strip leading `/` + if (CommandMap[name]) { + matches = [CommandMap[name]]; } } else { if (query === '/') {