@@ -131,6 +131,7 @@ import {
131131 resolveSettledTimestamp ,
132132 resolveSidebarThreadStatus ,
133133 searchSidebarThreadsByTitle ,
134+ shouldCreateNewThreadInCurrentProject ,
134135 resolveWorkingStartedAt ,
135136 sortLogicalProjectsForSidebar ,
136137 sortPinnedThreadsForSidebar ,
@@ -3186,29 +3187,39 @@ export default function Sidebar() {
31863187 // falling back to the top project) — same resolution the command palette
31873188 // uses. The command palette already offers a "New thread in..." submenu
31883189 // for multi-project setups.
3189- const handleNewThreadClick = useCallback ( ( ) => {
3190- // One project: nothing to pick, create immediately.
3191- if ( projectGroups . length <= 1 ) {
3190+ const handleNewThreadClick = useCallback (
3191+ ( event ?: ReactMouseEvent ) => {
3192+ // One project: nothing to pick, create immediately. Shift+click creates
3193+ // directly in the current project even with several projects, skipping
3194+ // the palette picker.
3195+ if ( shouldCreateNewThreadInCurrentProject ( event ?. shiftKey ?? false , projectGroups . length ) ) {
3196+ if ( isMobile ) setOpenMobile ( false ) ;
3197+ void startNewThreadFromContext ( {
3198+ activeDraftThread : newThreadContext . activeDraftThread ,
3199+ activeThread : newThreadContext . activeThread ?? undefined ,
3200+ defaultProjectRef : newThreadContext . defaultProjectRef ,
3201+ handleNewThread : newThreadContext . handleNewThread ,
3202+ } ) ;
3203+ return ;
3204+ }
31923205 if ( isMobile ) setOpenMobile ( false ) ;
3193- void startNewThreadFromContext ( {
3194- activeDraftThread : newThreadContext . activeDraftThread ,
3195- activeThread : newThreadContext . activeThread ?? undefined ,
3196- defaultProjectRef : newThreadContext . defaultProjectRef ,
3197- handleNewThread : newThreadContext . handleNewThread ,
3198- } ) ;
3199- return ;
3200- }
3201- if ( isMobile ) setOpenMobile ( false ) ;
3202- openCommandPalette ( { open : "new-thread-in" } ) ;
3203- } , [ isMobile , newThreadContext , projectGroups . length , setOpenMobile ] ) ;
3206+ openCommandPalette ( { open : "new-thread-in" } ) ;
3207+ } ,
3208+ [ isMobile , newThreadContext , projectGroups . length , setOpenMobile ] ,
3209+ ) ;
32043210
32053211 // The button mirrors chat.new: in multi-project setups both route through
32063212 // the command palette's "New thread in..." picker, and in single-project
3207- // setups both create immediately. chat.newLocal always creates directly, so
3208- // it is only a correct label when chat.new is unbound.
3213+ // setups both create immediately. In multi-project setups the label is only
3214+ // the picker's shortcut: falling back to chat.newLocal would advertise the
3215+ // same shortcut for both the picker and direct create. In single-project
3216+ // setups both commands create directly, so chat.newLocal is a valid
3217+ // fallback. The second tooltip line (multi-project only) advertises
3218+ // shift+click and its keyboard twin chat.newLocal for direct create.
32093219 const newThreadShortcutLabel =
32103220 shortcutLabelForCommand ( keybindings , "chat.new" ) ??
3211- shortcutLabelForCommand ( keybindings , "chat.newLocal" ) ;
3221+ ( projectGroups . length <= 1 ? shortcutLabelForCommand ( keybindings , "chat.newLocal" ) : undefined ) ;
3222+ const newThreadInProjectShortcutLabel = shortcutLabelForCommand ( keybindings , "chat.newLocal" ) ;
32123223 return (
32133224 < >
32143225 < SidebarChromeHeader isElectron = { isElectron } />
@@ -3286,9 +3297,25 @@ export default function Sidebar() {
32863297 />
32873298 </ TooltipTrigger >
32883299 < TooltipPopup side = "right" >
3289- { newThreadShortcutLabel
3290- ? `New thread (${ newThreadShortcutLabel } )`
3291- : "New thread" }
3300+ { projectGroups . length > 1 ? (
3301+ < span className = "flex flex-col gap-0.5" >
3302+ < span >
3303+ { newThreadShortcutLabel
3304+ ? `New thread (${ newThreadShortcutLabel } )`
3305+ : "New thread" }
3306+ </ span >
3307+ < span className = "text-muted-foreground" >
3308+ New thread in current project: Shift+click
3309+ { newThreadInProjectShortcutLabel
3310+ ? ` (${ newThreadInProjectShortcutLabel } )`
3311+ : "" }
3312+ </ span >
3313+ </ span >
3314+ ) : newThreadShortcutLabel ? (
3315+ `New thread (${ newThreadShortcutLabel } )`
3316+ ) : (
3317+ "New thread"
3318+ ) }
32923319 </ TooltipPopup >
32933320 </ Tooltip >
32943321 </ div >
0 commit comments