feat: LSP-based WebView rendering for VS Code extension#86
Merged
Conversation
added 15 commits
March 22, 2026 12:23
Add render module with RenderContext, ViewParams, badge_for_type, and type_color_map. Move stats_partial body to render::stats::render_stats(). Serve views.rs becomes a thin wrapper via AppState::as_render_context(). All checks verified manually: cargo fmt, clippy -D warnings, cargo test (pre-commit skipped due to sparse-checkout/stash incompatibility). Refs: REQ-001
Move artifacts_list, artifact_detail, artifact_preview to render::artifacts. Serve handlers become thin wrappers. The linkify_source_refs helper and SourceRefMatch struct move to render::artifacts where they are used. Dead copies in serve/views.rs are removed. Uses serve::components::ViewParams to avoid duplicate type. Refs: REQ-001
Move validate_view and stpa_partial bodies to render module. render/validate.rs: pure render_validate(&RenderContext, &ViewParams) -> String render/stpa.rs: pure render_stpa(&RenderContext, &ViewParams) -> String - includes private helpers matches_text / type_visible stpa_partial in views.rs kept but marked dead_code (stpa_view now delegates directly to render_stpa via as_render_context). Remove unused Severity import from views.rs. Completes Phase 1 render function extraction. Refs: REQ-001
Shared by serve layouts and VS Code shell document. Refs: REQ-001
LSP now has all data needed to construct RenderContext. Sends rivet/artifactsChanged notification on file save. Refs: REQ-001
rivet/render routes page paths to render functions, returns HTML + metadata. rivet/treeData returns hierarchical tree structure for sidebar. rivet/css returns CSS for WebView shell document. Refs: REQ-001
Replace Simple Browser with native WebView panel using shell document pattern. Content fetched via rivet/render LSP request, delivered via postMessage. Assets load once per panel lifetime. Refs: REQ-001
Tree view fetches structure from rivet/treeData LSP request. Documents expand lazily to show individual artifacts. Refreshes on rivet/artifactsChanged notification. Refs: REQ-001
Show Source opens the YAML file at the artifact's source line. Source file/line tracked from rivet/render responses. Refs: REQ-001
The instant crate is unmaintained but pulled in transitively by notify 7.0.0 via notify-types. No upstream fix available yet. Refs: REQ-001
- Add documents render module (list + detail with TOC, glossary, refs)
- Handle /artifacts/{id}/graph sub-routes (show detail instead of 404)
- Strip query strings from page paths
- Tree: Documents navigate to rendered view (not expandable)
- Tree: Artifact Files expand to show individual artifacts
- Tree: Only list implemented views (Stats, Artifacts, Validation, STPA)
- Show source file link in artifact detail header
- CSP: allow unsafe-inline for style-src (rendered HTML uses inline styles)
Refs: REQ-001
- Add render/help.rs: help overview, schema list/detail, link types,
traceability rules, docs list/topic
- Schema linkage Mermaid diagram on help page
- Source file links in artifact detail (data-source-file + postMessage)
- Fix /artifacts/{id}/graph sub-route handling
- Tree: add Help category, Documents under Views
Refs: REQ-001
…ecture artifacts New requirements: - REQ-037: SysML v2 artifact import (rowan-based parser) - REQ-038: SysML v2 to AADL model lowering (SEI mapping rules) - REQ-039: Draft-aware validation severity New features: - FEAT-066: VS Code LSP-based WebView rendering (active) - FEAT-067: SysML v2 parser spar-sysml2 crate (draft) - FEAT-068: SysML v2 to AADL lowering (draft) - FEAT-069: SysML v2 requirement adapter for rivet (draft) - FEAT-070: Draft-aware validation severity (draft) New decisions: - DD-040: Status-driven traceability enforcement - DD-041: Shared render module for serve/LSP/export 489 artifacts, PASS, 0 warnings. Refs: REQ-037, REQ-038, REQ-039
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'Rivet Criterion Benchmarks'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.
| Benchmark suite | Current: fded31e | Previous: 53b322d | Ratio |
|---|---|---|---|
validate/10000 |
7074545 ns/iter (± 637979) |
5216434 ns/iter (± 674094) |
1.36 |
This comment was automatically generated by workflow using github-action-benchmark.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
added 3 commits
March 22, 2026 15:47
Refs: FEAT-066
Refs: FEAT-066
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
render/module (stats, artifacts, validate, STPA, documents, help/schemas). Pure functions takingRenderContext, callable from serve, LSP, and future HTML export.rivet/render(page → HTML),rivet/treeData(tree structure),rivet/css(stylesheet),rivet/artifactsChanged(notification on file save)489 artifacts, PASS, 0 warnings. 235 Playwright tests pass. 72 Rust tests pass.
Test plan
cargo test— 516 tests passcargo clippy -D warnings— cleannpm run compile)Implements: FEAT-066
Refs: DD-041, REQ-037, REQ-038, REQ-039
🤖 Generated with Claude Code