@@ -495,19 +495,23 @@ export const useSuggestionEngine = ({
495495 } , [ agentMatches ] )
496496
497497 const fileSuggestionItems = useMemo < SuggestionItem [ ] > ( ( ) => {
498- return fileMatches . map ( ( file ) => ( {
499- id : file . filePath ,
500- label : file . filePath . split ( '/' ) . pop ( ) || file . filePath ,
501- labelHighlightIndices : file . pathHighlightIndices
502- ? file . pathHighlightIndices . map ( ( idx ) => {
503- const fileName = file . filePath . split ( '/' ) . pop ( ) || file . filePath
504- const fileNameStart = file . filePath . lastIndexOf ( fileName )
505- return idx >= fileNameStart ? idx - fileNameStart : - 1
506- } ) . filter ( ( idx ) => idx >= 0 )
507- : null ,
508- description : file . filePath ,
509- descriptionHighlightIndices : file . pathHighlightIndices ,
510- } ) )
498+ return fileMatches . map ( ( file ) => {
499+ const fileName = file . filePath . split ( '/' ) . pop ( ) || file . filePath
500+ const isRootLevel = ! file . filePath . includes ( '/' )
501+
502+ return {
503+ id : file . filePath ,
504+ label : fileName ,
505+ labelHighlightIndices : file . pathHighlightIndices
506+ ? file . pathHighlightIndices . map ( ( idx ) => {
507+ const fileNameStart = file . filePath . lastIndexOf ( fileName )
508+ return idx >= fileNameStart ? idx - fileNameStart : - 1
509+ } ) . filter ( ( idx ) => idx >= 0 )
510+ : null ,
511+ description : isRootLevel ? '.' : file . filePath ,
512+ descriptionHighlightIndices : isRootLevel ? null : file . pathHighlightIndices ,
513+ }
514+ } )
511515 } , [ fileMatches ] )
512516
513517 return {
0 commit comments