Skip to content

fix(vscode): draw a table rendering as a table - #534

Merged
HuiJun merged 2 commits into
developfrom
fix/panel-table-rendering
Sep 22, 2026
Merged

HuiJun merged 2 commits into
developfrom
fix/panel-table-rendering

Conversation

@devin-ai-integration

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

Copy link
Copy Markdown
Contributor

What and why

A table-kind view (render asElementTable) or the #table pseudo-view showed up in the diagram panel as its raw Markdown source in a <pre> — HTML comment, pipe characters and all — so it looked broken even though the server rendered it fine.

The panel now draws the rendering's structured rows/columns (which opensysml/render already returns alongside the Markdown artifact) as a real HTML table, and a row whose element the server traced to a declaration opens that declaration in the editor when clicked, the way a node click does. The cursor highlight works the other way too: a row whose origin range holds the cursor is marked selected.

webview/table.ts        tableOf(result): HTMLElement          // thead from columns, one tr per row, textContent cells
webview/diagram.ts      draw(): non-mermaid → tableOf(result)
                        click on tr.located → post { type: "revealRow", row, drawn }
                        highlight("row:<i>") marks that tr
protocol.ts             FromWebview += { type: "revealRow"; row; drawn }
edits.ts                Rendering.rows?: RenderRow[]
diagram.ts (host)       revealSource/revealRow → shared revealOrigin(origin)
                        highlightAt falls back to the row containing the cursor

Table styling uses VS Code theme variables, with B&W variants under the pilot look.

table

How it was verified

  • npm --prefix editors/vscode run typecheck, npm --prefix editors/vscode test (182 pass; 4 new tests in webview/table.test.ts: headers + located rows + literal-text cells, ragged-row padding, empty state, absent columns).
  • python3 scripts/changelog.py check, make vscode-package.
  • By hand in VS Code against bin/sysml-lsp: #table pseudo-view and a declared partsTable view render as tables; clicking the w row selects w in the source; moving the cursor onto Car highlights its row.

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

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 18:37

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

Desktop verification on e15cc12 with a freshly packaged and installed VSIX in VS Code.

  • #table renders an HTML table with Element / Kind / Type / Declared in headers and the expected rows; no raw Markdown.
  • The declared partsTable view renders its three exposed rows.
  • Clicking w selects exactly its identifier in the source; cursor on Car highlights its row, cursor on the nested w highlights only w.
  • Pilot style stays readable; an unsaved part def Engine; redraws the table at once; an empty exposure shows "No elements to list."
  • Regression: the tree still draws, and a node click still reveals its declaration.
Pseudo-view table Row click selects the source
table click

@HuiJun
HuiJun merged commit e0633f8 into develop Sep 22, 2026
15 checks passed
@HuiJun
HuiJun deleted the fix/panel-table-rendering branch September 22, 2026 20:44
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