fix: try sendTextToChat with false param (plain text) first, fix try/catch structure
This commit is contained in:
@@ -264,12 +264,19 @@ async function handleCommand(filePath: string) {
|
||||
}
|
||||
|
||||
// General text: use Antigravity native API to send to chat
|
||||
try {
|
||||
await vscode.commands.executeCommand('antigravity.sendTextToChat', true, command.text);
|
||||
console.log(`Gravity Bridge: ✅ sent via antigravity.sendTextToChat: "${command.text.substring(0, 50)}"`);
|
||||
} catch (e) {
|
||||
console.log(`Gravity Bridge: antigravity.sendTextToChat failed: ${e}, trying fallback`);
|
||||
// Fallback: open chat with query parameter
|
||||
// Try false first (plain text), then true (tagged text)
|
||||
let sent = false;
|
||||
for (const flag of [false, true]) {
|
||||
try {
|
||||
await vscode.commands.executeCommand('antigravity.sendTextToChat', flag, command.text);
|
||||
console.log(`Gravity Bridge: ✅ sent via antigravity.sendTextToChat(${flag}): "${command.text.substring(0, 50)}"`);
|
||||
sent = true;
|
||||
break;
|
||||
} catch (e) {
|
||||
console.log(`Gravity Bridge: sendTextToChat(${flag}) failed: ${e}`);
|
||||
}
|
||||
}
|
||||
if (!sent) {
|
||||
try {
|
||||
await vscode.commands.executeCommand('workbench.action.chat.open', { query: command.text });
|
||||
console.log('Gravity Bridge: fallback to workbench.action.chat.open with query');
|
||||
|
||||
Reference in New Issue
Block a user