✨ feat(vscode): 代码阅读预览 Rust 的语言卡片

This commit is contained in:
cruldra committed 2026-10-04 14:24:55 +08:00
1 parent 4480f936f3
commit 6d58b681cf
15 files changed
+1016 -6

No files matched your search

@@ -208,10 +208,12 @@ function slotChild(node: Node, slot: Exclude<TemplatePart, string>): Node | null
}
const ATTRIBUTE_ZH: Record<CommonAttribute, string> = { kind: '种类', access: '访问级别', async: '异步', abstract: '抽象', typeOnly: '仅类型' }
const KIND_ZH: Record<BlockKind, string> = {
export const KIND_ZH: Record<BlockKind, string> = {
import: '导入',
function: '函数',
class: '类',
trait: '特质',
impl: '实现',
enum: '枚举',
exception: '异常',
type: '类型',
@@ -249,7 +251,7 @@ const ARGUMENT_COLUMNS = ['参数', '值']
const YES_NO: Record<'true' | 'false', string> = { true: '是', false: '否' }
/** 筛选属性和值的中文叫法;属性表里的访问级别、异步、抽象、仅类型这几行,属性名和值也用这一套。 */
const ZH_ATTRIBUTE_NAMES: AttributeNames = {
export const ZH_ATTRIBUTE_NAMES: AttributeNames = {
attributes: ATTRIBUTE_ZH,
values: { kind: KIND_ZH, access: ACCESS_ZH, async: YES_NO, abstract: YES_NO, typeOnly: YES_NO },
}
@@ -704,6 +706,8 @@ export function createZhTemplateTranslator(table: ZhTable): Translator {
case 'function':
return functionRows(block.facts, phrases)
case 'class':
case 'trait':
case 'impl':
return classRows(block.facts, phrases)
case 'enum':
return enumRows(block.facts, phrases)