Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions apps/vscode-e2e/src/suite/extension.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ suite("Roo Code Extension", function () {
"plusButtonClicked",
"mcpButtonClicked",
"promptsButtonClicked",
"popoutButtonClicked",
"openInNewTab",
"settingsButtonClicked",
"historyButtonClicked",
"showHumanRelayDialog",
Expand Down
44 changes: 0 additions & 44 deletions packages/build/src/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand All @@ -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: [
{
Expand Down Expand Up @@ -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": [
Expand All @@ -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: [
{
Expand Down
3 changes: 0 additions & 3 deletions packages/types/src/vscode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,9 @@ export const commandIds = [
"mcpButtonClicked",
"historyButtonClicked",
"marketplaceButtonClicked",
"popoutButtonClicked",
"cloudButtonClicked",
"settingsButtonClicked",

"openInNewTab",

"showHumanRelayDialog",
"registerHumanRelayCallback",
"unregisterHumanRelayCallback",
Expand Down
87 changes: 0 additions & 87 deletions src/activate/registerCommands.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
import * as vscode from "vscode"
import delay from "delay"

import type { CommandId } from "@roo-code/types"
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.
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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
}
15 changes: 3 additions & 12 deletions src/extension/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down
57 changes: 0 additions & 57 deletions src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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%",
Expand All @@ -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%",
Expand Down Expand Up @@ -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"
}
]
},
Expand Down