fix(editor): keep file basename in @-reference links

The explorer @ button appended plain text (@folder/file.ts), which DSH's
composer only decorates as a folder ref (@folder/) — the file name stayed
outside the link. Insert FILE references through DSH's own structured
insert-reference event instead, minting one chip for the whole reference
(displayed as @basename, serialized as the full @path). Directories keep the
plain @dir/ mention so folder completion still works.
This commit is contained in:
Ch3n4y
2026-09-03 10:00:13 +08:00
committed by Menghuan1918
parent 396017b459
commit 94ffac0224
8 changed files with 129 additions and 21 deletions
+4 -4
View File
@@ -131,8 +131,8 @@ export function FileTree(props: {
onOpenWith?: (targetId: string, path: string) => void
/** Toggle one target's pinned state (the submenu row's pushpin). */
onToggleOpenWithPin?: (targetId: string) => void
/** Insert `@<relative path>` into the composer draft. */
onReferenceFile: (path: string) => void
/** Insert `@<relative path>` into the composer draft (file vs directory). */
onReferenceFile: (path: string, isDir: boolean) => void
/** Bump to wipe the level cache and reload the visible set. */
refreshTick: number
/** Upload into `dir` (absolute, inside the workspace); runs in the caller. */
@@ -332,7 +332,7 @@ export function FileTree(props: {
title={t('referenceFile')}
onClick={(event) => {
event.stopPropagation()
onReferenceFile(entry.path)
onReferenceFile(entry.path, entry.isDir)
}}
>
{t('referenceFile')}
@@ -570,7 +570,7 @@ export function FileTree(props: {
title={t('referenceFile')}
onClick={(event) => {
event.stopPropagation()
onReferenceFile(root)
onReferenceFile(root, true)
}}
>
{t('referenceFile')}