( command: CodeActionId, promptType: CodeActionName, params: Record<string, string | any[]>, )
| 712 | } |
| 713 | |
| 714 | public static async handleCodeAction( |
| 715 | command: CodeActionId, |
| 716 | promptType: CodeActionName, |
| 717 | params: Record<string, string | any[]>, |
| 718 | ): Promise<void> { |
| 719 | // Capture telemetry for code action usage |
| 720 | TelemetryService.instance.captureCodeActionUsed(promptType) |
| 721 | |
| 722 | const visibleProvider = await ClineProvider.getInstance() |
| 723 | |
| 724 | if (!visibleProvider) { |
| 725 | return |
| 726 | } |
| 727 | |
| 728 | const { customSupportPrompts } = await visibleProvider.getState() |
| 729 | |
| 730 | // TODO: Improve type safety for promptType. |
| 731 | const prompt = supportPrompt.create(promptType, params, customSupportPrompts) |
| 732 | |
| 733 | if (command === "addToContext") { |
| 734 | await visibleProvider.postMessageToWebview({ |
| 735 | type: "invoke", |
| 736 | invoke: "setChatBoxMessage", |
| 737 | text: `${prompt}\n\n`, |
| 738 | }) |
| 739 | await visibleProvider.postMessageToWebview({ type: "action", action: "focusInput" }) |
| 740 | return |
| 741 | } |
| 742 | |
| 743 | await visibleProvider.createTask(prompt) |
| 744 | } |
| 745 | |
| 746 | public static async handleTerminalAction( |
| 747 | command: TerminalActionId, |
no test coverage detected