✨ feat(vscode): Rust 的模块、常量和外部函数拆成卡片

This commit is contained in:
cruldra committed 2026-10-04 20:16:51 +08:00
1 parent e6345e3309
commit 04c4b9f710
13 files changed
+220 -92

No files matched your search

+4 -2
View File
@@ -12,7 +12,7 @@ export type { Node }
*/
export type BlockKind
= | 'import' | 'function' | 'class' | 'enum' | 'exception' | 'type' | 'field' | 'const' | 'variable'
| 'trait' | 'impl'
| 'trait' | 'impl' | 'module'
| 'if' | 'else' | 'loop' | 'try' | 'catch' | 'finally' | 'return' | 'statement' | 'comment'
| 'interpreter' | 'options' | 'case' | 'command' | 'pipeline'
| 'directive' | 'stage' | 'run' | 'copy' | 'setting' | 'label' | 'health' | 'start'
@@ -479,6 +479,7 @@ export interface ClassBlock extends BlockShape { kind: 'class', facts: ClassFact
export interface TraitBlock extends BlockShape { kind: 'trait', facts: ClassFacts }
/** Rust 的 impl:标题是「某类型 的方法」,方法是子块,放进方法表的某一行。 */
export interface ImplBlock extends BlockShape { kind: 'impl', facts: ClassFacts }
export interface ModuleBlock extends BlockShape { kind: 'module', facts: ClassFacts }
/** 枚举块的头部是整个枚举(成员都在属性表里讲),没有子块;库规则认出来的枚举(Python)是整个类,留下的方法等是子块。 */
export interface EnumBlock extends BlockShape { kind: 'enum', facts: EnumFacts }
/** 异常块的头部是整个类(类属性都在属性表里讲),留下的方法(含构造函数)等是子块。 */
@@ -496,7 +497,7 @@ export interface StageBlock extends BlockShape { kind: 'stage', facts: StageFact
export interface HealthBlock extends BlockShape { kind: 'health', facts: HealthFacts }
export interface StartBlock extends BlockShape { kind: 'start', facts: StartFacts }
export type FactBlock
= | FunctionBlock | ClassBlock | TraitBlock | ImplBlock | EnumBlock | ExceptionBlock | ImportBlock | VariableBlock | InterpreterBlock | OptionsBlock
= | FunctionBlock | ClassBlock | TraitBlock | ImplBlock | ModuleBlock | EnumBlock | ExceptionBlock | ImportBlock | VariableBlock | InterpreterBlock | OptionsBlock
| DirectiveBlock | StageBlock | HealthBlock | StartBlock
/** 带说明(facts.doc)的块。 */
@@ -826,6 +827,7 @@ export const KIND_ICONS: Record<BlockKind, KindIconName> = {
class: 'box',
trait: 'network',
impl: 'square-function',
module: 'layers',
type: 'braces',
enum: 'list-ordered',
exception: 'triangle-alert',