Skip to content

Commit 52e2cce

Browse files
committed
feat(cli): show '.' for root-level files in @-menu description
1 parent a054800 commit 52e2cce

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

cli/src/hooks/use-suggestion-engine.ts

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)