From ed8f923b7af0d0bcd8237d44401e8a97f3b85dd4 Mon Sep 17 00:00:00 2001 From: LenAnderson Date: Thu, 20 Jun 2024 15:52:26 -0400 Subject: [PATCH] add /breakpoint to command list and block it --- public/scripts/slash-commands/SlashCommandParser.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/public/scripts/slash-commands/SlashCommandParser.js b/public/scripts/slash-commands/SlashCommandParser.js index 2b90c2625..ad176b80f 100644 --- a/public/scripts/slash-commands/SlashCommandParser.js +++ b/public/scripts/slash-commands/SlashCommandParser.js @@ -51,7 +51,7 @@ export class SlashCommandParser { * @param {SlashCommand} command */ static addCommandObject(command) { - const reserved = ['/', '#', ':', 'parser-flag']; + const reserved = ['/', '#', ':', 'parser-flag', 'breakpoint']; for (const start of reserved) { if (command.name.toLowerCase().startsWith(start) || (command.aliases ?? []).find(a=>a.toLowerCase().startsWith(start))) { throw new Error(`Illegal Name. Slash command name cannot begin with "${start}".`); @@ -153,6 +153,11 @@ export class SlashCommandParser { helpString: 'Write a comment.', })); } + if (!Object.keys(this.commands).includes('breakpoint')) { + SlashCommandParser.addCommandObjectUnsafe(SlashCommand.fromProps({ name: 'breakpoint', + helpString: 'Set a breakpoint for debugging in the QR Editor.', + })); + } //TODO should not be re-registered from every instance this.registerLanguage();