Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
commit
0c38f9aa40
2 changed files with 7 additions and 10 deletions
|
@ -27,14 +27,14 @@ import SettingsStore, {SettingLevel} from './settings/SettingsStore';
|
||||||
|
|
||||||
class Command {
|
class Command {
|
||||||
constructor({name, args='', description, runFn}) {
|
constructor({name, args='', description, runFn}) {
|
||||||
this.command = name;
|
this.command = '/' + name;
|
||||||
this.args = args;
|
this.args = args;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
this.runFn = runFn;
|
this.runFn = runFn;
|
||||||
}
|
}
|
||||||
|
|
||||||
getCommand() {
|
getCommand() {
|
||||||
return "/" + this.command;
|
return this.command;
|
||||||
}
|
}
|
||||||
|
|
||||||
getCommandWithArgs() {
|
getCommandWithArgs() {
|
||||||
|
|
|
@ -41,17 +41,14 @@ export default class CommandProvider extends AutocompleteProvider {
|
||||||
const {command, range} = this.getCurrentCommand(query, selection);
|
const {command, range} = this.getCurrentCommand(query, selection);
|
||||||
if (!command) return [];
|
if (!command) return [];
|
||||||
|
|
||||||
let matches;
|
let matches = [];
|
||||||
if (command[0] !== command[1]) {
|
if (command[0] !== command[1]) {
|
||||||
// The input looks like a command with arguments, perform exact match
|
// The input looks like a command with arguments, perform exact match
|
||||||
const match = COMMANDS.find((o) => o.command === command[1]);
|
const name = command[1].substr(1); // strip leading `/`
|
||||||
if (match) {
|
if (CommandMap[name]) {
|
||||||
matches = [match];
|
matches = [CommandMap[name]];
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
|
|
||||||
// If we don't yet have matches
|
|
||||||
if (!matches) {
|
|
||||||
if (query === '/') {
|
if (query === '/') {
|
||||||
// If they have just entered `/` show everything
|
// If they have just entered `/` show everything
|
||||||
matches = COMMANDS;
|
matches = COMMANDS;
|
||||||
|
|
Loading…
Reference in a new issue