Skip to content

Commit 432325a

Browse files
authored
feat: simplify module graph navigation and optimize large projects (#20)
* feat: simplify and optimize module graph navigation (0.9.0) * fix: preserve valid selections across entry page navigation * fix: bound test glob matching and preserve mcpp discovery semantics * feat: move node actions to accessible context menu and recover dropped metadata events * test: distinguish large-project graph from retained fixture views * fix: leave test pagination when focusing an individual entry * test: use provider entry identity across platforms
1 parent f667b5b commit 432325a

44 files changed

Lines changed: 1759 additions & 241 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.agents/docs/2026-10-20-module-graph-interaction-performance-design.md‎

Lines changed: 284 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Modules graph 0.9.0 validation and review
2+
3+
Status: implementation and local review complete. The repository suite passes 725 tests; Chromium passes 11 interaction/export groups. Exact-head CI and released-artifact verification are final release gates.
4+
5+
## Review perspectives
6+
7+
| Perspective | Findings addressed | Evidence |
8+
| --- | --- | --- |
9+
| Graph semantics | Test-root budget starvation; parent traversal bringing sibling dependencies; edge limits stranding nodes; library classification based on target spelling | Graph/model and module provider regressions; large-project projection |
10+
| Interaction | Click opening files; repeated expansion doing nothing; selected/focus/camera ambiguity; initial root centering overriding Fit; test paging lingering after entry focus | Chromium canvas tests; real VS Code fixture navigation; host regression for leaving the pager and restoring its page with Back |
11+
| Refresh and concurrency | Event bursts starting duplicate reads; lock changes querying Modules; hidden refreshes; old view publications arriving after a project switch | Refresh coordinator tests and the real host module under a controlled message transport |
12+
| Project state | Empty declarations removing the row; incomplete manifests clearing usable dependencies; delayed project switching exposing old actions | Dependency state tests; immediate cross-project update; real VS Code empty → ready → stale → ready checks with the installed VSIX |
13+
| Cache correctness | Identical SVGs in different projects retaining old node identities | Chromium test proves layout reuse with new event bindings |
14+
| Export | Theme variables missing offline; transformed/cropped drawing; excessive raster size | Light/dark standalone SVG and PNG, decoded dimensions, Unicode and marker inspection |
15+
| Compatibility | Shared Packages canvas, read-only source documents, old language service commands | Existing unit and five service-variant Extension Host suites; real source read-only checks |
16+
| Release and privacy | Local paths in the initial design; accidental Marketplace publication; packaged local evidence | Sanitized design, manual Marketplace workflow, archive inclusion/size gates |
17+
18+
## Local measurements
19+
20+
The mcpp baseline snapshot contains 343 retained nodes and 1,648 imports. Its roots include 149 test files. The old initial projection has 150 nodes and zero edges. The new Main projection has 51 nodes and 80 edges; complete source data remains available behind focus and paging.
21+
22+
Twenty fresh layouts using shipped Mermaid in Chromium measured median 163 ms and p95 171 ms for that real projection. These measurements include smaller budgets and removal of repeated import labels; they do not claim an equally sized layout algorithm became faster. Wide, shared and many-test synthetic samples also stay within the initial layout target.
23+
24+
The simplified toolbar combines formats and Mermaid copy under Export, moves depth controls into View options, and exposes node operations through the node context menu. Chromium checks cover right-click targeting, Shift+F10, arrow navigation, dismissal and focus restoration, plus control alignment and distinct theme colors.
25+
26+
A local native watcher resource exhaustion reproduced missing file events. The sidebar now supplements watchers and editor saves with two metadata stamps every two seconds while visible. Unchanged stamps cause no CLI query or layout. A real subprocess cancellation check also verifies that aborting a provider read terminates the child process.
27+
28+
Cold CLI queries still depend on mcppls indexing. No fan-speed or whole-editor power claim is made. Incomplete snapshots remain explicit; unchanged partial results stop automatic retrying.
29+
30+
## Required final gates
31+
32+
- Full repository consistency/unit suite and the new Chromium job.
33+
- Existing Linux/macOS/Windows Extension Host and isolated VSIX install jobs, package guards and upstream drift check.
34+
- Real VS Code large-project entry/test paging and selected-node focus: passed locally with the installed VSIX; repeat on the released artifact.
35+
- Squash merge followed by successful tag release, GitHub/Open VSX artifact verification and local validation of the exact released VSIX.
36+
37+
Local screenshots and raw fixtures remain ignored development artifacts. Public evidence uses fixture names and aggregate statistics, without machine paths or editor profile data.

‎.agents/docs/README.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
| [`architecture.md`](architecture.md) | mcpp-vscode 的分层结构、模块职责与扩展点 | 现状 |
99
| [`mcpp-integration.md`](mcpp-integration.md) | 与 `mcpp-community/mcpp`(mcpp CLI)的接口契约 | 现状 |
1010
| [`mcppls-integration.md`](mcppls-integration.md) | 与 `sunrisepeak.mcpp-language-server`(mcppls)的依赖与命令桥接契约 | 现状 |
11-
11+
| [`2026-10-20-module-graph-interaction-performance-design.md`](2026-10-20-module-graph-interaction-performance-design.md) | Modules 根分组、选择/焦点、局部展开、性能、Dependencies 状态与刷新、SVG/PNG 导出 | 0.9.0 实施中 |
12+
| [`2026-10-20-module-graph-validation.md`](2026-10-20-module-graph-validation.md) | 0.9.0 多视角 review、性能与发布验收记录 | 验证中 |
1213

1314
边界:
1415

‎.agents/docs/architecture.md‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,13 @@ extension.ts VS Code 装配层:激活、命令注册、provide
9595

9696
## 8. Shared dependency canvas and C++ Modules graph
9797

98-
- `graphs/model.ts` defines a provider-independent graph, component roots, depth/branch projection, 150-node/300-edge layout budgets and escaped Mermaid output. Complete module data is retained independently of the visible subgraph.
98+
- `graphs/model.ts` defines a provider-independent graph, component roots, depth/branch projection, 60-node/80-edge default layout budgets (150/300 model ceiling), importer/dependency traversal, virtual entry groups and escaped Mermaid output. Complete module data is retained independently of the visible subgraph.
9999
- `projects/dependencyGraphPanel.ts` owns one persistent Webview with separate per-project/per-kind graph and navigation states. `graphs/panelHtml.ts` and `media/graph.js` share rendering, wheel/pointer navigation, folding, focus, search and theme handling. Layouts are serialized; obsolete provider requests are discarded.
100100
- `cli/moduleGraph.ts` is a trust-gated, time/output-bounded consumer of mcppls CLI JSON. This extends the integration boundary with structured queries, without taking over C++ parsing, resolution, LSP ownership or mcppls settings. Prefer the installed dependency extension's payload, with PATH fallback when absent.
101101
- `projects/moduleGraph.ts` validates the result, reads manifest entry conventions and determines file ownership by the nearest project manifest. Preserve all internal edges and just the first hop into another package; `external=false` alone cannot identify project ownership. Generated sources outside the project boundary are conservatively treated as external.
102102
- `webview/readOnlyDocuments.ts` is the shared content-addressed virtual-document store used by examples and graph navigation; graph messages contain node identities, and the host opens only provider files attached to those identities.
103103
- Basics contains C++ Modules Deps; declared package Dependencies follow as a collapsed sibling before Common commands. Existing language-server module-graph forwarding commands remain compatible.
104+
105+
- `graphs/refresh.ts` coalesces events with a bounded debounce, serializes cancellable reads and defers hidden work. File and task events invalidate provider snapshots; content signatures suppress redundant layouts. Partial CLI snapshots retry only while changing and within a finite budget.
106+
- `graphs/export.ts` bounds and validates SVG/PNG bytes before the host saves them. The browser inlines computed SVG styles and rasterizes the same drawing, independent of the camera.
107+
- `projects/dependencyState.ts` rejects incomplete manifests and retains the last usable dependency rows on transient errors. Successful empty declarations produce an information row instead of removing the Dependencies position.

‎.github/workflows/ci.yml‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,3 +230,22 @@ jobs:
230230
VERSION=$(printf '%s\n' "$LIST" | sed -n 's/^sunrisepeak\.mcpp-language-server@//p')
231231
echo "resolved mcppls $VERSION"
232232
echo "resolved mcppls \`$VERSION\`" >> "$GITHUB_STEP_SUMMARY"
233+
234+
graph-browser:
235+
runs-on: ubuntu-latest
236+
steps:
237+
- uses: actions/checkout@v4
238+
- uses: actions/setup-node@v4
239+
with:
240+
node-version: ${{ env.NODE_VERSION }}
241+
cache: npm
242+
- run: npm ci
243+
- run: npx playwright install --with-deps chromium
244+
- name: Render and interact with the shipped graph in Chromium
245+
run: npm run test:graphs-ui
246+
- uses: actions/upload-artifact@v4
247+
if: always()
248+
with:
249+
name: graph-browser-evidence
250+
path: .dev-profile/graph-ui-artifacts
251+
if-no-files-found: warn

‎.github/workflows/release.yml‎

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,8 @@ jobs:
8484
--generate-notes
8585
fi
8686
87-
# 两个市场收到的都是刚上传给 GitHub Release 的同一只 VSIX(SHA-256 对得上)。
88-
# 分工是作者定的:Open VSX 是本流水线的必发目标——缺 token 显式失败,不静默跳过;
89-
# Marketplace 机会发布——没配 token 就打一行说明跳过,Release 本身不因此失败。
90-
# secret 名即仓库已配置的 OPENVSX_TOKEN;--pat 显式传入,不依赖 CLI 的环境变量约定。
87+
# Open VSX receives the exact VSIX attached to the GitHub Release.
88+
# Marketplace upload uses that same artifact through the publisher portal.
9189
- name: 发布到 Open VSX
9290
shell: bash
9391
env:
@@ -102,14 +100,6 @@ jobs:
102100
fi
103101
npx ovsx publish "mcpp-vscode-${PACKAGE_VERSION}.vsix" --pat "$OPENVSX_TOKEN"
104102
105-
- name: 发布到 Visual Studio Marketplace(未配置 token 则跳过)
106-
shell: bash
107-
env:
108-
VSCE_PAT: ${{ secrets.VSCE_PAT }}
109-
run: |
110-
set -euo pipefail
111-
if [ -z "${VSCE_PAT:-}" ]; then
112-
echo "未配置 VSCE_PAT:跳过 Marketplace 发布(Open VSX 与 GitHub Release 不受影响)。"
113-
exit 0
114-
fi
115-
npx vsce publish --packagePath "mcpp-vscode-${PACKAGE_VERSION}.vsix"
103+
# The signed-off VSIX is uploaded manually to Visual Studio Marketplace.
104+
- name: Marketplace upload artifact
105+
run: echo "Upload the GitHub Release VSIX manually to Visual Studio Marketplace."

‎CHANGELOG.md‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
## Unreleased
22

3+
## 0.9.0 - 2026-10-20
4+
5+
- Node operations use a keyboard-accessible right-click menu. Refresh/Export use theme colors, aligned chevrons and matching control heights; depth selectors align in View options.
6+
- Visible project metadata checks recover Dependencies updates when native file events are dropped, without repeated CLI reads for unchanged files.
7+
8+
- Group module entries into Main, Library, Tests and Other, with paged test entries and a connected default view for large projects.
9+
- Separate selection, focus and camera navigation: click to select, double-click to open source, locate either selection or focus, and explore two importer levels alongside three dependency levels. Local expansion advances repeatedly and preserves shared branches.
10+
- Coalesce graph refresh events, cancel obsolete queries, reuse unchanged layouts and pause hidden graph work. Preserve dependency rows through transient manifest failures and show a status line when no declarations are available.
11+
- Keep entry/search controls visible and group export formats, view settings and node actions into compact menus.
12+
- Export the visible graph as offline SVG or bounded PNG without expanding or querying the full project. Add Chromium coverage for graph interaction, layout reuse and exports.
13+
- Release VSIX remains available on GitHub and Open VSX; Visual Studio Marketplace upload is manual.
14+
315
## 0.8.0 - 2026-10-19
416

517
- Package details use the available editor width on fullscreen displays, with bounded side gutters and a compact metadata column.

‎README.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ its own and only **forwards** to it ([docs/architecture.md](docs/architecture.md
2121
| [mcpp-language-server](https://github.com/Sunrisepeak/mcpp-language-server) | The C++ Modules language service; a hard dependency of this extension | [Marketplace](https://marketplace.visualstudio.com/items?itemName=sunrisepeak.mcpp-language-server) · [Open VSX](https://open-vsx.org/extension/sunrisepeak/mcpp-language-server) |
2222
| mcpp-vscode (this extension) | The VS Code front end | [Marketplace](https://marketplace.visualstudio.com/items?itemName=mcpp-community.mcpp-vscode) · [Open VSX](https://open-vsx.org/extension/mcpp-community/mcpp-vscode) · [Releases](https://github.com/mcpp-community/mcpp-vscode/releases) |
2323

24+
See [dependency graph navigation and exports](docs/dependency-graphs.md) for entry groups, importer depth, refresh behavior and SVG/PNG export.
25+
2426
## Install
2527

2628
Any of the three channels installs the same extension:
@@ -73,8 +75,7 @@ that never touches your real one.
7375

7476
Release: bump the version in `package.json` and `package-lock.json`, commit, and push a tag
7577
matching the version exactly. The workflow runs the tests, packages one VSIX, and publishes that
76-
same artifact to GitHub Releases and Open VSX — and to the Marketplace when its token is
77-
configured.
78+
same artifact to GitHub Releases and Open VSX. Upload that VSIX manually through the Visual Studio Marketplace publisher portal.
7879

7980
## License
8081

‎README.zh-CN.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ C++ 模块语义——诊断、补全、悬停、定义、引用、模块图—
2121
| [mcpp-language-server](https://github.com/Sunrisepeak/mcpp-language-server) | C++ Modules 语言服务;本扩展的硬依赖 | [Marketplace](https://marketplace.visualstudio.com/items?itemName=sunrisepeak.mcpp-language-server) · [Open VSX](https://open-vsx.org/extension/sunrisepeak/mcpp-language-server) |
2222
| mcpp-vscode(本扩展) | VS Code 前端 | [Marketplace](https://marketplace.visualstudio.com/items?itemName=mcpp-community.mcpp-vscode) · [Open VSX](https://open-vsx.org/extension/mcpp-community/mcpp-vscode) · [Releases](https://github.com/mcpp-community/mcpp-vscode/releases) |
2323

24+
模块入口分组、父节点深度、局部展开、刷新和 SVG/PNG 导出见 [依赖图使用说明](docs/dependency-graphs.md)。
25+
2426
## 安装
2527

2628
三个渠道装到的是同一个扩展:
@@ -71,8 +73,8 @@ C++ 模块语义——诊断、补全、悬停、定义、引用、模块图—
7173
不会碰你自己的)。
7274

7375
发布:把 `package.json` 与 `package-lock.json` 的版本号改好并提交,推送与版本完全一致的
74-
tag。工作流会跑测试、打包同一只 VSIX,并把它发到 GitHub Releases 与 Open VSX——Marketplace
75-
在配置了 token 时同样自动发布。
76+
tag。工作流会跑测试、打包同一只 VSIX,并发布到 GitHub Releases 与 Open VSX。官方 Marketplace
77+
使用 Release 中的同一 VSIX 手动上传。
7678

7779
## 许可证
7880

‎data/i18n/zh-cn.json‎

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,5 +588,31 @@
588588
"Packages show declarations; modules show mcppls imports. External modules stop after one hop.": "包图显示声明关系;模块图来自 mcppls,外部模块只显示一层。",
589589
"Source is unavailable for this module.": "此模块的源码不可用。",
590590
"Choose a module source file": "选择模块源码文件",
591-
"The source graph is incomplete. Some modules may be omitted.": "源图数据不完整,部分模块可能尚未包含。"
591+
"The source graph is incomplete. Some modules may be omitted.": "源图数据不完整,部分模块可能尚未包含。",
592+
"Could not export this graph. Try SVG or a smaller view.": "无法导出此图,请尝试 SVG 或更小的视图。",
593+
"Entry group": "入口分组",
594+
"Selected": "选中",
595+
"Export SVG": "导出 SVG",
596+
"Export PNG": "导出 PNG",
597+
"Dependencies depth": "依赖深度",
598+
"Importers depth": "父节点深度",
599+
"Previous entries": "上一批入口",
600+
"Next entries": "下一批入口",
601+
"Back": "后退",
602+
"Locate focus": "定位焦点",
603+
"Locate selected": "定位选中",
604+
"Open source": "打开源码",
605+
"Expand importers": "展开父节点",
606+
"Collapse importers": "折叠父节点",
607+
"Focus this result": "以此结果为焦点",
608+
"Dependencies unavailable — click to retry": "暂时无法读取依赖,点击重试",
609+
"Reading dependencies…": "正在读取依赖…",
610+
"This project declares no dependencies": "此项目未声明依赖",
611+
"Refresh pending": "等待刷新",
612+
"Main": "主程序",
613+
"Tests": "测试",
614+
"Other": "其他",
615+
"Export": "导出",
616+
"View options": "视图",
617+
"Node actions": "节点操作"
592618
}

0 commit comments

Comments
 (0)