continue
continue copied to clipboard
contextItems always empty with custom slash commands
Before submitting your bug report
- [x] I believe this is a bug. I'll try to join the Continue Discord for questions
- [x] I'm not able to find an open issue that reports the same bug
- [x] I've seen the troubleshooting guide on the Continue Docs
Relevant environment info
- Continue: 0.9.58
- Version: 1.85.2 (system setup)
- Commit: 8b3775030ed1a69b13e4f4c628c612102e30a681
- Date: 2024-01-18T06:40:10.514Z
- Electron: 25.9.7
- ElectronBuildId: 26354273
- Chromium: 114.0.5735.289
- Node.js: 18.15.0
- V8: 11.4.183.29-electron.0
- OS: Windows_NT x64 10.0.19045
Description
I need to resolve current selected code in a custom slash command. I've reused what is implemented in edit.ts, but surprisingly it doesn't work. I've tried to debug, but I failed at understanding why the gui is only sending the contextItems when /edit
used, but not if /mycommand
is used.
I'd suggest to provide one more parameter selectedCode
, just like you did for context providers. Also, my custom command needs to use edit (it does some prep work and then invokes edit slash command, just like you did for several commands)... but accessing the edit requires a hack (I am providing the config.slashCommands
array to my custom slash command in config.ts
. Making the config accessible as one more argument in the run
method of SlashCommand
would be great... so to summarize please add these two arguments: selectedCode
and config
, please!
To reproduce
Create the following slash command:
export const MyCommand: SlashCommand = {
name: "mycommand",
description: "mycommand",
run: async function* (sdk) {
let contextItemToEdit = sdk.contextItems.find(
(item: ContextItemWithId) =>
item.editing && item.id.providerTitle === "code"
);
if (!contextItemToEdit) {
contextItemToEdit = sdk.contextItems.find(
(item: ContextItemWithId) => item.id.providerTitle === "code"
);
}
if (!contextItemToEdit) {
yield "This is always what's happening, unfortunately.";
return;
}
Log output
No response
@frblondin just made the changes here. Will likely not make their way into pre-release until later tomorrow, as I'm hoping to merge together with a larger set of updates
Thanks @sestinj