({
context,
outputChannel,
provider,
}: RegisterCommandOptions)
| 86 | // args dynamically. |
| 87 | type CommandCallback = (...args: any[]) => unknown |
| 88 | const getCommandsMap = ({ |
| 89 | context, |
| 90 | outputChannel, |
| 91 | provider, |
| 92 | }: RegisterCommandOptions): Record<Exclude<CommandId, "showRipgrepDiagnostic">, CommandCallback> => ({ |
| 93 | activationCompleted: () => {}, |
| 94 | plusButtonClicked: async () => { |
| 95 | const visibleProvider = getVisibleProviderOrLog(outputChannel) |
| 96 | |
| 97 | if (!visibleProvider) { |
| 98 | return |
| 99 | } |
| 100 | |
| 101 | TelemetryService.instance.captureTitleButtonClicked("plus") |
| 102 | |
| 103 | await visibleProvider.removeClineFromStack() |
| 104 | await visibleProvider.refreshWorkspace() |
| 105 | await visibleProvider.postMessageToWebview({ type: "action", action: "chatButtonClicked" }) |
| 106 | // Send focusInput action immediately after chatButtonClicked |
| 107 | // This ensures the focus happens after the view has switched |
| 108 | await visibleProvider.postMessageToWebview({ type: "action", action: "focusInput" }) |
| 109 | }, |
| 110 | popoutButtonClicked: () => { |
| 111 | TelemetryService.instance.captureTitleButtonClicked("popout") |
| 112 | |
| 113 | return openClineInNewTab({ context, outputChannel }) |
| 114 | }, |
| 115 | openInNewTab: () => openClineInNewTab({ context, outputChannel }), |
| 116 | settingsButtonClicked: () => { |
| 117 | const visibleProvider = getVisibleProviderOrLog(outputChannel) |
| 118 | |
| 119 | if (!visibleProvider) { |
| 120 | return |
| 121 | } |
| 122 | |
| 123 | TelemetryService.instance.captureTitleButtonClicked("settings") |
| 124 | |
| 125 | void visibleProvider |
| 126 | .postMessageToWebview({ type: "action", action: "settingsButtonClicked" }) |
| 127 | .catch((error) => outputChannel.appendLine(`[settingsButtonClicked] postMessageToWebview failed: ${error}`)) |
| 128 | // Also explicitly post the visibility message to trigger scroll reliably |
| 129 | void visibleProvider |
| 130 | .postMessageToWebview({ type: "action", action: "didBecomeVisible" }) |
| 131 | .catch((error) => outputChannel.appendLine(`[settingsButtonClicked] postMessageToWebview failed: ${error}`)) |
| 132 | }, |
| 133 | historyButtonClicked: () => { |
| 134 | const visibleProvider = getVisibleProviderOrLog(outputChannel) |
| 135 | |
| 136 | if (!visibleProvider) { |
| 137 | return |
| 138 | } |
| 139 | |
| 140 | TelemetryService.instance.captureTitleButtonClicked("history") |
| 141 | |
| 142 | void visibleProvider |
| 143 | .postMessageToWebview({ type: "action", action: "historyButtonClicked" }) |
| 144 | .catch((error) => outputChannel.appendLine(`[historyButtonClicked] postMessageToWebview failed: ${error}`)) |
| 145 | }, |
no test coverage detected