Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 884fa3b

Browse files
committed
use existing command hashmap over linear array search
Signed-off-by: Michael Telatynski <[email protected]>
1 parent 7d9d171 commit 884fa3b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/autocomplete/CommandProvider.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ export default class CommandProvider extends AutocompleteProvider {
4444
let matches = [];
4545
if (command[0] !== command[1]) {
4646
// The input looks like a command with arguments, perform exact match
47-
const match = COMMANDS.find((o) => o.command === command[1]);
48-
if (match) {
49-
matches = [match];
47+
const name = command[1].substr(1); // strip leading `/`
48+
if (CommandMap[name]) {
49+
matches = [CommandMap[name]];
5050
}
5151
} else {
5252
if (query === '/') {

0 commit comments

Comments
 (0)