Skip to content

Commit 8a048b6

Browse files
committed
Show parent directory in rendered file mention chips
1 parent 450f26b commit 8a048b6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

apps/code/src/renderer/features/sessions/components/session-update/parseFileMentions.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,15 @@ export function parseMentionTags(content: string): ReactNode[] {
9191

9292
if (match[1]) {
9393
const filePath = match[1];
94-
const fileName = filePath.split("/").pop() ?? filePath;
94+
const segments = filePath.split("/").filter(Boolean);
95+
const fileName = segments.pop() ?? filePath;
96+
const parentDir = segments.pop();
97+
const label = parentDir ? `${parentDir}/${fileName}` : fileName;
9598
parts.push(
9699
<MentionChip
97100
key={`file-${matchIndex}`}
98101
icon={<File size={12} />}
99-
label={fileName}
102+
label={label}
100103
/>,
101104
);
102105
} else if (match[2]) {

0 commit comments

Comments
 (0)