Skip to content

Commit

Permalink
Bugfix for /comment slash command which does nothing. (#1512)
Browse files Browse the repository at this point in the history
* - fixed a bug where /comment doesn't actually do anything unless prompted to.
- if the user doesn't provide input after /comment, replace it with default /comment input found in comment.ts

* added comment for clarity
  • Loading branch information
maxxrdrgz authored Jun 19, 2024
1 parent feb7658 commit a3b5146
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions core/commands/slash/edit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,20 @@ const EditSlashCommand: SlashCommand = {
part.text = part.text.replace("/edit", "").trimStart();
}
});
} else {
} else if (input?.startsWith("/edit")) {
content = input.replace("/edit", "").trimStart();
} else if (input?.startsWith("/comment")) {
content = input.replace("/comment", "").trimStart();
}
const userInput = stripImages(content).replace(
let userInput = stripImages(content).replace(
`\`\`\`${contextItemToEdit.name}\n${contextItemToEdit.content}\n\`\`\`\n`,
"",
);
// if the above replace fails to find a match, the code will still be present
// in the userInput. Replace it with input if available.
if (userInput.includes("\`\`\`") && (input !== "" || !input)) {
userInput = input;
}

const rif: RangeInFileWithContents =
contextItemToRangeInFileWithContents(contextItemToEdit);
Expand Down

0 comments on commit a3b5146

Please sign in to comment.