Skip to content

Commit 846bd1b

Browse files
authored
Add a VS Code preview for .wboard files (#27)
A custom editor in `vscode/sqlbi-whiteboard` opens the embedded `preview.png` instead of the ZIP. Boards without a preview show a short message. The extension is not part of the desktop installer and does not bump VersionPrefix. Marketplace listing is still outstanding. Pull request validation compiles and tests the extension; the signed Whiteboard pipeline ignores `vscode/`.
1 parent c058082 commit 846bd1b

21 files changed

Lines changed: 553 additions & 8 deletions

.azure/pipelines/build-whiteboard.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ trigger:
4848
- TODO.md
4949
- CLAUDE.md
5050
- AGENTS.md
51+
- vscode
5152

5253
# Pull requests are validated by .github/workflows/pull-request.yml, unsigned. Without this,
5354
# Azure DevOps validates every pull request against a GitHub repository by default, which

.github/workflows/pull-request.yml

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ jobs:
3030
runs-on: ubuntu-latest
3131
outputs:
3232
code: ${{ steps.filter.outputs.code }}
33+
vscode: ${{ steps.filter.outputs.vscode }}
3334
steps:
3435
- uses: actions/checkout@v4
3536
with:
@@ -41,12 +42,18 @@ jobs:
4142
files=$(git diff --name-only "origin/${{ github.base_ref }}...HEAD")
4243
echo "Changed files:"
4344
echo "$files" | sed 's/^/ /'
44-
if echo "$files" | grep -qvE '^(site/|docs/|[^/]*\.md$)'; then
45+
if echo "$files" | grep -qE '^vscode/'; then
46+
echo "vscode=true" >> "$GITHUB_OUTPUT"
47+
echo "-> vscode extension changed"
48+
else
49+
echo "vscode=false" >> "$GITHUB_OUTPUT"
50+
fi
51+
if echo "$files" | grep -qvE '^(site/|docs/|vscode/|[^/]*\.md$)'; then
4552
echo "code=true" >> "$GITHUB_OUTPUT"
46-
echo "-> building: something outside site/, docs/ and top-level markdown changed"
53+
echo "-> building: something outside site/, docs/, vscode/ and top-level markdown changed"
4754
else
4855
echo "code=false" >> "$GITHUB_OUTPUT"
49-
echo "-> nothing to build: only the site, docs or markdown changed"
56+
echo "-> nothing to build: only the site, docs, vscode extension or markdown changed"
5057
fi
5158
5259
build:
@@ -117,3 +124,25 @@ jobs:
117124
-Version 0.0.0
118125
-SelfContained false
119126
-Variants stable/perMachine,dev/perUser
127+
128+
vscode:
129+
name: VS Code extension
130+
needs: changes
131+
runs-on: ubuntu-latest
132+
steps:
133+
- uses: actions/checkout@v4
134+
if: needs.changes.outputs.vscode == 'true'
135+
136+
- uses: actions/setup-node@v4
137+
if: needs.changes.outputs.vscode == 'true'
138+
with:
139+
node-version: '22'
140+
cache: npm
141+
cache-dependency-path: vscode/sqlbi-whiteboard/package-lock.json
142+
143+
- name: Compile and test
144+
if: needs.changes.outputs.vscode == 'true'
145+
working-directory: vscode/sqlbi-whiteboard
146+
run: |
147+
npm ci
148+
npm test

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ TestResults/
1313
*.user
1414
*.suo
1515
*.wboard
16+
!vscode/sqlbi-whiteboard/fixtures/*.wboard

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ How the project is developed and shipped is documented separately:
2323
- LiveView containers for GPU-backed capture of an application window or display, with freeze/resume and saved last-frame previews
2424
- Double-click a container to center it and fit it to the canvas
2525
- Undo and redo for strokes, erasing, containers, text edits, and transformations
26-
- Versioned ZIP-based `.wboard` documents with an embedded `preview.png`. Explorer shows that picture as the file thumbnail in the released install; older boards keep the document icon.
26+
- Versioned ZIP-based `.wboard` documents with an embedded `preview.png`. Explorer shows that picture as the file thumbnail in the released install; older boards keep the document icon. The VS Code extension in `vscode/sqlbi-whiteboard` opens the same picture instead of the ZIP.
2727
- Markdown `.wimport` recipes that build image and text containers from headings
2828
- An intentionally small floating toolbar
2929
- Preferences for the startup monitor, full-screen start, laser trail, and toolbar layout
@@ -213,11 +213,16 @@ The full contract for authors and agents is [docs/wimport.md](docs/wimport.md).
213213

214214
Plain `.md` files are not imported.
215215

216+
A `.wboard` in the same tree opens as the embedded preview if the extension in
217+
`vscode/sqlbi-whiteboard` is installed. Marketplace listing is still outstanding; that
218+
folder's README has the local VSIX steps.
219+
216220
## Architecture
217221

218222
- `SQLBI.Whiteboard.Core` contains world geometry, camera math, retained board objects, commands, hit testing, and archive persistence. It has no UI-framework dependency.
219223
- `SQLBI.Whiteboard.Dax` contains the framework-neutral DAX lexer, parser, classifier, and deterministic formatter adapted from Prompt Assistant.
220224
- `SQLBI.Whiteboard.SqlServer` contains the framework-neutral SQL Server 2025 adapter over Microsoft's ScriptDOM parser and script generator.
225+
- `vscode/sqlbi-whiteboard` is a VS Code custom editor that shows `preview.png` from a `.wboard` ZIP. It is not part of the desktop installer.
221226
- `SQLBI.Whiteboard` is the WPF shell. `InkCanvas` supplies system-managed wet ink, while `BoardSurface` renders completed ink, images, text, and selection on a white canvas in camera space. A transient AvalonEdit surface is overlaid only while a text container is being edited; language services translate parser classifications into WPF text styles.
222227
- `SQLBI.Whiteboard/LiveView` owns Windows Graphics Capture and the Direct3D-to-WPF bridge. Capture retains one GPU frame per active LiveView; CPU bitmap conversion occurs only when copying or saving a snapshot.
223228
- `SQLBI.Whiteboard.Core.SmokeTests` is a package-free executable test harness for camera anchoring, commands, hit testing, and archive round trips.

TODO.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,9 @@ either.
6161

6262
### 6. Preview of `.wboard` files in VS Code
6363

64-
The same preview in an editor: an extension that opens a `.wboard` file as an image rather than
65-
as an archive. Useful wherever boards live in a repository next to the material they document.
66-
Cheaper than the Explorer provider once the archive carries the bitmap, and shipped through the
67-
marketplace rather than through the installer.
64+
The extension lives in `vscode/sqlbi-whiteboard/`. It opens a `.wboard` file as the embedded
65+
`preview.png` rather than as an archive. Marketplace listing is still outstanding — until then
66+
install from a local VSIX as described in that folder's README.
6867

6968
### 7. Video teaser
7069

vscode/sqlbi-whiteboard/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/
2+
out/
3+
*.vsix
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Run Whiteboard Preview",
6+
"type": "extensionHost",
7+
"request": "launch",
8+
"args": [
9+
"--extensionDevelopmentPath=${workspaceFolder}",
10+
"${workspaceFolder}/fixtures"
11+
],
12+
"outFiles": ["${workspaceFolder}/out/**/*.js"],
13+
"preLaunchTask": "npm: compile"
14+
}
15+
]
16+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"type": "npm",
6+
"script": "compile",
7+
"group": {
8+
"kind": "build",
9+
"isDefault": true
10+
},
11+
"problemMatcher": "$tsc"
12+
}
13+
]
14+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.vscode/**
2+
src/**
3+
fixtures/**
4+
out/**/*.map
5+
out/**/*.test.js
6+
tsconfig.json
7+
.gitignore
8+
**/*.ts
9+
node_modules/**/test/**
10+
node_modules/**/*.md

vscode/sqlbi-whiteboard/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 SQLBI Corporation
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)