From d4c778b440570b3ff93f0f2aa787a5adf485ee07 Mon Sep 17 00:00:00 2001 From: Barrca <60709314+FBarrca@users.noreply.github.com> Date: Thu, 30 Jan 2025 13:02:10 -0800 Subject: [PATCH] Moved the command prefix to the top --- src/settings.ts | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/settings.ts b/src/settings.ts index d195416..eae7dc8 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -138,7 +138,21 @@ export class InlineAISettingsTab extends PluginSettingTab { // Custom Commands Section containerEl.createEl("h3", { text: "Custom Commands" }); - containerEl.createEl("p", { text: "Add your own custom commands. Triggered with /" }); + containerEl.createEl("p", { text: "Add your own custom commands. Triggered with the prefix defined in the Command Prefix setting." }); + + // Command Prefix setting + new Setting(containerEl) + .setName("Command Prefix") + .setDesc("The prefix used to trigger custom commands (e.g., /, !, #)") + .addText((text) => { + text.setPlaceholder("/") + .setValue(this.plugin.settings.commandPrefix) + .inputEl.addEventListener("blur", async () => { + this.plugin.settings.commandPrefix = text.getValue().charAt(0); + await this.saveSettings(); + this.display(); + }); + }); // Display existing commands this.plugin.settings.customCommands.forEach((command, index) => { @@ -173,19 +187,7 @@ export class InlineAISettingsTab extends PluginSettingTab { ); }); - // Command Prefix setting - new Setting(containerEl) - .setName("Command Prefix") - .setDesc("The prefix used to trigger custom commands (e.g., /, !, #)") - .addText((text) => { - text.setPlaceholder("/") - .setValue(this.plugin.settings.commandPrefix) - .inputEl.addEventListener("blur", async () => { - this.plugin.settings.commandPrefix = text.getValue().charAt(0); - await this.saveSettings(); - this.display(); - }); - }); + // Add new command button new Setting(containerEl).addButton((btn) =>