fix(file-icons): 适配 v0.18.1 基线——重命名行接入解析器 + 测试与门禁补齐
rebase 到 main(v0.18.1)后的适配层: - 冲突(EditorHost ×2 / TreePanel / FileTree)按并集解:main 侧 onPathRenamed/onPathDeleted 与 PR 侧 service prop 并存。 - main 新增的行内重命名行仍用 <VscFile>/<VscFolder>,而本次改动已删除 VscFile import(合并后 TS2304)——改走 dirRowIcon/fileRowIcon,与树行 同一条回退链;VscFolder 随之无引用,从 import 移除。 - tests/file-icons.spec.tsx:markerB 换成独立元素类型(<b>),使 「priority 降序 / 同级按注册序」断言真正可区分(此前两个 marker 都是 <span>,断言恒真);新增「工厂返回 undefined 则拒绝该级、链继续」与 「注册/注销触发订阅通知」两例(17 → 19)。 - tests/consumer-types.ts:补齐 FileIconDescriptor / registerFileIcon / getFileIcons / matchFileIcon / matchFolderIcon / fileIcon / folderIcon / FOLDER_EXT / FOLDER_OPEN_EXT 的编译期门禁。 - README:v0.19.0(未发布)段移到「最近更新」最前(此前被自动合并夹在 v0.18.1 与 v0.18.0 之间)。 - file-icons.tsx:注释修正——展平后的 Map 是后写覆盖,不是「first match wins」;当前无重复扩展名键,仅潜在语义。
This commit is contained in:
@@ -28,7 +28,7 @@ import {
|
||||
IconEditOutline16, IconLinkOutline16, IconTrashOutline16, Menu, Modal, type MenuEntry, type MenuItem, writeClipboard,
|
||||
} from '@deepseek-ai/dsh-client-ui-primitives'
|
||||
import { SiCursor, SiZedindustries } from 'react-icons/si'
|
||||
import { VscFolder, VscFolderOpened, VscLinkExternal, VscPin, VscPinned } from 'react-icons/vsc'
|
||||
import { VscFolderOpened, VscLinkExternal, VscPin, VscPinned } from 'react-icons/vsc'
|
||||
import { api, downloadUrl, isOutsideWorkspaceMessage, type FsEntry } from './api.ts'
|
||||
import { FenceErrorNotice } from './FenceErrorNotice.tsx'
|
||||
import { builtinFileIcon, builtinFolderIcon } from './file-icons.tsx'
|
||||
@@ -580,8 +580,8 @@ export function FileTree(props: {
|
||||
style={{ paddingLeft: depth * 22 + 6 }}
|
||||
>
|
||||
{entry.isDir
|
||||
? (expandedSet.has(entry.path) ? <VscFolderOpened size={14} /> : <VscFolder size={14} />)
|
||||
: <VscFile size={14} />}
|
||||
? dirRowIcon(entry.path, expandedSet.has(entry.path))
|
||||
: fileRowIcon(entry.path)}
|
||||
<input
|
||||
ref={renameInputRef}
|
||||
className={css.explorerRenameInput}
|
||||
|
||||
@@ -32,10 +32,12 @@ export function builtinFolderIcon(open: boolean, size: number): ReactNode {
|
||||
type GlyphGroup = [readonly string[], GlyphFactory]
|
||||
|
||||
/**
|
||||
* Extension → glyph groups, first match wins. Extensions are lowercase
|
||||
* without the leading dot, matched case-insensitively by the caller's
|
||||
* normalization. The reserved folder values (`'folder'`/`'folder-open'`)
|
||||
* never appear here — directories resolve through `builtinFolderIcon`.
|
||||
* Extension → glyph groups. Extensions are lowercase without the leading dot,
|
||||
* matched case-insensitively by the caller's normalization. Group order is
|
||||
* documentation only: the flattened lookup below is a Map, so every extension
|
||||
* key must stay unique (a duplicate would be last-write-wins). The reserved
|
||||
* folder values (`'folder'`/`'folder-open'`) never appear here — directories
|
||||
* resolve through `builtinFolderIcon`.
|
||||
*/
|
||||
const GROUPS: readonly GlyphGroup[] = [
|
||||
[['md', 'markdown', 'mdx'], (size) => <VscMarkdown size={size} />],
|
||||
|
||||
Reference in New Issue
Block a user