change so that if someone enters invalid command with args we strict match

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
pull/21833/head
Michael Telatynski 2018-06-20 17:21:06 +01:00
parent f5b12bd66a
commit 7d9d17145c
No known key found for this signature in database
GPG Key ID: 3F879DA5AD802A5E
1 changed files with 2 additions and 5 deletions

View File

@ -41,17 +41,14 @@ export default class CommandProvider extends AutocompleteProvider {
const {command, range} = this.getCurrentCommand(query, selection);
if (!command) return [];
let matches;
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];
}
}
// If we don't yet have matches
if (!matches) {
} else {
if (query === '/') {
// If they have just entered `/` show everything
matches = COMMANDS;