|
1 | 1 | import * as vscode from "vscode" |
2 | | -import delay from "delay" |
3 | 2 |
|
4 | 3 | import type { CommandId } from "@roo-code/types" |
5 | 4 | import { TelemetryService } from "@roo-code/telemetry" |
6 | 5 |
|
7 | 6 | import { Package } from "../shared/package" |
8 | 7 | import { getCommand } from "../utils/commands" |
9 | 8 | import { ClineProvider } from "../core/webview/ClineProvider" |
10 | | -import { ContextProxy } from "../core/config/ContextProxy" |
11 | 9 | import { focusPanel } from "../utils/focusPanel" |
12 | 10 |
|
13 | 11 | import { registerHumanRelayCallback, unregisterHumanRelayCallback, handleHumanRelayResponse } from "./humanRelay" |
14 | 12 | import { handleNewTask } from "./handleTask" |
15 | | -import { CodeIndexManager } from "../services/code-index/manager" |
16 | 13 | import { importSettingsWithFeedback } from "../core/config/importExport" |
17 | | -import { MdmService } from "../services/mdm/MdmService" |
18 | | -import { t } from "../i18n" |
19 | 14 |
|
20 | 15 | /** |
21 | 16 | * Helper to get the visible ClineProvider instance or log if not found. |
@@ -123,12 +118,6 @@ const getCommandsMap = ({ context, outputChannel, provider }: RegisterCommandOpt |
123 | 118 |
|
124 | 119 | visibleProvider.postMessageToWebview({ type: "action", action: "promptsButtonClicked" }) |
125 | 120 | }, |
126 | | - popoutButtonClicked: () => { |
127 | | - TelemetryService.instance.captureTitleButtonClicked("popout") |
128 | | - |
129 | | - return openClineInNewTab({ context, outputChannel }) |
130 | | - }, |
131 | | - openInNewTab: () => openClineInNewTab({ context, outputChannel }), |
132 | 121 | settingsButtonClicked: () => { |
133 | 122 | const visibleProvider = getVisibleProviderOrLog(outputChannel) |
134 | 123 |
|
@@ -234,79 +223,3 @@ const getCommandsMap = ({ context, outputChannel, provider }: RegisterCommandOpt |
234 | 223 | }) |
235 | 224 | }, |
236 | 225 | }) |
237 | | - |
238 | | -export const openClineInNewTab = async ({ context, outputChannel }: Omit<RegisterCommandOptions, "provider">) => { |
239 | | - // (This example uses webviewProvider activation event which is necessary to |
240 | | - // deserialize cached webview, but since we use retainContextWhenHidden, we |
241 | | - // don't need to use that event). |
242 | | - // https://github.com/microsoft/vscode-extension-samples/blob/main/webview-sample/src/extension.ts |
243 | | - const contextProxy = await ContextProxy.getInstance(context) |
244 | | - const codeIndexManager = CodeIndexManager.getInstance(context) |
245 | | - |
246 | | - // Get the existing MDM service instance to ensure consistent policy enforcement |
247 | | - let mdmService: MdmService | undefined |
248 | | - try { |
249 | | - mdmService = MdmService.getInstance() |
250 | | - } catch (error) { |
251 | | - // MDM service not initialized, which is fine - extension can work without it |
252 | | - mdmService = undefined |
253 | | - } |
254 | | - |
255 | | - const tabProvider = new ClineProvider(context, outputChannel, "editor", contextProxy, mdmService) |
256 | | - const lastCol = Math.max(...vscode.window.visibleTextEditors.map((editor) => editor.viewColumn || 0)) |
257 | | - |
258 | | - // Check if there are any visible text editors, otherwise open a new group |
259 | | - // to the right. |
260 | | - const hasVisibleEditors = vscode.window.visibleTextEditors.length > 0 |
261 | | - |
262 | | - if (!hasVisibleEditors) { |
263 | | - await vscode.commands.executeCommand("workbench.action.newGroupRight") |
264 | | - } |
265 | | - |
266 | | - const targetCol = hasVisibleEditors ? Math.max(lastCol + 1, 1) : vscode.ViewColumn.Two |
267 | | - |
268 | | - const newPanel = vscode.window.createWebviewPanel(ClineProvider.tabPanelId, "Roo Code", targetCol, { |
269 | | - enableScripts: true, |
270 | | - retainContextWhenHidden: true, |
271 | | - localResourceRoots: [context.extensionUri], |
272 | | - }) |
273 | | - |
274 | | - // Save as tab type panel. |
275 | | - setPanel(newPanel, "tab") |
276 | | - |
277 | | - // TODO: Use better svg icon with light and dark variants (see |
278 | | - // https://stackoverflow.com/questions/58365687/vscode-extension-iconpath). |
279 | | - newPanel.iconPath = { |
280 | | - light: vscode.Uri.joinPath(context.extensionUri, "assets", "icons", "panel_light.png"), |
281 | | - dark: vscode.Uri.joinPath(context.extensionUri, "assets", "icons", "panel_dark.png"), |
282 | | - } |
283 | | - |
284 | | - await tabProvider.resolveWebviewView(newPanel) |
285 | | - |
286 | | - // Add listener for visibility changes to notify webview |
287 | | - newPanel.onDidChangeViewState( |
288 | | - (e) => { |
289 | | - const panel = e.webviewPanel |
290 | | - if (panel.visible) { |
291 | | - panel.webview.postMessage({ type: "action", action: "didBecomeVisible" }) // Use the same message type as in SettingsView.tsx |
292 | | - } |
293 | | - }, |
294 | | - null, // First null is for `thisArgs` |
295 | | - context.subscriptions, // Register listener for disposal |
296 | | - ) |
297 | | - |
298 | | - // Handle panel closing events. |
299 | | - newPanel.onDidDispose( |
300 | | - () => { |
301 | | - setPanel(undefined, "tab") |
302 | | - }, |
303 | | - null, |
304 | | - context.subscriptions, // Also register dispose listener |
305 | | - ) |
306 | | - |
307 | | - // Lock the editor group so clicking on files doesn't open them over the panel. |
308 | | - await delay(100) |
309 | | - await vscode.commands.executeCommand("workbench.action.lockEditorGroup") |
310 | | - |
311 | | - return tabProvider |
312 | | -} |
0 commit comments