- Project Overview
- Key Features
- Screenshots / Demo
- Installation
- Usage Guide
- Configuration Options
- Architecture Overview
- Development Setup
- Testing the Extension
- External API Integration
- Contributing
- Roadmap
- License
PostgreSQL Canvas is a Visual Studio Code extension that brings an interactive multi-panel workspace for PostgreSQL databases.
It unifies query authoring, execution, result exploration, history, and reusable templates in a single canvas while seamlessly integrating with existing PostgreSQL connection tooling or a custom βvenueβ API that resolves credentials and schema metadata.
Purpose
- Speed up everyday data tasks for developers, data engineers, and analysts.
- Reduce context switching between editors, CLI tools, and docs.
- Encourage best-practice sharing through query templates.
| Feature | Description |
|---|---|
| πΌ Three-Pane Canvas | Query Builder, Results Grid, and Sidebar (History & Templates) arranged in one view. |
| π Flexible Connections | Use the PostgreSQL extension connection picker or auto-resolve host/port via an external Venue API. |
| πΎ Query History | Every executed statement is timestamped, duration-tracked, and replay-able. |
| π Templates | Save frequently used SQL snippets with tags & descriptions and share them across workspaces. |
| πΊ Schema Insight | Fetch tables/views/functions via API for smarter autocomplete (road-map). |
| π€ Export Results | Quickly export result sets to CSV, JSON, Markdown, or HTML. |
| π Secure Credentials | Passwords stored with VS Code Secret Storage, never plain-text. |
| π One-Click Run | Run selection or whole document with β β₯ β© / Ctrl Alt Enter. |
| Canvas | Sidebar Templates | Dark Theme |
|---|---|---|
![]() |
![]() |
![]() |
A 2-minute demo video is available on the Marketplace page.
- Open VS Code Extension Marketplace.
- Search for βPostgreSQL Canvasβ.
- Click Install and reload when prompted.
git clone https://github.com/miolabs/MIOSQLVisualStudioExtension.git
cd MIOSQLVisualStudioExtension
npm install
npm run package # produces postgres-canvas-<ver>.vsix in ./dist
code --install-extension dist/postgres-canvas-*.vsixRequires VS Code β₯ 1.70 and Node β₯ 18 for local builds.
Command Palette β PostgreSQL: Connect to Venue
Select a venue or connection profile and enter credentials if prompted.
Command Palette β PostgreSQL: Open Query Canvas
The workspace splits into three panels: Builder (top-left), Results (bottom), Sidebar (right).
- Type SQL in the Builder panel or open an existing
.sqlfile. - Press Run Query (toolbar) or β β₯ β© / Ctrl Alt Enter.
- Results appear instantly; history and templates update.
Click Save as Template, provide a name/description/tags.
Find it later under the Templates tab in the sidebar.
In the Results toolbar choose Export β CSV/JSON/MD/HTML.
| Setting | Default | Description |
|---|---|---|
pgCanvas.venueApiUrl |
"" |
Base URL of your Venue API. |
pgCanvas.apiAuthToken |
"" |
Bearer token for the API (supports env: variables). |
pgCanvas.defaultVenue |
"" |
Venue to auto-connect on startup. |
pgCanvas.autoConnect |
false |
Enable automatic connection to defaultVenue. |
pgCanvas.maxHistoryItems |
50 |
Rolling history size. |
pgCanvas.resultLimit |
1000 |
LIMIT applied when none specified. |
pgCanvas.saveCredentials |
true |
Persist credentials in Secret Storage. |
Edit via Settings UI or settings.json.
ββββββββββββββββββββββ VS Code Workspace ββββββββββββββββββββββ
β Query Builder βββΊ CanvasManager βββΊ PostgreSQL Pool β
β Results Webview βββ(postMessage)βββΊ pg (node) β
β Sidebar Webview βββ templates/history state βββββββββββββββ€
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β² β
β REST/JSON βΌ
β Venue / Schema API
βββββββββββββββββββββββββββββ
- Extension Host (Node):
extension.tsregisters commands, manages state, routes messages. - Webviews (HTML/TS): Sandbox UIs bundled with webpack (
webviews/). - Connection Layer:
pgconnection pool or delegation to PostgreSQL extension. - External API Client:
src/connection/configService.tsfetches venue & schema metadata.
# clone
git clone https://github.com/miolabs/MIOSQLVisualStudioExtension.git
cd MIOSQLVisualStudioExtension
# install deps
npm install
# build extension + webviews
npm run compile # or `npm run watch` for live rebuild
# open in VS Code
code .Tests run with Mocha:
npm testLint & format:
npm run lintFollow these steps to run and iterate on PostgreSQL Canvas inside a VS Code Extension Development Host.
-
Start the Extension in Development Mode
# from project root npm run watch # terminal 1 β incremental TypeScript + webpack build
Leave this process running; it rebuilds the extension & webviews on file change.
-
Launch the Extension Development Host (EDH)
- Press F5 (or click βRun > Start Debuggingβ) inside VS Code.
- A new VS Code window (the EDH) opens with your compiled extension installed.
-
Test Commands in the EDH
- Open the Command Palette (
β β§ P/Ctrl Shift P) and run:- PostgreSQL: Connect to Venue
- PostgreSQL: Open Query Canvas
- Verify the multi-panel UI appears and commands behave as expected.
- Open the Command Palette (
-
Debugging Tips
- Console Output β Use the Debug Console in the original window to see
console.logfromextension.ts. - Webview Logs β Open DevTools inside any webview with
Cmd/Ctrl-Shift-I. - Breakpoints β Set breakpoints in TypeScript; VS Code maps them to the compiled JavaScript.
- Console Output β Use the Debug Console in the original window to see
-
Reload After Code Changes
- While
npm run watchrebuilds automatically, you must reload the EDH to pick up changes:- In the EDH window press β R / Ctrl R (Developer: Reload Window)
- or click the blue βReloadβ toast that appears after each build.
- While
-
Common Troubleshooting
Issue Fix βcommand not foundβ in Command Palette Make sure you ran F5 from the source windowβnot the EDHβand that build completed successfully. Webview shows blank panel Check DevTools console for script errors; ensure CSP hashes match (re-run build). API requests fail Verify pgCanvas.venueApiUrl&apiAuthTokensettings; inspect Network tab.Stale code after edit Confirm npm run watchis running and reload the EDH window.Breakpoints ignored Ensure source maps are generated ( npm run watch) and breakpoint is in activated code path.
Happy hacking! π
(unchanged content)
(unchanged content)
(unchanged content)
(unchanged content)


