( command: TerminalActionId, promptType: TerminalActionPromptType, params: Record<string, string | any[]>, )
| 744 | } |
| 745 | |
| 746 | public static async handleTerminalAction( |
| 747 | command: TerminalActionId, |
| 748 | promptType: TerminalActionPromptType, |
| 749 | params: Record<string, string | any[]>, |
| 750 | ): Promise<void> { |
| 751 | TelemetryService.instance.captureCodeActionUsed(promptType) |
| 752 | |
| 753 | const visibleProvider = await ClineProvider.getInstance() |
| 754 | |
| 755 | if (!visibleProvider) { |
| 756 | return |
| 757 | } |
| 758 | |
| 759 | const { customSupportPrompts } = await visibleProvider.getState() |
| 760 | const prompt = supportPrompt.create(promptType, params, customSupportPrompts) |
| 761 | |
| 762 | if (command === "terminalAddToContext") { |
| 763 | await visibleProvider.postMessageToWebview({ |
| 764 | type: "invoke", |
| 765 | invoke: "setChatBoxMessage", |
| 766 | text: `${prompt}\n\n`, |
| 767 | }) |
| 768 | await visibleProvider.postMessageToWebview({ type: "action", action: "focusInput" }) |
| 769 | return |
| 770 | } |
| 771 | |
| 772 | try { |
| 773 | await visibleProvider.createTask(prompt) |
| 774 | } catch (error) { |
| 775 | if (error instanceof OrganizationAllowListViolationError) { |
| 776 | // Errors from terminal commands seem to get swallowed / ignored. |
| 777 | vscode.window.showErrorMessage(error.message) |
| 778 | } |
| 779 | |
| 780 | throw error |
| 781 | } |
| 782 | } |
| 783 | |
| 784 | async resolveWebviewView(webviewView: vscode.WebviewView | vscode.WebviewPanel) { |
| 785 | this.view = webviewView |
no test coverage detected