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.env.clipboard.writeText(command.text);
|
||||||
await vscode.commands.executeCommand('editor.action.clipboardPasteAction');
|
await vscode.commands.executeCommand('editor.action.clipboardPasteAction');
|
||||||
await vscode.env.clipboard.writeText(oldClipboard);
|
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
|
// Try to submit: carriage return, then keyboard Enter simulation
|
||||||
const allCmds = await vscode.commands.getCommands(true);
|
let submitted = false;
|
||||||
const chatCmds = allCmds.filter(c =>
|
const submitMethods = [
|
||||||
c.includes('chat') && (c.includes('accept') || c.includes('submit') || c.includes('send') || c.includes('enter'))
|
{ cmd: 'type', args: { text: '\r' } }, // carriage return
|
||||||
);
|
{ cmd: 'default:Enter', args: undefined }, // Enter keybinding
|
||||||
console.log(`Gravity Bridge: available chat submit commands: ${JSON.stringify(chatCmds)}`);
|
{ cmd: 'type', args: { text: '\u000d' } }, // CR unicode
|
||||||
|
|
||||||
// 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
|
|
||||||
];
|
];
|
||||||
|
for (const { cmd, args } of submitMethods) {
|
||||||
for (const cmd of submitAttempts) {
|
|
||||||
try {
|
try {
|
||||||
await vscode.commands.executeCommand(cmd);
|
await vscode.commands.executeCommand(cmd, args);
|
||||||
console.log(`Gravity Bridge: ✅ submitted with "${cmd}"`);
|
console.log(`Gravity Bridge: ✅ Enter sent via "${cmd}"`);
|
||||||
|
submitted = true;
|
||||||
break;
|
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