Skip to content

feat(vscode): lay unplaced nodes out with ELK and route edges around boxes - #535

Merged
HuiJun merged 5 commits into
developfrom
feature/panel-auto-layout
Sep 22, 2026
Merged

HuiJun merged 5 commits into
developfrom
feature/panel-auto-layout

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

What and why

Nodes the model does not place took slots in a √n grid, and every edge ran straight from centre to centre — across whatever boxes lay between. The pilot visualizer gets its tidy diagrams from Graphviz; the panel now gets the same from ELK (elkjs, bundled into the webview): layered placement and orthogonal edges routed around the boxes.

webview/autolayout.ts   autoLayout(result): Promise<AutoLayout | undefined>
                        // ELK layered, INCLUDE_CHILDREN, ORTHOGONAL; DOWN for tree/action, RIGHT for state/interconnection
                        // undefined for sequence/table kinds and above AUTO_LAYOUT_LIMIT (600 nodes)
                        interface AutoLayout { nodes: Map<id, LayoutGeometry>; routes: Map<edgeIndex, RenderPoint[]> }
webview/layout.ts       layoutCanvas(result, overrides, auto?)
                        // node geometry: gesture override → model Layout → auto (auto never sets `pinned`)
                        // edge: override → model Route → auto route, only when neither end is pinned → straight
webview/diagram.ts      draw(): grid shown at once, "Laying out…" status, ELK layout swapped in when it resolves

A node the model places, or one the user drags, is still drawn exactly where stated, and edges at it run straight (ELK's route was computed around its old place). Renderings beyond 600 nodes keep the grid so a large migrated model does not hang the panel.

skipLibCheck is enabled in both tsconfigs because elkjs's own .d.ts does not compile under this project's strict options (same setting editors/syson/frontend already uses). dist/webview.js grows from 48 KB to 3.5 MB (the ELK engine).

state

How it was verified

  • npm --prefix editors/vscode run typecheck, npm --prefix editors/vscode test (184 pass; new autolayout.test.ts covers DOWN/RIGHT ordering, orthogonal segments, anchors on borders, nested containers with root-relative edge coordinates, skipped self-loops/explicit routes, kind and size limits; layout.test.ts covers auto vs model vs gesture precedence).
  • python3 scripts/changelog.py check, make vscode-package.
  • By hand in VS Code: tree, interconnection and state renderings of a small model; dragging a node writes its Layout and its edges go straight while the rest stay routed.

Checklist

  • make test and make lint pass locally
  • Tests added or updated for the change
  • Documentation extended where it already covers the surface (see CONTRIBUTING.md)
  • Changelog entry added as changes/unreleased/<slug>.<section>.md, not as an edit to CHANGELOG.md
  • baselines regenerated and make docs-counts run if a gate count moved (compliance rows need nothing: the census is counted at docs build)
  • No internal work-item labels (waves, slices, F4, K5) in the body, docs, or changelog

…boxes

Co-Authored-By: jason.han <hanhuijun@gmail.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

Co-Authored-By: jason.han <hanhuijun@gmail.com>
@devin-ai-integration
devin-ai-integration Bot marked this pull request as ready for review September 22, 2026 19:01
devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration Bot and others added 2 commits September 22, 2026 19:11
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
devin-ai-integration[bot]

This comment was marked as resolved.

Co-Authored-By: jason.han <hanhuijun@gmail.com>
@HuiJun
HuiJun merged commit 9cdedcc into develop Sep 22, 2026
15 checks passed
@HuiJun
HuiJun deleted the feature/panel-auto-layout branch September 22, 2026 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant