Skip to content

Results Panel

The kdb results panel is the default target for q runs. It uses this extension's direct driver path and keeps focus in the q editor while results update.

Result tabs

Default kdb-panel runs open a new result tab unless this setting is changed:

"kdb-sqltools.results.kdbPanel.defaultRunMode": "replace"

Replace commands reuse the current or first existing kdb result tab. New commands open an independent result tab.

New result grouping keeps new kdb result tabs beside existing kdb result tabs when one is already present. The first panel uses kdb-sqltools.results.kdbPanel.initialViewColumn.

Large results

The panel virtualizes rows and columns. It transfers only the visible cell window from the extension host to the webview, reducing DOM work for large tables. Individual cells in a visible slice are capped at 64 KiB of display text and show … [cell truncated; copy/export uses full value]; copy and export still use the underlying value. Search examines at most 4 KiB of display text per cell.

The q IPC response is still fully materialized in extension memory before display. Use q-side limits for truly large results:

1000#select from trade where date=.z.D

Very large results show a non-blocking warning. Copy, export, search, and sort may require additional work because they operate beyond the currently visible cells.

Cancel running queries

When a run is still loading, the toolbar shows a short Cancel button next to the spinner. The same run can also be canceled from VS Code's progress notification. Canceling stops the extension from waiting for that result, closes the active q IPC connection, and changes the panel to a canceled state so late results from that run do not replace newer output.

Server-side interruption is best-effort. If the q process or gateway has already started the work, closing the client IPC connection may not stop that work immediately.

Column controls

Feature Behavior
Resize Drag column edges to set authoritative widths. Manual widths persist by zero-based source-column position across later queries, panel recreation, and VS Code restarts.
Auto-fit The persisted checkbox is enabled by default. Whole result sizes each column once from the widest displayed header/value in the complete result, including off-screen array/list values. Visible rows explicitly enables viewport-adaptive fitting. Unchecked means no automatic width calculation.
Cell width and density The Cell width textbox applies to every data column. Applying it or switching density clears/replaces all positional manual widths consistently, including the first column.
Reset widths Reset column widths clears positional manual widths and returns width resolution to the selected preset/auto-fit behavior.
Reorder Move a header at least 5 CSS pixels. The drag cue marks the insertion position and the gesture never sorts. Alt+Left/Alt+Right moves the focused column one position.
Select columns Ctrl/Cmd+click or Ctrl/Cmd+Space selects a full column. Add Shift to extend from the selection anchor.
Sort Click, Enter, or Space cycles ascending, descending, and immutable source order. Visible indicators and aria-sort report the state. Results above the configurable row threshold ask once per displayed result before the first exact sort.
Hidden columns Hide columns from the panel settings menu for the current panel session. Reset restores all columns.
Key columns Key columns from keyed q tables receive a subtle theme-aware tint that follows the column through hiding and reordering.
Summaries Optional bounded column cards report valid/null/distinct counts, common values, and numeric or temporal metrics. Results up to 50,000 rows are exact when the 100,000-cell budget permits; larger results use at most 10,000 evenly spaced rows.

Column reorder, sort, search, copy, and export use the current visible column order. Hidden-column choices persist only for later results in the same panel when the full column list matches. Positional widths remain tied to the source-column position through hide/reorder operations rather than following a query-specific column name. Header labels expose position/state, focused headers have a visible outline, and resize handles stop pointer propagation; resize drag or double-click reset never sorts.

Virtual rows carry parity from their absolute displayed row index, so shading stays stable after sorting and at every scroll window. Odd rows use --vscode-tree-tableOddRowsBackground with a subtle neutral fallback; selection, search matches, loading cells, and forced/high-contrast colors take precedence.

Toolbar

The toolbar is a single compact line:

Output: [format] [Headers] [Row #] [Copy] [Export] [Chart] [Settings] [Cancel] [spinner/status]
Tool Behavior
Chart button Opens the uPlot-powered chart UI for the current visible result. Line, scatter, step, clustered bar, and box use numeric y selections; real candlestick charts instead show explicit, distinct numeric Open, High, Low, and Close selectors. All types use numeric/temporal x. Group by is available only for line, scatter, step, and bar; box and candlestick hide it with an explanatory status. The panel provides a full-range navigator, Zoom/Pan drag modes, keyboard panning, reset, splitter resize, legend toggling, compatible selection persistence, and PNG export after render. Changing controls leaves the old rendered chart visible until Render is pressed.
Settings menu Contains collapsible sections for view controls, search, hidden columns, output defaults, and local data server controls. Preferences opens by default; Data server is collapsed by default. The Data server section starts or stops the opt-in 127.0.0.1 server, copies current-result URLs, and reminds users that very large current.* exports may need a higher local server cell limit.

The local data server and chart both use the extension-side current result. Hidden, reordered, and sorted visible columns are honored where they apply.

The navigator always shows the immutable full sample and its current visible window. Drag the window or its edges, click the overview to recenter, or focus it and use the arrow keys; Home, double-click, or Reset restores the immutable full range. Plain chart drag follows the selected Zoom/Pan mode, while Shift+drag always pans. Y stays automatic. A settled viewport with at least 3,000 already-sampled points remains local; a sparser viewport is automatically resampled from the retained source. Reset invalidates stale responses and restores the original sample/domain without backend I/O.

Selection

The panel supports:

  • Cell ranges.
  • Whole-row selection.
  • Whole-column selection.
  • Full table selection.
  • Deselect all.

With no selection, copy and export use all cells.

Settings search runs in the extension against visible columns only. It returns capped row-match metadata to the webview, so the panel does not need to transfer every cell to search. Search text is bounded to 4 KiB per cell, and the status indicates capped or partial scans.

Array display formats

kdb-sqltools.results.kdbPanel.arrayDisplayFormat controls array and list cell display:

Value Example
commaSpace 1, 2, 3
space 1 2 3
raw [1 2 3] where q-like bracketed display is available

Text copy/export formats use this display text. JSON and NDJSON keep structured values.

Non-table q result display

True q tables and keyed tables always open as grids. Top-level non-table composite results can be configured independently:

Setting suffix Default Applies to
functionDisplayStrategy qText Functions, lambdas, projections, compositions, and unknown function-like values.
dictionaryDisplayStrategy grid Dictionaries.
listDisplayStrategy grid General, mixed, and object lists.
objectDisplayStrategy grid Plain objects or nested composite values decoded as objects.

Use grid for the existing synthetic table form, or qText for deterministic q-like output in a plain text viewer. Optional qText syntax highlighting uses a non-evaluating lexer and constructs DOM text nodes only. Optional display formatting is display-only and falls back to the original text if tokenization or structural validation fails; copy and export always retain the original qText. Settings JSON also accepts table as an alias for grid, and text as an alias for qText.

Example:

{
  "kdb-sqltools.results.kdbPanel.dictionaryDisplayStrategy": "qText",
  "kdb-sqltools.results.kdbPanel.listDisplayStrategy": "qText"
}

Function source is not reconstructed. If q IPC only supplies a function marker, the panel shows a source-unavailable message instead of inventing a definition. Return string f or .Q.s f from q when exact source/default q text is required.

Local data and charting

See Local data server for tokenized localhost endpoints and Python/pandas usage.

See Charting for the built-in uPlot chart UI, interactions, downsampling, grouping, and current limitations.