Skip to content

The editor ​

The editor is Monaco, VS Code's editor, with a PostgreSQL grammar that matches the connected server's major version. What it knows about your database comes from two places: the DDL snapshot on disk, and PostgreSQL's own parser, both in the page (compiled to WebAssembly) and on the connected server.

Completion and scope ​

Completion is fed by the object dictionary, every object in the snapshot keyed on any PostgreSQL spelling and walking the connection's real search_path, and by the statement's scope as PostgreSQL's own parser reads it. USING, LATERAL, MERGE, a UNION branch, a star inside a CTE expanding to the table's columns, a function in FROM completing its output columns: the scope is exact whenever the statement parses. A half-typed statement is healed before the parser sees it, and a tree-sitter grammar reads what still does not parse. Completion opens on its own after WHERE, AND, ON, FROM, JOIN and friends; Ctrl+Space opens it anywhere.

Every builtin function has signature help and hover with the catalog's own comment, on the exact connected version. Inside a PL/pgSQL body the completion knows the language (raise levels, exception condition names with their SQLSTATEs, closing snippets for if, for, loop and begin ... exception), and whole-statement templates appear at a statement's start, each offered only where the server has the syntax.

The dynamic parser and Problems ​

Every statement in a connected tab goes through the server's own Parse, with no Execute, debounced after typing (parser.debounce), resolved under your session's search_path and temporary objects. A misspelled column squiggles before anything runs, the Problems tab (Ctrl+Shift+M) lists it, the Outline marks the statement and the status bar counts it. A problem you disagree with can be dismissed as "not an error"; the dismissal survives restarts and lapses the moment the statement's text changes.

The parser only ever borrows a session that is free. It never queues, never dials on its own, never enters a transaction and leaves nothing behind. editor.liveParse switches it off; the Production group switches it off for you (see Safety and production).

Routine analysis ​

A CREATE FUNCTION, CREATE PROCEDURE or DO body is read with PostgreSQL's parser in WebAssembly, then every statement inside it is checked through the same read-only Parse, with the routine's variables typed the way PL/pgSQL types them. A shadowed variable, a missing table or a bad expression squiggles at its exact spot, and nothing is created on the server. Static checks of the kind plpgsql_check is known for (unused variable, unreachable statement, missing RETURN) run without the extension. Blocks fold, variables navigate with F12, Shift+F12 and F2, and the Outline reads inside the body.

psql backslash commands ​

Type \d film, \dt, \df, \dn, \dx, \sf, \conninfo or \? and press Enter: the answer lands under the line, from the snapshot, no query sent. The line becomes a comment so the script still runs.

Run parameters ​

$1, $name, {name} and psql's :name, :'name' and :"name" are recognized, typed by asking the server what it expects and bound beside the statement, never pasted into the text. A form asks for the values and remembers the last ones per tab. -- @var, -- @file, -- @dir and -- @pick in the file label the fields or answer them; -- @inputs, -- @ask and -- @noask decide what is asked. run.parameters switches the recognition off, or only the colon style.

Running ​

Ctrl+Enter (Cmd+Enter on macOS) first selects the statement under the cursor, then runs it; F5 runs too and is rebindable (run.keybinding). A selection runs as it is. A code lens over every statement offers Run, Select, Format and Copy, or a play glyph in the gutter does the same; statements fold, and a second gutter column numbers the lines within one.

Statement marks (editor.statementMarks) draw a colored bar per statement saying what the run guard will make of it before you run: violet for DDL, amber for data changes, red for the dangerous ones.

Outline ​

The Outline side panel (Ctrl+Shift+X) has one row per statement with its symbolic head, the objects it touches (confirmed against the dictionary), its CTEs, a routine's internals, comment headers, the file's annotations with a gloss of what each one does, and the parser's verdicts inline.

Formatter ​

Shift+Alt+F formats the file, Ctrl+K Ctrl+F the selection. The formatter is structural: keyword case (format.keywordCase), comma style, indent and width, and every formatted statement is re-read and compared token by token, so it can decline but never change meaning. A statement that does not parse is never touched. Per-file @format-* lines override the settings.

Lightbulb refactors ​

Ctrl+. offers what fits the spot: expand * to columns (one per line too), collapse to *, add an INSERT column list, qualify bare columns, remove a trailing comma, add GROUP BY, add LIMIT 100, extract a FROM subquery into a CTE, and insert a forgotten semicolon (editor.flagMissingSemicolons finds the seam, and Problems has a Fix All).

Inlay hints, hover and navigation ​

Inlay hints (Alt+I, editor.inlayHints, off by default) draw parameter names, column types and return types inside the text, each kind with its own switch. Hover on an object shows its comment and columns; hover on a builtin, a catalog or an extension member links its documentation, opened as a tab with the reference's own words and cached offline. F12 and Ctrl+click go to an object's definition or, on a keyword, to its reference page; Peek works the same way. JSON, array and range literals are parsed in place, and a JSON path or array subscript can be copied from inside a literal.

Messages painted back ​

A run's errors, warnings and notices come back into the editor as markers at their position, the hover in psql's voice with DETAIL and HINT, and F8 walks them. The Messages grid beside Results shows the wire protocol verbatim, and every message links to its line.

Undo survives closing and reopening a file. Every editor knob is a setting with VS Code's default, reachable from the toolbar menu and the right-click menu.

See also ​

PlumeSQL is a hercstack product.