111
112
registerSlashCommand(data: IChatSlashData, command: IChatSlashCallback): IDisposable {
114
>
if (commandsForId.some(candidate => this.commandsOverlap(candidate.data, data))) {
115
throw new Error(`Already registered a command with id ${data.command}`);
116
}
118
>
const entry = { data, command };
119
>
commandsForId.push(entry);
120
>
this._commands.set(data.command, commandsForId);
121
>
this._onDidChangeCommands.fire();
122
>
123
>
return toDisposable(() => {
124
>
const commandsForId = this._commands.get(data.command);
125
>
if (!commandsForId) {
126
>
return;
127
>
}
128
129
const entryIndex = commandsForId.indexOf(entry);