feat(vscode): draw the diagram in the pilot's style, filled from a server palette - #390
Merged
Merged
Conversation
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Contributor
Author
…rver palette A Style list in the diagram panel, backed by `opensysml.diagram.style`, picks the look of every diagram: `theme` follows the VS Code colour theme as before, `pilot` is the pilot visualizer's Standard B&W that the DOT and PlantUML forms follow, and each of the eight palettes is that look filled by keyword family. The colours come from the server: `opensysml/render` with a `palette` gives each node its `fill` and `border` (`Rendering.Fills`), the same hex the DOT and PlantUML forms of that view take, advertised as `openSysmlRenderPalette`. The canvas sets them as custom properties and computes no colour itself; against an older server a palette draws as `pilot` and the panel says why. Co-Authored-By: jason.han <hanhuijun@gmail.com>
…seded style The box class the pilot look reads no longer changes what the theme look draws: every non-definition box keeps its rounded corners as before, and the pilot rules square packages and regions in CSS. A render request captures the style it was asked in; when the setting has moved by the time the server answers, the drawing is dropped rather than restyling the panel back, since the change already queued a render in the new style. Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
devin-ai-integration
Bot
force-pushed
the
feature/diagram-pilot-style
branch
from
September 19, 2026 18:34
f33e66e to
267a22a
Compare
Fills gave every filled node the family colour as its border, but the PlantUML form draws no border colour on a participant, so a sequence panel coloured its participants' outlines while the export did not. A rendering of KindSequence now carries the fill alone, through the same predicate the PlantUML writer uses, and the canvas sets --node-fill and --node-border independently so a fill without a border still applies. Fills is pinned to the PlantUML form of every golden rendering, sequences included. Co-Authored-By: jason.han <hanhuijun@gmail.com>
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.
What and why
The diagram panel drew every diagram in the VS Code colour theme, while the DOT and PlantUML forms of the same view follow the pilot visualizer's Standard B&W and can be filled from eight colourblind-safe palettes. This PR gives the panel the same looks, selectable.
Style list. A Style
<select>in the panel toolbar, backed by a newopensysml.diagram.stylesetting, picks the look of every diagram:theme(default) — as before, colours from the VS Code theme.pilot— the pilot's Standard B&W asdocs/project/view-rendering-forms.md#stylespecifies it: white canvas, black sans-serif text, 0.5 px#181818borders, square definitions / rounded usages, 1.5 px packages, dashed regions, bold name over a small italic«kind», 3 px arrowless connections, dashed flows, filled black pseudo-states.okabe-ito,tol-bright,tol-muted,tol-light,brewer-set2,brewer-dark2,viridis,cividis— that look filled by keyword family; a usage a lighter tint of its definition's colour, text black.Changing the list writes the setting (at the level that set the value in force) and every open panel restyles and re-renders; the choice survives a panel restore.
Colour comes from the server, not the webview. Rather than reimplement the palette algorithm (family assignment, usage tint, WCAG-AA lightening, control-node exclusions) in TypeScript where it would drift, the render result carries it:
Fillsreads the samefamilyFillsthe DOT and PlantUML writers use, so the panel, a DOT export and a PlantUML export of one view agree hex for hex. The server advertisesexperimental.openSysmlRenderPalette; the panel asks for a palette only when it does, and against an oldersysml-lspdrawspilotwith a hint under the diagram saying why.Canvas. Each box gets a class from its kind (
package/definition/region/usage) so CSS can draw the pilot's shape rules, and a node'sfill/borderland as--node-fill/--node-bordercustom properties on its shape. Editing attributes (data-opensysml-id,data-kind), drag, drop-to-re-parent, waypoints and the context menu are untouched.Not in scope. The pilot's
-[thickness=5]-binding connectors: the renderer has no binding edge kind to style.How it was verified
Go:
internal/ir/view:TestFillsMatchDOTpins every fill/border to the colour the DOT form writes for the same node, across palettes and view kinds;TestFillsOutsideThePalettepins that B&W nodes, unfilled containers, tables and an empty palette yield nothing, and an unknown palette the registry's error.internal/frontend/lsp: render tests for a named palette (fields present, matching the artifact), no palette (fields absent from the JSON), and the capability ininitialize.Extension (
npm run typecheck,npm test— 166 tests):style.test.ts: registry order, labels for every style, fallback of unknown setting/saved values,paletteOf/pilotLook.manifest.test.ts: the setting's default, enum and descriptions match the registry.protocol.test.ts:fill/borderpass throughnormalizeRender; an older server's nodes carry neither.canvas.test.ts: box classes by kind, rounded usages, custom properties set only when both colours are present, identity attributes preserved, control nodes unfilled.Gates run locally:
go build ./...,go vet ./...,gofmt -l .(empty),make lint,go test ./...withOPENSYSML_REQUIRE_TRAINING_CORPUS=1 OPENSYSML_REQUIRE_PILOT_CORPORA=1,TestPilotLibraryXMIwith the corpus downloaded,make docs-check,go run -C tools ./cmd/doc-counts -check,npm run build -- --production.GUI verification in a real VS Code (Linux), against this branch's server and a v0.7.0 one for the fallback, is recorded in the comment below.
Checklist
make testandmake lintpass locallydocs/reference/lsp.md,editors/vscode/README.md,docs/project/view-rendering-forms.md,docs/internals/design/vscode-visual-modeling.md)changes/unreleased/diagram-pilot-style.added.md