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
|
// General text: use Antigravity native API to send to chat
|
||||||
try {
|
// Try false first (plain text), then true (tagged text)
|
||||||
await vscode.commands.executeCommand('antigravity.sendTextToChat', true, command.text);
|
let sent = false;
|
||||||
console.log(`Gravity Bridge: ✅ sent via antigravity.sendTextToChat: "${command.text.substring(0, 50)}"`);
|
for (const flag of [false, true]) {
|
||||||
} catch (e) {
|
try {
|
||||||
console.log(`Gravity Bridge: antigravity.sendTextToChat failed: ${e}, trying fallback`);
|
await vscode.commands.executeCommand('antigravity.sendTextToChat', flag, command.text);
|
||||||
// Fallback: open chat with query parameter
|
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 {
|
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');
|
||||||
|
|||||||
Reference in New Issue
Block a user