fix: try carriage return and Enter keybinding for chat submit
This commit is contained in:
@@ -289,30 +289,27 @@ async function handleCommand(filePath: string) {
|
||||
await vscode.env.clipboard.writeText(command.text);
|
||||
await vscode.commands.executeCommand('editor.action.clipboardPasteAction');
|
||||
await vscode.env.clipboard.writeText(oldClipboard);
|
||||
await new Promise(resolve => setTimeout(resolve, 200));
|
||||
await new Promise(resolve => setTimeout(resolve, 300));
|
||||
|
||||
// Debug: discover all available chat/submit commands
|
||||
const allCmds = await vscode.commands.getCommands(true);
|
||||
const chatCmds = allCmds.filter(c =>
|
||||
c.includes('chat') && (c.includes('accept') || c.includes('submit') || c.includes('send') || c.includes('enter'))
|
||||
);
|
||||
console.log(`Gravity Bridge: available chat submit commands: ${JSON.stringify(chatCmds)}`);
|
||||
|
||||
// Try every possible submit command
|
||||
const submitAttempts = [
|
||||
'workbench.action.chat.acceptInput',
|
||||
'workbench.action.chat.submit',
|
||||
'workbench.action.chat.sendInput',
|
||||
'workbench.action.chat.send',
|
||||
...chatCmds, // Also try dynamically discovered ones
|
||||
// Try to submit: carriage return, then keyboard Enter simulation
|
||||
let submitted = false;
|
||||
const submitMethods = [
|
||||
{ cmd: 'type', args: { text: '\r' } }, // carriage return
|
||||
{ cmd: 'default:Enter', args: undefined }, // Enter keybinding
|
||||
{ cmd: 'type', args: { text: '\u000d' } }, // CR unicode
|
||||
];
|
||||
|
||||
for (const cmd of submitAttempts) {
|
||||
for (const { cmd, args } of submitMethods) {
|
||||
try {
|
||||
await vscode.commands.executeCommand(cmd);
|
||||
console.log(`Gravity Bridge: ✅ submitted with "${cmd}"`);
|
||||
await vscode.commands.executeCommand(cmd, args);
|
||||
console.log(`Gravity Bridge: ✅ Enter sent via "${cmd}"`);
|
||||
submitted = true;
|
||||
break;
|
||||
} catch { /* try next */ }
|
||||
} catch (e) {
|
||||
console.log(`Gravity Bridge: "${cmd}" failed: ${e}`);
|
||||
}
|
||||
}
|
||||
if (!submitted) {
|
||||
console.log('Gravity Bridge: ⚠️ all submit methods failed — text pasted but not submitted');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user