VS Code extension¶
The fbadmin extension for Visual Studio Code is a thin client to an fbadmin server: it browses the servers and databases registered in fbadmin, runs SQL from the editor and opens the DDL of an object. Connections, passwords, permissions and the audit log stay in fbadmin; the extension only talks to its REST API.
It needs VS Code 1.85 or newer and a running fbadmin (the desktop app, fbadmin on your computer,
or an fbadmin server).
Install¶
The extension is built by CI on every commit (artifact fbadmin-vscode). Install the .vsix with
Extensions → … → Install from VSIX…, or code --install-extension fbadmin.vsix. To build it:
cd vscode-extension
npm ci
npm run package # writes fbadmin.vsix
Connect¶
| Setting | Default | |
|---|---|---|
fbadmin.url |
http://127.0.0.1:5050 |
Where fbadmin runs (fbadmin: Set the fbadmin URL) |
fbadmin.autocommit |
true |
Commit each run; off keeps a transaction open until Commit or Rollback |
fbadmin.maxRows |
500 |
Rows fetched per SELECT |
- Desktop mode (fbadmin on your computer): nothing else to set up.
- Server mode: create an API token in fbadmin (Settings → API tokens, see
Permissions) and run fbadmin: Set API token. The token is kept in VS Code's
secret storage, not in the settings, and sent as
Authorization: Bearer. The extension can do what the token's user can do in fbadmin, nothing more.
Use¶
- Servers view (fbadmin icon in the activity bar): servers → databases → object folders
(tables, views, procedures, ...; Firebird 6 folders only when used) → objects. Click an object to
open its
CREATEDDL in a new SQL editor (Open DDL). - New SQL editor on a database opens an editor bound to it; the status bar shows the database of the current editor, click it to choose another (fbadmin: Choose the database of this editor). An editor opened otherwise asks for a database on the first run.
- Run (
Ctrl+Enter,Cmd+Enteron macOS, or the ▶ button): runs the selection, or the whole editor when nothing is selected. Scripts with several statements andSET TERMwork as in the fbadmin query tool. The results open in a panel beside the editor; a long run can be cancelled from its notification. - Errors are underlined at the line and column Firebird reports, in the editor and in the Problems view.
- Transactions: each editor has its own fbadmin query session. With
fbadmin.autocommitoff the panel says when a transaction is open; run fbadmin: Commit or fbadmin: Rollback. Closing the editor closes the session (and rolls back what was not committed). - Open fbadmin in the browser for everything else (maintenance, monitoring, designers, ...).
Development¶
cd vscode-extension
npm ci
npm run typecheck
npm test # unit tests; the REST tests run when FBADMIN_TEST_URL is set
eval "$(scripts/test-fbadmin.sh 3050)" # a throwaway fbadmin with a new database on Firebird at :3050
xvfb-run -a npm run test:vscode # the extension in a real VS Code (VSCODE_TEST_VERSION=1.85.2 for the oldest)
CI runs all of them against Firebird 5, in VS Code stable and 1.85.2, and uploads the .vsix.