refactor: remove “Open in Editor” and openInNewTab features, commands, and menus; update tests

This commit is contained in:
Roo Code 2025-10-29 03:34:16 +00:00
parent f839d4c27b
commit 941e5ae019
6 changed files with 3 additions and 205 deletions

View file

@ -17,8 +17,6 @@ suite("Roo Code Extension", function () {
"plusButtonClicked",
"mcpButtonClicked",
"promptsButtonClicked",
"popoutButtonClicked",
"openInNewTab",
"settingsButtonClicked",
"historyButtonClicked",
"showHumanRelayDialog",

View file

@ -37,11 +37,6 @@ describe("generatePackageJson", () => {
title: "%command.newTask.title%",
icon: "$(edit)",
},
{
command: "roo-cline.openInNewTab",
title: "%command.openInNewTab.title%",
category: "%configuration.title%",
},
],
menus: {
"editor/context": [
@ -56,23 +51,6 @@ describe("generatePackageJson", () => {
group: "1_actions@1",
},
],
"editor/title": [
{
command: "roo-cline.plusButtonClicked",
group: "navigation@1",
when: "activeWebviewPanelId == roo-cline.TabPanelProvider",
},
{
command: "roo-cline.settingsButtonClicked",
group: "navigation@6",
when: "activeWebviewPanelId == roo-cline.TabPanelProvider",
},
{
command: "roo-cline.accountButtonClicked",
group: "navigation@6",
when: "activeWebviewPanelId == roo-cline.TabPanelProvider",
},
],
},
submenus: [
{
@ -150,11 +128,6 @@ describe("generatePackageJson", () => {
title: "%command.newTask.title%",
icon: "$(edit)",
},
{
command: "roo-code-nightly.openInNewTab",
title: "%command.openInNewTab.title%",
category: "%configuration.title%",
},
],
menus: {
"editor/context": [
@ -169,23 +142,6 @@ describe("generatePackageJson", () => {
group: "1_actions@1",
},
],
"editor/title": [
{
command: "roo-code-nightly.plusButtonClicked",
group: "navigation@1",
when: "activeWebviewPanelId == roo-code-nightly.TabPanelProvider",
},
{
command: "roo-code-nightly.settingsButtonClicked",
group: "navigation@6",
when: "activeWebviewPanelId == roo-code-nightly.TabPanelProvider",
},
{
command: "roo-code-nightly.accountButtonClicked",
group: "navigation@6",
when: "activeWebviewPanelId == roo-code-nightly.TabPanelProvider",
},
],
},
submenus: [
{

View file

@ -34,12 +34,9 @@ export const commandIds = [
"mcpButtonClicked",
"historyButtonClicked",
"marketplaceButtonClicked",
"popoutButtonClicked",
"cloudButtonClicked",
"settingsButtonClicked",
"openInNewTab",
"showHumanRelayDialog",
"registerHumanRelayCallback",
"unregisterHumanRelayCallback",

View file

@ -1,5 +1,4 @@
import * as vscode from "vscode"
import delay from "delay"
import type { CommandId } from "@roo-code/types"
import { TelemetryService } from "@roo-code/telemetry"
@ -7,15 +6,11 @@ import { TelemetryService } from "@roo-code/telemetry"
import { Package } from "../shared/package"
import { getCommand } from "../utils/commands"
import { ClineProvider } from "../core/webview/ClineProvider"
import { ContextProxy } from "../core/config/ContextProxy"
import { focusPanel } from "../utils/focusPanel"
import { registerHumanRelayCallback, unregisterHumanRelayCallback, handleHumanRelayResponse } from "./humanRelay"
import { handleNewTask } from "./handleTask"
import { CodeIndexManager } from "../services/code-index/manager"
import { importSettingsWithFeedback } from "../core/config/importExport"
import { MdmService } from "../services/mdm/MdmService"
import { t } from "../i18n"
/**
* Helper to get the visible ClineProvider instance or log if not found.
@ -123,12 +118,6 @@ const getCommandsMap = ({ context, outputChannel, provider }: RegisterCommandOpt
visibleProvider.postMessageToWebview({ type: "action", action: "promptsButtonClicked" })
},
popoutButtonClicked: () => {
TelemetryService.instance.captureTitleButtonClicked("popout")
return openClineInNewTab({ context, outputChannel })
},
openInNewTab: () => openClineInNewTab({ context, outputChannel }),
settingsButtonClicked: () => {
const visibleProvider = getVisibleProviderOrLog(outputChannel)
@ -234,79 +223,3 @@ const getCommandsMap = ({ context, outputChannel, provider }: RegisterCommandOpt
})
},
})
export const openClineInNewTab = async ({ context, outputChannel }: Omit<RegisterCommandOptions, "provider">) => {
// (This example uses webviewProvider activation event which is necessary to
// deserialize cached webview, but since we use retainContextWhenHidden, we
// don't need to use that event).
// https://github.com/microsoft/vscode-extension-samples/blob/main/webview-sample/src/extension.ts
const contextProxy = await ContextProxy.getInstance(context)
const codeIndexManager = CodeIndexManager.getInstance(context)
// Get the existing MDM service instance to ensure consistent policy enforcement
let mdmService: MdmService | undefined
try {
mdmService = MdmService.getInstance()
} catch (error) {
// MDM service not initialized, which is fine - extension can work without it
mdmService = undefined
}
const tabProvider = new ClineProvider(context, outputChannel, "editor", contextProxy, mdmService)
const lastCol = Math.max(...vscode.window.visibleTextEditors.map((editor) => editor.viewColumn || 0))
// Check if there are any visible text editors, otherwise open a new group
// to the right.
const hasVisibleEditors = vscode.window.visibleTextEditors.length > 0
if (!hasVisibleEditors) {
await vscode.commands.executeCommand("workbench.action.newGroupRight")
}
const targetCol = hasVisibleEditors ? Math.max(lastCol + 1, 1) : vscode.ViewColumn.Two
const newPanel = vscode.window.createWebviewPanel(ClineProvider.tabPanelId, "Roo Code", targetCol, {
enableScripts: true,
retainContextWhenHidden: true,
localResourceRoots: [context.extensionUri],
})
// Save as tab type panel.
setPanel(newPanel, "tab")
// TODO: Use better svg icon with light and dark variants (see
// https://stackoverflow.com/questions/58365687/vscode-extension-iconpath).
newPanel.iconPath = {
light: vscode.Uri.joinPath(context.extensionUri, "assets", "icons", "panel_light.png"),
dark: vscode.Uri.joinPath(context.extensionUri, "assets", "icons", "panel_dark.png"),
}
await tabProvider.resolveWebviewView(newPanel)
// Add listener for visibility changes to notify webview
newPanel.onDidChangeViewState(
(e) => {
const panel = e.webviewPanel
if (panel.visible) {
panel.webview.postMessage({ type: "action", action: "didBecomeVisible" }) // Use the same message type as in SettingsView.tsx
}
},
null, // First null is for `thisArgs`
context.subscriptions, // Register listener for disposal
)
// Handle panel closing events.
newPanel.onDidDispose(
() => {
setPanel(undefined, "tab")
},
null,
context.subscriptions, // Also register dispose listener
)
// Lock the editor group so clicking on files doesn't open them over the panel.
await delay(100)
await vscode.commands.executeCommand("workbench.action.lockEditorGroup")
return tabProvider
}

View file

@ -23,7 +23,6 @@ import { IpcServer } from "@roo-code/ipc"
import { Package } from "../shared/package"
import { ClineProvider } from "../core/webview/ClineProvider"
import { openClineInNewTab } from "../activate/registerCommands"
export class API extends EventEmitter<RooCodeEvents> implements RooCodeAPI {
private readonly outputChannel: vscode.OutputChannel
@ -118,17 +117,9 @@ export class API extends EventEmitter<RooCodeEvents> implements RooCodeAPI {
}) {
let provider: ClineProvider
if (newTab) {
await vscode.commands.executeCommand("workbench.action.files.revert")
await vscode.commands.executeCommand("workbench.action.closeAllEditors")
provider = await openClineInNewTab({ context: this.context, outputChannel: this.outputChannel })
this.registerListeners(provider)
} else {
await vscode.commands.executeCommand(`${Package.name}.SidebarProvider.focus`)
provider = this.sidebarProvider
}
// Always use the sidebar provider; "open in editor" tab mode has been removed
await vscode.commands.executeCommand(`${Package.name}.SidebarProvider.focus`)
provider = this.sidebarProvider
await provider.removeClineFromStack()
await provider.postStateToWebview()

View file

@ -95,11 +95,6 @@
"title": "%command.marketplace.title%",
"icon": "$(extensions)"
},
{
"command": "roo-cline.popoutButtonClicked",
"title": "%command.openInEditor.title%",
"icon": "$(link-external)"
},
{
"command": "roo-cline.cloudButtonClicked",
"title": "%command.cloud.title%",
@ -110,11 +105,6 @@
"title": "%command.settings.title%",
"icon": "$(settings-gear)"
},
{
"command": "roo-cline.openInNewTab",
"title": "%command.openInNewTab.title%",
"category": "%configuration.title%"
},
{
"command": "roo-cline.explainCode",
"title": "%command.explainCode.title%",
@ -257,53 +247,6 @@
"command": "roo-cline.mcpButtonClicked",
"group": "overflow@3",
"when": "view == roo-cline.SidebarProvider"
},
{
"command": "roo-cline.popoutButtonClicked",
"group": "overflow@4",
"when": "view == roo-cline.SidebarProvider"
}
],
"editor/title": [
{
"command": "roo-cline.plusButtonClicked",
"group": "navigation@1",
"when": "activeWebviewPanelId == roo-cline.TabPanelProvider"
},
{
"command": "roo-cline.marketplaceButtonClicked",
"group": "navigation@2",
"when": "activeWebviewPanelId == roo-cline.TabPanelProvider"
},
{
"command": "roo-cline.settingsButtonClicked",
"group": "navigation@3",
"when": "activeWebviewPanelId == roo-cline.TabPanelProvider"
},
{
"command": "roo-cline.cloudButtonClicked",
"group": "navigation@4",
"when": "activeWebviewPanelId == roo-cline.TabPanelProvider"
},
{
"command": "roo-cline.historyButtonClicked",
"group": "overflow@1",
"when": "activeWebviewPanelId == roo-cline.TabPanelProvider"
},
{
"command": "roo-cline.promptsButtonClicked",
"group": "overflow@2",
"when": "activeWebviewPanelId == roo-cline.TabPanelProvider"
},
{
"command": "roo-cline.mcpButtonClicked",
"group": "overflow@3",
"when": "activeWebviewPanelId == roo-cline.TabPanelProvider"
},
{
"command": "roo-cline.popoutButtonClicked",
"group": "overflow@4",
"when": "activeWebviewPanelId == roo-cline.TabPanelProvider"
}
]
},