Skip to content

Commit a5225d3

Browse files
feat(docs): comprehensive VS Code docs (finos#2532)
* feat(docs): comprehensive VS Code Extension reference manual Closes finos#2531. Adds the new docs/docs/working-with-calm/vscode-extension.md reference manual modelled on calm-hub.md (PR finos#2523). 14 sections cover overview, installation, activity bar / tree view / search, interactive preview, themes (4-variant gallery), layout engines, real-time validation, hover, timeline, multi-doc navigation, live docify, configuration reference, and schema-developer mode. Cross-links one-way to the beginner tutorial, the core-concept widgets/timelines pages, and the CLI docify section — no existing docs are modified (the manual is complementary). Extends the screenshot tool (PR finos#2530 / issue finos#2529) with per-shot workbench-settings overrides and an optional workspaceFile, then implements 8 new shots: tree-search, 4 theme variants, 2 layout variants, and the preview's Template tab. Two TODO shots remain (hover, timeline) with the docs sections describing the feature textually and linking back to the issue. Implementation notes: - launch.ts gains `settingsOverrides` so each shot can pre-seed the user-data-dir with the specific workbench/extension settings it needs (themes, layout engine, etc.). - shots.ts gains `workspaceFile` for fixtures whose entry point isn't architecture.json (timeline uses arch-v1.json). - index.ts supports SHOOT_ONLY=<name1,name2> for development iteration without overwriting the manifest mid-flow. - New fixtures: timeline/ (multi-version + calm-timeline.json) and docify-template/ (architecture + Handlebars template). - 12 of 14 shots implemented, 2 declared TODO. Smoke test passes (63 assertions). Docusaurus build is clean (no broken anchors). * refactor(vscode): apply pre-PR review feedback - Clarify SHOOT_ONLY example in index.ts; previous example named a shot whose `implemented` flag is false, which would have produced zero outputs. - Note in shots.ts that `waitForDiagramRendered` returns on timeout rather than throwing, so a regression in the preview can silently produce a degraded PNG. Manual PR-diff review remains the gate. - Mark the 08-hover setup body as scaffolding retained for the TODO follow-up, so its dead-code state reads intentional. - Drop the empty `<div className="vscode-extension-theme-gallery">` wrapper in the docs page; no CSS rule referenced it. - Normalise "VSCode" → "VS Code" in the Getting Help link label for consistency with the page title. * docs(vscode): batched feedback — timeline, mapping, sidebar label - Rename sidebar label to "CALM Tools (VSCode)" via sidebar_label frontmatter (page title and URL unchanged). - Remove the tutorial-pointer paragraph from the intro; the manual stands on its own and the cross-link remains in Getting Help. - Drop the Hover Information section entirely. - Implement the timeline shot. The trick is firing onDidSaveTextDocument after the editor focuses the file — the initial onDidChangeActiveTextEditor on cold launch can race the extension's onStartupFinished activation and miss timeline detection. Manifest now has 13 implemented + 1 skipped (08-hover). - Expand the Timeline Navigation section with a working screenshot, a full calm-timeline.json example, how the extension renders timeline mode (sidebar replaces Nodes/Relationships/Flows with the moments list), and when to use it. - Expand Multi-Document Navigation with a how-it-works overview, the exact rules around mapping syntax (relative paths resolve against the mapping file's directory, not the workspace root), a complete worked example with a full workspace layout, and a troubleshooting list. All facts verified against navigation-service.ts. * chore(review): address Copilot review feedback - Rewrite the Documentation Generation section to describe the preview's three tabs accurately: Docify is the renderer, Template is a source viewer, Model is the parsed model. The previous prose called the Template tab a "live Handlebars renderer" — verifying against template-tab.view.ts, the Template tab is just `<pre>` of escaped source. - Re-shoot 10-docify clicking the Docify tab; capture now shows the rendered "Architecture Overview" + Client → Calls → Service diagram rather than raw template text. - Tidy the Interactive Preview section's tab breakdown to match. - Fix the Search & Filter section: the palette title is "Search Model Elements"; "Search CALM Architecture Elements" is the prompt inside the input box, not the command label. - Normalise the sidebar label to "CALM Tools (VS Code)" with a space, matching the page title and the rest of the prose. * fix(vscode): restore working light/dark theme shots; drop HC variants The previous attempt to fix the High Contrast Light screenshot regressed the working light shot by moving workbench.colorTheme out of the seeded settings into a runtime Color Theme picker call. The picker doesn't work reliably under --extensionDevelopmentPath on VSCode 1.121 because the theme list is registered asynchronously and the picker's highlighted row stays at "Searching for themes..." when Enter fires. Restore the working setting-at-launch approach for the standard light and dark themes (Default Light Modern / Default Dark Modern), which IS honoured at launch. The two HC variants are not honoured by the same path on this VSCode version regardless of label form (Default High Contrast Light, Light High Contrast, etc.). Mark them implemented:false with an explanatory block comment. The docs page's theme gallery is now light + dark only, with a short note that HC variants follow the same pattern and can be selected manually. Removes the two broken HC PNGs. Also adds the window.autoDetectColorScheme / autoDetectHighContrast settings to WORKBENCH_SETTINGS — harmless in the current state but defensive against future OS-driven theme overrides.
1 parent 1ba8e19 commit a5225d3

23 files changed

Lines changed: 915 additions & 103 deletions
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"$schema": "https://calm.finos.org/release/1.2/meta/calm.json",
3+
"unique-id": "docify-demo",
4+
"name": "Docify Demo",
5+
"description": "Small architecture used by the docify-template fixture to demonstrate live documentation generation.",
6+
"nodes": [
7+
{
8+
"unique-id": "client",
9+
"node-type": "webclient",
10+
"name": "Client",
11+
"description": "A web client."
12+
},
13+
{
14+
"unique-id": "service",
15+
"node-type": "service",
16+
"name": "Service",
17+
"description": "A backend service."
18+
}
19+
],
20+
"relationships": [
21+
{
22+
"unique-id": "client-to-service",
23+
"description": "Calls",
24+
"relationship-type": {
25+
"connects": {
26+
"source": { "node": "client" },
27+
"destination": { "node": "service" }
28+
}
29+
}
30+
}
31+
]
32+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# {{name}}
2+
3+
{{description}}
4+
5+
## Components
6+
7+
{{#each nodes}}
8+
- **{{name}}** ({{node-type}}) — {{description}}
9+
{{/each}}
10+
11+
## Interactions
12+
13+
{{#each relationships}}
14+
- {{description}}
15+
{{/each}}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"$schema": "https://calm.finos.org/release/1.2/meta/calm.json",
3+
"nodes": [
4+
{
5+
"unique-id": "web-app",
6+
"name": "Web Application",
7+
"description": "Frontend web application",
8+
"node-type": "webclient"
9+
},
10+
{
11+
"unique-id": "api-service",
12+
"name": "API Service",
13+
"description": "Backend API service",
14+
"node-type": "service"
15+
}
16+
],
17+
"relationships": [
18+
{
19+
"unique-id": "web-to-api",
20+
"description": "Web app calls API",
21+
"relationship-type": {
22+
"connects": {
23+
"source": { "node": "web-app" },
24+
"destination": { "node": "api-service" }
25+
}
26+
}
27+
}
28+
]
29+
}
30+
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"$schema": "https://calm.finos.org/release/1.2/meta/calm.json",
3+
"nodes": [
4+
{
5+
"unique-id": "web-app",
6+
"name": "Web Application",
7+
"description": "Frontend web application",
8+
"node-type": "webclient"
9+
},
10+
{
11+
"unique-id": "api-service",
12+
"name": "API Service",
13+
"description": "Backend API service",
14+
"node-type": "service"
15+
},
16+
{
17+
"unique-id": "database",
18+
"name": "Database",
19+
"description": "Persistent data store",
20+
"node-type": "database"
21+
}
22+
],
23+
"relationships": [
24+
{
25+
"unique-id": "web-to-api",
26+
"description": "Web app calls API",
27+
"relationship-type": {
28+
"connects": {
29+
"source": { "node": "web-app" },
30+
"destination": { "node": "api-service" }
31+
}
32+
}
33+
},
34+
{
35+
"unique-id": "api-to-db",
36+
"description": "API stores data",
37+
"relationship-type": {
38+
"connects": {
39+
"source": { "node": "api-service" },
40+
"destination": { "node": "database" }
41+
}
42+
}
43+
}
44+
]
45+
}
46+
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"$schema": "https://calm.finos.org/release/1.2/meta/calm-timeline.json",
3+
"current-moment": "initial",
4+
"moments": [
5+
{
6+
"unique-id": "initial",
7+
"node-type": "moment",
8+
"name": "Initial Architecture",
9+
"description": "The initial architecture design",
10+
"valid-from": "2024-01-01",
11+
"details": {
12+
"detailed-architecture": "arch-v1.json"
13+
}
14+
},
15+
{
16+
"unique-id": "enhanced",
17+
"node-type": "moment",
18+
"name": "Enhanced Architecture",
19+
"description": "Architecture with additional components",
20+
"valid-from": "2024-06-01",
21+
"details": {
22+
"detailed-architecture": "arch-v2.json"
23+
}
24+
}
25+
],
26+
"metadata": {
27+
"title": "Test Timeline",
28+
"description": "Timeline for testing VSCode plugin timeline navigation"
29+
}
30+
}
31+

calm-plugins/vscode/screenshots/src/index.ts

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,26 @@ async function main() {
3333

3434
const entries: ManifestEntry[] = []
3535

36+
// Optional filter via SHOOT_ONLY=03-tree-search,04-preview-hero to
37+
// iterate one or a few shots without running the whole set. Useful while
38+
// developing. Names not in `implementedShots` (i.e. `implemented: false`)
39+
// are still ignored — the filter narrows the implemented set, it doesn't
40+
// bypass the implementation flag.
41+
const onlyEnv = process.env.SHOOT_ONLY?.trim()
42+
const allowed = onlyEnv ? new Set(onlyEnv.split(',').map((s) => s.trim())) : null
43+
const todoShots = shots.filter((s) => !s.implemented && (!allowed || allowed.has(s.name)))
44+
3645
for (const shot of implementedShots) {
37-
const fixturePath = path.join(FIXTURES_DIR, shot.fixture, 'architecture.json')
38-
console.log(`\n[shoot] ${shot.name} fixture=${shot.fixture}`)
46+
if (allowed && !allowed.has(shot.name)) continue
47+
48+
const workspaceFile = shot.workspaceFile ?? 'architecture.json'
49+
const fixturePath = path.join(FIXTURES_DIR, shot.fixture, workspaceFile)
50+
console.log(`\n[shoot] ${shot.name} fixture=${shot.fixture}/${workspaceFile}`)
3951

4052
const { window, cleanup } = await launchVSCodeWithExtension({
4153
extensionPath: EXTENSION_DIR,
4254
workspacePath: fixturePath,
55+
settingsOverrides: shot.settings,
4356
})
4457

4558
try {
@@ -60,9 +73,18 @@ async function main() {
6073
}
6174
}
6275

63-
const skipped = shots
64-
.filter((s) => !s.implemented)
65-
.map((s) => ({ name: s.name, reason: 'TODO — see issue #2529' }))
76+
const skipped = todoShots.map((s) => ({
77+
name: s.name,
78+
reason: 'TODO — see issue #2529',
79+
}))
80+
81+
if (allowed) {
82+
console.log(
83+
`\n[shoot] SHOOT_ONLY active — manifest NOT updated. Run a full shoot to regenerate the manifest.`
84+
)
85+
console.log(`[shoot] ${entries.length} shot(s) written.`)
86+
return
87+
}
6688

6789
const manifest: Manifest = {
6890
generatedAt: new Date().toISOString(),

calm-plugins/vscode/screenshots/src/launch.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ const WORKBENCH_SETTINGS = {
2424
'workbench.tips.enabled': false,
2525
'workbench.welcomePage.walkthroughs.openOnInstall': false,
2626
'extensions.ignoreRecommendations': true,
27+
// Auto-detect quietly overrides an explicit `workbench.colorTheme` when
28+
// the OS reports a different colour scheme or contrast state. Disabling
29+
// both so per-shot theme overrides are honoured — particularly the
30+
// High Contrast variants, which were otherwise silently swapped back to
31+
// their non-HC counterparts on a non-HC OS.
32+
'window.autoDetectColorScheme': false,
33+
'window.autoDetectHighContrast': false,
2734
}
2835

2936
// Bumping this is intentional and requires regenerating every PNG in the same PR.
@@ -32,7 +39,13 @@ export const PINNED_VSCODE_VERSION = '1.121.0'
3239

3340
export interface LaunchOptions {
3441
extensionPath: string
42+
// Path passed to VSCode as the workspace argument — either a single file
43+
// (opens with that file active) or a folder (opens a folder workspace).
3544
workspacePath: string
45+
// Optional workbench-settings overrides merged into the seeded settings.json
46+
// for this launch. Used by shots that need a specific theme, layout engine,
47+
// or any other setting that has to be in place before the first paint.
48+
settingsOverrides?: Record<string, unknown>
3649
}
3750

3851
export interface LaunchResult {
@@ -58,9 +71,10 @@ export async function launchVSCodeWithExtension(opts: LaunchOptions): Promise<La
5871
// from the first paint — no flash of the secondary side bar.
5972
const userDir = path.join(userDataDir, 'User')
6073
mkdirSync(userDir, { recursive: true })
74+
const mergedSettings = { ...WORKBENCH_SETTINGS, ...(opts.settingsOverrides ?? {}) }
6175
writeFileSync(
6276
path.join(userDir, 'settings.json'),
63-
JSON.stringify(WORKBENCH_SETTINGS, null, 2) + '\n'
77+
JSON.stringify(mergedSettings, null, 2) + '\n'
6478
)
6579

6680
const args = [

0 commit comments

Comments
 (0)