Skip to content

KX for VS Code

KX for VS Code is a standalone extension for working with kdb+/q directly in Visual Studio Code. It owns its q IPC connections, q editor commands, optional focused Server Explorer and Query History, portable Jupyter/IPython result renderer/helper, results viewer, charting, local data server, and diagnostics.

It sends q text to the selected q process. It does not translate ANSI SQL to q:

select from trade where sym=`AAPL
meta trade
tables `.analytics

Standalone status

The extension supports both q-only .qnb notebooks and Python-first mixed Jupyter notebooks. A .qnb always has a dedicated direct-q controller; mixed .ipynb files keep Python selected, use Make q Cell (KX) for intended q cells, and use Run q Cell (KX) for Direct IPC. Every run resolves the active profile by stable ID, so endpoint edits take effect and missing active routes never fall through. The optional pure-q controller for Jupyter remains behind the default-false vscode-kdb.notebook.enableDirectController setting. VS Code's top-right Jupyter selector remains. Connection profiles merge predictably across User, Workspace, and Workspace Folder settings while edits preserve ownership and delayed configuration propagation is reconciled. Complete q cells and editor scripts use client-side grouping and ordinary value execution without a q release-date gate.

Implemented foundations include:

  • multiple direct q IPC profiles managed through one responsive KX Connection form, with Folder > Workspace > User stable-ID precedence, explicit scope ownership/moves, delayed-propagation-safe persistence, an active marker/selector, non-syncing VS Code SecretStorage, and a temporary unsaved-value Test Connection path;
  • a KX-owned Import SQLTools KDB Connections review for exact legacy driver aliases, scoped configuration discovery, safe skip/rename conflicts, explicit one-time password transfer, and no overwrite or sync;
  • optional per-profile connect/handshake and query timeout overrides with independent 30-second and 60-minute global defaults;
  • exact current-line execution plus client-grouped multiline, whole-document, and complete-cell q execution through ordinary q value, with configured-namespace save/enter/restore;
  • leading Make q Cell (KX) / Run q Cell (KX) actions, q-cell status, a notebook-level active-profile chooser, and selected-command-mode or text-focused q-cell shortcuts for mixed Python notebooks, plus an optional default-off public pure-q NotebookController, with shared complete-cell execution, profile/session/namespace continuity, immediately bound full live results, automatic complete portable-v2 persistence for exactly representable new Direct IPC output, bounded historical/Python-helper previews, and no private Jupyter API;
  • actual q TextDocument.languageId editing aids, safe restore-to-notebook-default, honest bounded compatibility with the released kx-notebook==0.1.0 Python %%q route, an explicit confirmed rerun-as-new-Direct-IPC action, and a real VS Code NotebookRenderer for application/vnd.kx.result+json v1/v2; direct output stores KX MIME plus text/plain, while companion output adds static HTML/text fallbacks;
  • a disabled-by-default, manual-refresh Server Explorer for current-namespace tables, safe variable/function categories, on-demand meta, confirmed bounded table/variable previews, and metadata-only functions/projections;
  • disabled-by-default, workspace-local Query History for actually issued editor runs, with rerun/copy/insert/delete/confirmed-clear actions and no result persistence or telemetry;
  • grid and q-text results, correct q no-value/empty classification, selective concise q-aware grid text, q-native qText, a shared analyst-friendly table copy/export boundary, stable logical-row striping, disabled-by-default safe qText highlighting/conservative display formatting, virtual scrolling, selection, search, sorting, hidden columns, and large-result safeguards;
  • KX Results-aligned notebook tables with shared toolbar/output formats/settings, stable two-axis scrolling, Search/navigation, visible-column controls, range copy/export, explicit live-versus-saved state, and exact live panel handoff;
  • panel and notebook line/scatter/step/bar/box/candlestick charts with shared q numeric/temporal column classification, temporal X choices, numeric Y/OHLC requirements, a keyboard-accessible full-X overview navigator, exact 7,000-point ordinary-series reduction, automatic settled-range live refinement, original-domain Reset zoom, PNG export, and legend-hidden state preserved across refreshes;
  • an opt-in tokenized loopback data server;
  • a dedicated KX Output channel with opt-in performance tracing;
  • offline-first q completion, hover, signatures, navigation, rename, call hierarchy, semantic tokens, folding, selection, formatting, and conservative diagnostics from one lazy bundled language server; and
  • compatible q-only .qnb serialization, a permanently available q controller, and visible lossless fallback for legacy notebook output.

Built-in Python Run is never rerouted to KX. SSH/TLS setup, gateways, remote administration, SQLTools UI/session behavior, recovery of rows omitted from a historical or Python-helper saved preview, and server-side q interruption are not included. Static analysis intentionally omits speculative dynamic q errors. See Architecture for component and state boundaries.

Requirements

  • VS Code 1.101.0 or newer for extension 0.2.29. Extension 0.2.23 remains the fallback for VS Code 1.96–1.100.
  • A reachable kdb+/q process listening for q IPC.
  • Credentials accepted by that process, if authentication is enabled.
  • For the optional Python-kernel notebook route only: Python 3.9-3.13, IPython, and separately installed kx-notebook==0.1.0 (import kx_notebook). Direct q IPC is built in; profiles, callbacks, PyKX, and a loopback broker are explicit alternatives.

Direct execution compatibility is feature-based rather than gated on a q version/date. The deterministic suite covers generated requests for a process without .Q.ld, but the release's live check used only the installed modern q runtime. No exact minimum q version or live historical-q result is claimed.

SQLTools is not required.

Common workflow

  1. Start q on a loopback port for local development.
  2. Add a direct connection from the KX Connections sidebar, or run KX: Import SQLTools KDB Connections to review eligible legacy profiles already in VS Code settings. Import is optional, one-time, and does not require SQLTools.
  3. Test it, set it active, and connect; a run can also connect on demand.
  4. Open a .q file and run the current line, an exact selection, or the whole document.
  5. Inspect, chart, copy, or export the result in KX Results.
  6. For q-only work, create/open a .qnb and use normal Run with its dedicated KX q controller. In mixed .ipynb, keep Python selected, use Make q Cell (KX), activate the shared q connection, then use Run q Cell (KX).
  7. Open View > Output and select KX when diagnosing lifecycle or IPC failures.
  8. Optionally enable Server Explorer or Query History in Settings; both default off to avoid surprise metadata queries or query-text persistence.

Documentation map