Skip to content

Commit 16c1ab9

Browse files
authored
Revert "Better logic for choosing the view column when opening Roo in a tab" (#2285)
* Revert "Better logic for choosing the view column when opening Roo in a tab (…" This reverts commit 7eea755. * Create hip-pumpkins-mate.md
1 parent 98b04eb commit 16c1ab9

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

.changeset/hip-pumpkins-mate.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"roo-cline": patch
3+
---
4+
5+
Revert "Better logic for choosing the view column when opening Roo in a tab"

src/activate/registerCommands.ts

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -123,26 +123,18 @@ export const openClineInNewTab = async ({ context, outputChannel }: Omit<Registe
123123
// don't need to use that event).
124124
// https://github.com/microsoft/vscode-extension-samples/blob/main/webview-sample/src/extension.ts
125125
const tabProvider = new ClineProvider(context, outputChannel, "editor")
126+
const lastCol = Math.max(...vscode.window.visibleTextEditors.map((editor) => editor.viewColumn || 0))
126127

127-
const activeEditor = vscode.window.activeTextEditor
128+
// Check if there are any visible text editors, otherwise open a new group
129+
// to the right.
128130
const hasVisibleEditors = vscode.window.visibleTextEditors.length > 0
129131

130-
let targetCol: vscode.ViewColumn
131-
132132
if (!hasVisibleEditors) {
133-
// No editors open, open in first column
134-
targetCol = vscode.ViewColumn.One
135-
} else if (activeEditor && activeEditor.document.isUntitled && vscode.window.visibleTextEditors.length === 1) {
136-
// Only one editor and it's empty (untitled), reuse it
137-
targetCol = activeEditor.viewColumn ?? vscode.ViewColumn.One
138-
} else {
139-
// Otherwise, create a new group to the right
140133
await vscode.commands.executeCommand("workbench.action.newGroupRight")
141-
// New group becomes the last + 1
142-
const lastCol = Math.max(...vscode.window.visibleTextEditors.map((e) => e.viewColumn || 1))
143-
targetCol = (lastCol + 1) as vscode.ViewColumn
144134
}
145135

136+
const targetCol = hasVisibleEditors ? Math.max(lastCol + 1, 1) : vscode.ViewColumn.Two
137+
146138
const newPanel = vscode.window.createWebviewPanel(ClineProvider.tabPanelId, "Roo Code", targetCol, {
147139
enableScripts: true,
148140
retainContextWhenHidden: true,

0 commit comments

Comments
 (0)