Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/SlashCommands.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ import SettingsStore, {SettingLevel} from './settings/SettingsStore';

class Command {
constructor({name, args='', description, runFn}) {
this.command = name;
this.command = '/' + name;
this.args = args;
this.description = description;
this.runFn = runFn;
}

getCommand() {
return "/" + this.command;
return this.command;
}

getCommandWithArgs() {
Expand Down
13 changes: 5 additions & 8 deletions src/autocomplete/CommandProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
const name = command[1].substr(1); // strip leading `/`
if (CommandMap[name]) {
matches = [CommandMap[name]];
}
}

// If we don't yet have matches
if (!matches) {
} else {
if (query === '/') {
// If they have just entered `/` show everything
matches = COMMANDS;
Expand Down