From 4f09e515eec856c77a1055491bb0873e31de57e1 Mon Sep 17 00:00:00 2001 From: cflmy Date: Mon, 14 Sep 2026 14:04:45 +0800 Subject: [PATCH] feat(view): mark prose-inferred params in Structure Show inferred function parameters with a dashed chip and outline annotation so view surfaces v0.3 param elevation without changing the redundant call surfaces. Co-authored-by: Cursor --- doc/design/markdown-mapping-v0.3.md | 2 +- doc/roadmap/markup-v0.3.md | 2 +- src/view/html.rs | 19 ++++++++++ src/view/render.rs | 54 ++++++++++++++++++++++++++++- 4 files changed, 74 insertions(+), 3 deletions(-) diff --git a/doc/design/markdown-mapping-v0.3.md b/doc/design/markdown-mapping-v0.3.md index cd73697..2de8e67 100644 --- a/doc/design/markdown-mapping-v0.3.md +++ b/doc/design/markdown-mapping-v0.3.md @@ -570,7 +570,7 @@ FnDef.params: | 4 | `` `n`+1 `` 误声明 | 建议 | 仅完整单个 code span `` `ident` `` 触发声明 | | 5 | 叙述强调斜体 vs 返回 | 建议 | 函数体内合法返回表达式才当返回;否则当文字 | | 6 | 一行多 `**…**` | **建议采纳** | 允许,按出现序执行(M0 钉死为是) | -| 7 | view 展示 prose Decl | 建议 | Variables 列绑定图 + 标注是否已升参 | +| 7 | view 展示 prose Decl | **已落地** | Structure / Functions 大纲:`inferred` 形参标注(`chip inferred`) | --- diff --git a/doc/roadmap/markup-v0.3.md b/doc/roadmap/markup-v0.3.md index a243fde..9f6e2d1 100644 --- a/doc/roadmap/markup-v0.3.md +++ b/doc/roadmap/markup-v0.3.md @@ -60,7 +60,7 @@ ### M4 — 双后端与工具 - [x] 字节码发射跟随新 Stmt 源 -- [ ] `view` / Variables:显示推断形参与 prose Decl +- [x] `view` / Structure:推断形参 `chip inferred` + Functions 大纲标注 - [ ] (可选)`marqdo migrate markup-v03` 机械改写提示/工具 **出门:** tree 与 bytecode 后端对 `markup-v03` 金样一致。 diff --git a/src/view/html.rs b/src/view/html.rs index f3c2613..aa3556b 100644 --- a/src/view/html.rs +++ b/src/view/html.rs @@ -355,6 +355,16 @@ section.block > h2 { border: 1px solid transparent; color: var(--ink); } +.chip.inferred { + border-style: dashed; + border-color: var(--line); + opacity: 0.92; +} +.chip.inferred::after { + content: " ↑"; + font-size: 0.65em; + opacity: 0.7; +} .nested { margin: 0.45rem 0 0.15rem 0.15rem; padding-left: 0.85rem; @@ -684,6 +694,15 @@ section.block > h2 { font-size: 0.66rem; margin-left: 0.2rem; } +.outline-item .ol-params { + margin-left: 0.25rem; + font-family: var(--mono); + font-size: 0.62rem; + color: var(--muted); +} +.outline-item .ol-param.inferred { + border-bottom: 1px dashed var(--line); +} .fun-card:target { outline: 2px solid var(--focus); outline-offset: 2px; diff --git a/src/view/render.rs b/src/view/render.rs index 4fccd1e..b634f0f 100644 --- a/src/view/render.rs +++ b/src/view/render.rs @@ -812,6 +812,26 @@ fn outline_fun(fun: &Function, parent_path: &str) -> String { escape(&fun.name), fun.level, ); + if !fun.params.is_empty() { + s.push_str(" "); + for (i, p) in fun.params.iter().enumerate() { + if i > 0 { + s.push(' '); + } + if p.inferred { + s.push_str(&format!( + "{}", + escape(&p.name) + )); + } else { + s.push_str(&format!( + "{}", + escape(&p.name) + )); + } + } + s.push_str(""); + } if !fun.children.is_empty() { s.push_str("