+ {doc.translators.length > 1 && (
+
+ 翻译
+ ({ value: t.id, label: t.label }))}
+ onChange={id => postMessage({ type: 'selectTranslator', id })}
+ title="选择翻译方式"
+ className="w-40 text-left"
+ />
+
+ )}
+ {doc.error !== undefined && (
+
+
+
+
+ 解析失败:
+ {doc.error}
+
+
点编辑器右上角的「编辑」查看源码。
+
+
+ )}
+ {doc.blocks.length > 0
+ ?
+ : doc.error === undefined &&
这个文件里没有代码。
}
+
+ )
+}
diff --git a/vscode/webview-ui/src/codeReader/BlockTree.tsx b/vscode/webview-ui/src/codeReader/BlockTree.tsx
new file mode 100644
index 0000000..c2cef73
--- /dev/null
+++ b/vscode/webview-ui/src/codeReader/BlockTree.tsx
@@ -0,0 +1,118 @@
+import type { ReactElement } from 'react'
+import type { BlockKind, BlockView } from './types'
+import { ChevronDown, ChevronRight, Eye, Pencil } from 'lucide-react'
+import { Fragment } from 'react'
+import { cn } from '@/lib/utils'
+import { CodeEditor } from './CodeEditor'
+import { SegmentText } from './SegmentText'
+
+const KIND_LABEL: Record