microsoft / microsoft/Kusto-Explorer-VsCode

Results grid: show Count/Sum/Avg/Min/Max for selected numeric cells in a status bar

Open
#143 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
6
Forks
7
Avg merge
6d 10h
Merged PRs (30d)
3

Description

Ported from discussion #140 (@nanovak).

Request

When multiple numeric cells are selected in the results grid, show aggregate statistics — Count / Sum / Avg / Min / Max — in a status bar, matching the behavior of Kusto Explorer desktop and the web UI.

example

Why this is well-scoped now

The prerequisite already shipped in v0.4.0: the grid supports cell/row/column range selection. The webview already maintains authoritative selection state and already notifies the extension host on every selection change, so this feature is additive rather than foundational.

Relevant existing pieces:

  • src/Client/features/dataTableProvider.ts — the webview script owns selection state in selectedCells (a set of "row:col" display-coordinate keys) plus selAnchor.
  • postSelectionChange() (~line 1263) already posts a setSelection message to the host on every change.
  • currentSelectionIndices() (~line 1223) summarizes the selection as original-data { rows, cols } index arrays.
  • ResultColumn { name, type } (src/Client/features/server.ts) carries the Kusto scalar type per column, which is what drives numeric detection.
  • The data table view is deliberately container-agnostic (relative DOM queries via document.currentScript.parentElement + a per-view token), so any status bar must be rendered by the view into its own container rather than assume a page-level element.

Open design questions

  1. Where the aggregation runs. The webview owns the exact selected-cell set; the extension host owns the full typed table and is the testable half. currentSelectionIndices() currently reports only the selection's bounding box, which is lossless only while selections stay rectangular.
  2. Count semantics — all selected cells, or only the numeric/non-null ones. Nulls and non-numeric cells inside a mixed selection need a defined rule.
  3. Mixed / non-numeric selections — hide the bar, show Count alone, or aggregate per numeric column.
  4. Which types count as numericint/long/real/decimal are clear; timespan and datetime are aggregatable in principle but need their own formatting and may be out of scope for a first cut.
  5. Formatting and precision for Sum/Avg over real/decimal, and whether values are copyable from the bar.

Notes

  • Follow the existing webview house style: HTML string + inline <script>, acquireVsCodeApi(), document-level click delegation. No framework.
  • Per repo convention, the aggregation itself should live in a unit-testable module rather than only inside the inline webview script.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read src/Client/features/dataTableProvider.ts, especially currentSelectionIndices() and postSelectionChange(), then inspect ResultColumn in src/Client/features/server.ts. Decide the selection, numeric-type, null, mixed-selection, and formatting rules before choosing the host/webview boundary. Done means the per-view status bar reflects selected numeric cells and the aggregation logic has unit-test coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
frontend, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.