@@ -398,9 +398,29 @@ export const FileMentionPicker: React.FC<FileMentionPickerProps> = ({
398398 ...( currentPath ? [ ] : referenceItems . map ( item => ( { kind : 'file' as const , item } ) ) ) ,
399399 ]
400400 ) , [ currentFiles , currentPath , isSearchMode , referenceItems , results , sessionResults ] ) ;
401- const currentDirName = currentPath
402- ? currentPath . replace ( / \\ / g, '/' ) . split ( '/' ) . pop ( ) || ''
403- : workspacePath ?. replace ( / \\ / g, '/' ) . split ( '/' ) . pop ( ) || t ( 'fileMention.rootDirectory' ) ;
401+ const currentDirectoryDisplay = useMemo ( ( ) => {
402+ if ( ! workspacePath ) {
403+ const rootDirectory = t ( 'fileMention.rootDirectory' ) ;
404+ return { name : rootDirectory , parentPath : '' , fullPath : rootDirectory } ;
405+ }
406+
407+ const normalizedWorkspace = workspacePath . replace ( / \\ / g, '/' ) . replace ( / \/ + $ / , '' ) ;
408+ const workspaceName = normalizedWorkspace . split ( '/' ) . pop ( ) || t ( 'fileMention.rootDirectory' ) ;
409+ const directorySegments = [ workspaceName ] ;
410+
411+ if ( currentPath ) {
412+ const relativeCurrentPath = getRelativePath ( currentPath )
413+ . replace ( / \\ / g, '/' )
414+ . replace ( / ^ \/ + | \/ + $ / g, '' ) ;
415+ if ( relativeCurrentPath ) directorySegments . push ( ...relativeCurrentPath . split ( '/' ) . filter ( Boolean ) ) ;
416+ }
417+
418+ return {
419+ name : directorySegments [ directorySegments . length - 1 ] ,
420+ parentPath : directorySegments . slice ( 0 , - 1 ) . join ( '/' ) ,
421+ fullPath : directorySegments . join ( '/' ) ,
422+ } ;
423+ } , [ currentPath , getRelativePath , t , workspacePath ] ) ;
404424 const isOverlay = Boolean ( anchorRef ) && ! position ;
405425 const overlayLayout = useAnchoredPopoverPosition ( {
406426 open : isOpen && isOverlay ,
@@ -562,7 +582,24 @@ export const FileMentionPicker: React.FC<FileMentionPickerProps> = ({
562582 </ Tooltip >
563583 ) }
564584 { isSearchMode ? < > < Search size = { 11 } /> < span > { t ( 'fileMention.searchResults' ) } </ span > </ > : (
565- < span className = "file-mention-picker__dir-name" > { currentDirName } </ span >
585+ < div className = "file-mention-picker__directory-label" title = { currentDirectoryDisplay . fullPath } >
586+ < span
587+ data-bf-component = "file-mention-picker"
588+ data-bf-part = "currentDirectoryName"
589+ className = "file-mention-picker__dir-name"
590+ >
591+ { currentDirectoryDisplay . name }
592+ </ span >
593+ { currentDirectoryDisplay . parentPath && (
594+ < span
595+ data-bf-component = "file-mention-picker"
596+ data-bf-part = "parentDirectoryPath"
597+ className = "file-mention-picker__parent-path"
598+ >
599+ { currentDirectoryDisplay . parentPath }
600+ </ span >
601+ ) }
602+ </ div >
566603 ) }
567604 </ div >
568605 < div data-bf-component = "file-mention-picker" data-bf-part = "content" className = "file-mention-picker__content" >
@@ -602,21 +639,11 @@ export const FileMentionPicker: React.FC<FileMentionPickerProps> = ({
602639 < span
603640 data-bf-component = "file-mention-picker"
604641 data-bf-part = "itemName"
605- className = { ` file-mention-picker__item-name${ file && ! file . referenceStableKey ? ' file-mention-picker__item-name--with-path' : '' } ` }
642+ className = " file-mention-picker__item-name"
606643 >
607644 { session ?. sessionName ?? file ?. name }
608645 </ span >
609646 { session && < span data-bf-component = "file-mention-picker" data-bf-part = "itemDetail" className = "file-mention-picker__item-detail" > { session . workspaceLabel } </ span > }
610- { file && ! file . referenceStableKey && (
611- < span
612- data-bf-component = "file-mention-picker"
613- data-bf-part = "itemDetail"
614- className = "file-mention-picker__item-detail file-mention-picker__item-path"
615- title = { file . relativePath }
616- >
617- { file . relativePath }
618- </ span >
619- ) }
620647 { file ?. referenceStableKey && (
621648 < span data-bf-component = "file-mention-picker" data-bf-part = "itemDetail" className = "file-mention-picker__item-detail" >
622649 { file . referenceDescription || file . path }
0 commit comments