Skip to content

Commit c89e071

Browse files
refactor(stac-vscode): update the Stac Live Preview image link & version bump to 0.2.0 (#466)
* refactor(stac-vscode): update the Stac Live Preview image link * chore: version bump stac vscode plugin to v0.2.0 * docs: add docs for vscode extension * update changelog
1 parent ea6fadc commit c89e071

5 files changed

Lines changed: 140 additions & 3 deletions

File tree

docs/docs.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,17 @@
262262
]
263263
}
264264
]
265+
},
266+
{
267+
"tab": "Tools",
268+
"groups": [
269+
{
270+
"group": "Editor Extensions",
271+
"pages": [
272+
"tools/vscode"
273+
]
274+
}
275+
]
265276
}
266277
]
267278
},

docs/tools/vscode.mdx

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
---
2+
title: "Use Stac in VS Code"
3+
description: "Install and configure the Stac extension for VS Code. Get live preview, wrap quick-fixes, and snippets for Server-Driven UI — right inside your editor."
4+
---
5+
6+
## Prerequisites
7+
8+
- **Flutter SDK** with Dart `3.9.2+`
9+
- A Flutter project using the [Stac](https://stac.dev) framework
10+
11+
## Install the extension
12+
13+
Click the link for your IDE to install directly:
14+
15+
- [Install for VS Code](vscode:extension/StacDev.stac-vscode)
16+
- [Install for Cursor](cursor:extension/StacDev.stac-vscode)
17+
- [Install for Antigravity](antigravity:extension/StacDev.stac-vscode)
18+
19+
Or in VS Code, press `Cmd+Shift+X` (Mac) or `Ctrl+Shift+X` (Windows/Linux) to open the Extensions view, search for "Stac", and click **Install**.
20+
21+
## Get started
22+
23+
1. **Open a Stac project** — open any Flutter project that uses the Stac framework.
24+
2. **Open the Command Palette** — press `⌘⇧P` (Mac) or `Ctrl+Shift+P` (Windows / Linux) and type **"Stac"**.
25+
3. **Launch a live preview** — run **`Stac: Open Preview`** to open a side-by-side preview of the active `@StacScreen`.
26+
27+
<Frame>
28+
<img src="https://raw.githubusercontent.com/StacDev/stac/dev/tools/stac-vscode/media/stac_preview.png" alt="Stac Live Preview" />
29+
</Frame>
30+
31+
## Use live preview
32+
33+
The preview panel renders your `@StacScreen` in real time and updates automatically on save.
34+
35+
- **Device toggles** — switch between Android, iOS, and Web viewports.
36+
- **Theme picker** — preview with any `@StacThemeRef` theme defined in your project.
37+
- **Auto-refresh** — every time you save, the preview re-renders. Disable this with the `stacVscode.preview.autoRefreshOnSave` setting.
38+
39+
### Preview commands
40+
41+
| Command | Description |
42+
| --- | --- |
43+
| `Stac: Open Preview` | Open the live preview panel for the active screen |
44+
| `Stac: Select Preview Screen` | Switch to a different screen in the current file |
45+
| `Stac: Stop Preview` | Stop the preview host process |
46+
47+
## Use wrap quick-fixes
48+
49+
Place your cursor on any Stac widget expression and press `⌘.` (Mac) or `Ctrl+.` (Windows / Linux) to wrap it with a preset widget:
50+
51+
`StacContainer` · `StacPadding` · `StacCenter` · `StacAlign` · `StacSizedBox` · `StacExpanded`
52+
53+
Select **Wrap with Stac widget…** to wrap with any custom Stac widget class in your project.
54+
55+
<Tip>
56+
You can customise which preset wrappers appear in the quick-fix menu with the `stacVscode.wrapPresets` setting, or disable wrap actions entirely with `stacVscode.enableWrapQuickFix`.
57+
</Tip>
58+
59+
## Use snippets
60+
61+
In files containing `@StacScreen`, `@StacThemeRef`, or `package:stac_core`, the following snippets are available:
62+
63+
| Prefix | What it creates |
64+
| --- | --- |
65+
| `stac screen` | A new screen template |
66+
| `stac theme` | A new theme template |
67+
68+
Snippets can be toggled with the `stacVscode.enableSnippets` setting.
69+
70+
## Commands and shortcuts
71+
72+
Open the Command Palette (`⌘⇧P` / `Ctrl+Shift+P`) and type **"Stac"** to see all available commands:
73+
74+
| Command | Description |
75+
| --- | --- |
76+
| `Stac: Open Preview` | Open the live preview panel |
77+
| `Stac: Select Preview Screen` | Switch screen in the current file |
78+
| `Stac: Stop Preview` | Stop the preview host |
79+
| `Stac: Regenerate Catalog` | Rebuild the widget catalog from `stac_core` |
80+
81+
## Configure settings
82+
83+
Open VS Code settings (`⌘,` / `Ctrl+,`) and search **"Stac"** to customise the extension.
84+
85+
### Extension settings
86+
87+
| Setting | Default | Description |
88+
| --- | --- | --- |
89+
| `stacVscode.enableWrapQuickFix` | `true` | Enable wrap quick-fix actions |
90+
| `stacVscode.wrapPresets` | All presets | Preset wrappers shown in the quick-fix menu |
91+
| `stacVscode.enableSnippets` | `true` | Enable `stac screen` / `stac theme` snippets |
92+
| `stacVscode.preview.enable` | `true` | Enable preview commands |
93+
| `stacVscode.preview.autoRefreshOnSave` | `true` | Refresh the preview on save |
94+
| `stacVscode.preview.jsonStrategy` | `runnerThenBuild` | JSON generation strategy |
95+
| `stacVscode.preview.hostPort` | `47841` | Local preview host port |
96+
| `stacVscode.preview.startupTimeoutMs` | `120000` | Host startup timeout (ms) |
97+
98+
## Troubleshooting
99+
100+
### Preview won't start
101+
102+
1. Open **Output → Stac Preview** for detailed logs.
103+
2. Ensure your project builds successfully with `flutter run`.
104+
3. Confirm the active file contains a `@StacScreen` annotation.
105+
4. Try restarting the preview host by running **`Stac: Stop Preview`**, then **`Stac: Open Preview`**.
106+
107+
### Extension won't install
108+
109+
- Ensure you have a compatible version of VS Code (1.80.0 or later).
110+
- Check that VS Code has permission to install extensions.
111+
- Try installing directly from the [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=StacDev.stac-vscode).
112+
113+
## Uninstall the extension
114+
115+
1. Open the Extensions view (`⇧⌘X` / `Ctrl+Shift+X`).
116+
2. Search for **"Stac"**.
117+
3. Click **Uninstall**.
118+
119+
<Card title="Report an Issue" icon="github" href="https://github.com/StacDev/stac/issues">
120+
Found a bug or have a feature request? Open an issue on GitHub.
121+
</Card>

tools/stac-vscode/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
All notable changes to the "stac-vscode" extension will be documented in this file.
44

5+
## [0.2.0]
6+
7+
- Bug fixes & improvements
8+
59
## [0.1.0]
610

711
### Live Preview

tools/stac-vscode/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ Build and preview Server-Driven UI screens with the **Stac** framework — direc
77
### 🔴 Live Preview
88
Open a side-by-side preview of any `@StacScreen` — updates on save, supports theme selection, and renders with Android/iOS/Web platform simulation.
99

10-
![Stac Live Preview](media/stac_preview.png)
10+
![Stac Live Preview](https://raw.githubusercontent.com/StacDev/stac/dev/tools/stac-vscode/media/stac_preview.png)
11+
1112

1213
- **`Stac: Open Preview`** — launch the preview panel for the active screen
1314
- **Device toggles** — switch between Android, iOS, and Web viewports

tools/stac-vscode/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "stac-vscode",
33
"displayName": "Stac",
44
"description": "Build Server-Driven UI with Stac — live preview, wrap quick-fixes, and snippets for Flutter.",
5-
"version": "0.1.0",
5+
"version": "0.2.0",
66
"publisher": "StacDev",
77
"license": "MIT",
88
"icon": "media/icon.png",
@@ -207,4 +207,4 @@
207207
"dependencies": {
208208
"js-yaml": "^4.1.1"
209209
}
210-
}
210+
}

0 commit comments

Comments
 (0)