Skip to content

Commit 2f7627d

Browse files
brunobergherq1600822305
authored andcommitted
ux: improve worktree selector and creation UX (RooCodeInc#10940)
* Delete modal * Restructured * Much more prominent * UI * i18n * Fixes i18n * Remove mergeresultmodel * i18n * tests * knip * code review
1 parent 34cda17 commit 2f7627d

97 files changed

Lines changed: 1189 additions & 380 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/types/src/global-settings.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,11 @@ export const globalSettingsSchema = z.object({
204204
* Used by the worktree feature to open the Roo Code sidebar in a new window.
205205
*/
206206
worktreeAutoOpenPath: z.string().optional(),
207+
/**
208+
* Whether to show the worktree selector in the home screen.
209+
* @default true
210+
*/
211+
showWorktreesInHomeScreen: z.boolean().optional(),
207212
})
208213

209214
export type GlobalSettings = z.infer<typeof globalSettingsSchema>

packages/types/src/vscode-extension-host.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ export interface ExtensionMessage {
107107
| "worktreeDefaults"
108108
| "worktreeIncludeStatus"
109109
| "branchWorktreeIncludeResult"
110+
| "folderSelected"
110111
text?: string
111112
payload?: any // eslint-disable-line @typescript-eslint/no-explicit-any
112113
checkpointWarning?: {
@@ -119,7 +120,6 @@ export interface ExtensionMessage {
119120
| "historyButtonClicked"
120121
| "marketplaceButtonClicked"
121122
| "cloudButtonClicked"
122-
| "worktreesButtonClicked"
123123
| "didBecomeVisible"
124124
| "focusInput"
125125
| "switchTab"
@@ -257,6 +257,8 @@ export interface ExtensionMessage {
257257
copyProgressBytesCopied?: number
258258
copyProgressTotalBytes?: number
259259
copyProgressItemName?: string
260+
// folderSelected
261+
path?: string
260262
}
261263

262264
export interface OpenAiCodexRateLimitsMessage {
@@ -333,6 +335,7 @@ export type ExtensionState = Pick<
333335
| "includeCurrentCost"
334336
| "maxGitStatusFiles"
335337
| "requestDelaySeconds"
338+
| "showWorktreesInHomeScreen"
336339
> & {
337340
version: string
338341
clineMessages: ClineMessage[]
@@ -602,6 +605,7 @@ export interface WebviewMessage {
602605
| "checkBranchWorktreeInclude"
603606
| "createWorktreeInclude"
604607
| "checkoutBranch"
608+
| "browseForWorktreePath"
605609
text?: string
606610
editedMessageContent?: string
607611
tab?: "settings" | "history" | "mcp" | "modes" | "chat" | "marketplace" | "cloud"

packages/types/src/vscode.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ export const commandIds = [
3535
"popoutButtonClicked",
3636
"cloudButtonClicked",
3737
"settingsButtonClicked",
38-
"worktreesButtonClicked",
3938

4039
"openInNewTab",
4140

src/activate/registerCommands.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,6 @@ const getCommandsMap = ({ context, outputChannel, provider }: RegisterCommandOpt
134134
if (!visibleProvider) return
135135
visibleProvider.postMessageToWebview({ type: "action", action: "marketplaceButtonClicked" })
136136
},
137-
worktreesButtonClicked: () => {
138-
const visibleProvider = getVisibleProviderOrLog(outputChannel)
139-
if (!visibleProvider) return
140-
TelemetryService.instance.captureTitleButtonClicked("worktrees")
141-
visibleProvider.postMessageToWebview({ type: "action", action: "worktreesButtonClicked" })
142-
},
143137
newTask: handleNewTask,
144138
setCustomStoragePath: async () => {
145139
const { promptForCustomStoragePath } = await import("../utils/storage")

src/core/webview/webviewMessageHandler.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3561,6 +3561,34 @@ export const webviewMessageHandler = async (
35613561
break
35623562
}
35633563

3564+
case "browseForWorktreePath": {
3565+
try {
3566+
const options: vscode.OpenDialogOptions = {
3567+
canSelectFiles: false,
3568+
canSelectFolders: true,
3569+
canSelectMany: false,
3570+
openLabel: t("worktrees:selectWorktreeLocation"),
3571+
title: t("worktrees:selectFolderForWorktree"),
3572+
defaultUri: vscode.workspace.workspaceFolders?.[0]?.uri
3573+
? vscode.Uri.joinPath(vscode.workspace.workspaceFolders[0].uri, "..")
3574+
: undefined,
3575+
}
3576+
3577+
const result = await vscode.window.showOpenDialog(options)
3578+
if (result && result[0]) {
3579+
await provider.postMessageToWebview({
3580+
type: "folderSelected",
3581+
path: result[0].fsPath,
3582+
})
3583+
}
3584+
} catch (error) {
3585+
const errorMessage = error instanceof Error ? error.message : String(error)
3586+
provider.log(`Error opening folder picker: ${errorMessage}`)
3587+
}
3588+
3589+
break
3590+
}
3591+
35643592
default: {
35653593
// console.log(`Unhandled message type: ${message.type}`)
35663594
//

src/i18n/locales/ca/worktrees.json

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/de/worktrees.json

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/en/worktrees.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"selectWorktreeLocation": "Select Worktree Location",
3+
"selectFolderForWorktree": "Select folder for new worktree"
4+
}

src/i18n/locales/es/worktrees.json

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/fr/worktrees.json

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)