fix: try sendTextToChat with false param (plain text) first, fix try/catch structure

This commit is contained in:
2026-03-07 16:17:53 +09:00
parent e4eb7565ea
commit c688812089

View File

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