feat(results-grid): add customizable styling settings (#19614)#21655
feat(results-grid): add customizable styling settings (#19614)#21655
Conversation
- Fix mssql.resultsFontSize and mssql.resultsFontFamily to work in modern React-based results grid: the onDidChangeConfiguration handler now pushes state updates to open panel controllers and the webview view (previously the map was updated but changes were never sent to the webview) - Add mssql.resultsGrid.alternatingRowColors for zebra-striping - Add mssql.resultsGrid.showGridLines for grid line control (both | horizontal | vertical | none) - Add mssql.resultsGrid.rowPadding for row density control (0-10 px) - All styling is theme-aware using VS Code CSS custom properties (--vscode-list-alternatingBackground, --vscode-panel-border) - Settings changes apply live to already-open result grids - New unit tests for grid settings constants and defaults Fixes #19614 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds new, theme-aware styling controls for the React-based query results grid and wires them through the extension’s configuration/state pipeline so users can customize grid appearance (font + density + grid lines + zebra striping).
Changes:
- Introduces
GridSettings/GridLinesModein shared webview state and propagates settings updates from the extension host to the webview. - Updates React results grid rendering to apply font settings, row padding, alternating-row styling, and grid-line visibility via classes/CSS variables.
- Adds new
mssql.resultsGrid.*settings topackage.jsonand adds unit tests for new config constants.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| extensions/mssql/test/unit/queryResultUtils.test.ts | Adds tests around new grid settings constants/defaulting behavior. |
| extensions/mssql/src/sharedInterfaces/queryResult.ts | Adds shared GridSettings + GridLinesMode types to the webview state contract. |
| extensions/mssql/src/reactviews/pages/QueryResult/resultGrid.tsx | Uses grid settings for row height and disposes/recreates table on row padding change. |
| extensions/mssql/src/reactviews/pages/QueryResult/queryResultsGridView.tsx | Applies grid settings via CSS classes and CSS custom properties; applies font settings to container. |
| extensions/mssql/src/reactviews/media/slickgrid.css | Adds CSS for row padding, zebra striping, and grid line visibility modes. |
| extensions/mssql/src/queryResult/queryResultWebViewController.ts | Reads grid settings from VS Code config and pushes updates to open query result webviews on configuration changes. |
| extensions/mssql/src/constants/constants.ts | Adds new constants for resultsGrid.* configuration keys. |
| extensions/mssql/package.nls.json | Adds localized descriptions for the new settings. |
| extensions/mssql/package.json | Contributes new mssql.resultsGrid.* settings (alternating rows, grid lines mode, row padding). |
extensions/mssql/src/queryResult/queryResultWebViewController.ts
Outdated
Show resolved
Hide resolved
PR Changes
|
- Fix inMemoryDataProcessingThreshold config read in onDidChangeConfiguration to use the utility function (avoids scoped/fully-qualified key mismatch) - Add enum validation for showGridLines in getGridSettingsConfig, defaulting to "both" for unrecognized values (mirrors getAutoSizeColumnsConfig pattern) - Fix zebra striping to use SlickGrid's .even/.odd row-index classes instead of :nth-child(even) which breaks in virtualized scroll - Trigger grid recreation when fontSize changes (same pattern as rowPadding) so ROW_HEIGHT and COLUMN_WIDTH are recalculated on font size updates - Update misleading CSS comment about gridline class application Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds user-configurable, theme-aware styling options to the MSSQL query results grid webview, wiring new settings from VS Code configuration through the extension controller into the React/SlickGrid UI.
Changes:
- Introduces new results grid settings (alternating row colors, grid line visibility, row padding) and exposes them via shared webview state.
- Applies font and grid styling in the React results grid view and updates SlickGrid CSS to support zebra striping and configurable grid lines.
- Updates configuration-change handling so open results views/panels react to setting changes.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| localization/xliff/vscode-mssql.xlf | Adds localized string entries for the new grid settings. |
| extensions/mssql/package.nls.json | Adds NLS strings for new settings + enum descriptions. |
| extensions/mssql/package.json | Contributes new mssql.resultsGrid.* settings (types/defaults/enums/range). |
| extensions/mssql/src/constants/constants.ts | Adds constants for the new settings keys. |
| extensions/mssql/src/sharedInterfaces/queryResult.ts | Adds GridSettings/GridLinesMode and wires into webview state. |
| extensions/mssql/src/queryResult/queryResultWebViewController.ts | Reads new settings, propagates changes to open results UIs, and adds config change handling. |
| extensions/mssql/src/reactviews/pages/QueryResult/queryResultsGridView.tsx | Applies CSS classes + CSS custom property based on gridSettings and fontSettings. |
| extensions/mssql/src/reactviews/pages/QueryResult/resultGrid.tsx | Recreates SlickGrid table when row-height-affecting settings change; updates row height calculations. |
| extensions/mssql/src/reactviews/media/slickgrid.css | Adds CSS for row padding, zebra striping, and grid line modes. |
| extensions/mssql/test/unit/queryResultUtils.test.ts | Adds unit tests for new constants/default behavior (but currently not exercising production code paths). |
extensions/mssql/src/queryResult/queryResultWebViewController.ts
Outdated
Show resolved
Hide resolved
extensions/mssql/src/queryResult/queryResultWebViewController.ts
Outdated
Show resolved
Hide resolved
Codecov Report❌ Patch coverage is
❌ Your patch status has failed because the patch coverage (43.66%) is below the target coverage (70.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #21655 +/- ##
==========================================
- Coverage 72.95% 72.94% -0.01%
==========================================
Files 331 331
Lines 99209 99264 +55
Branches 5582 5583 +1
==========================================
+ Hits 72374 72405 +31
- Misses 26835 26859 +24
🚀 New features to boost your workflow:
|
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds user-configurable styling options for the React-based query results grid, wiring new mssql.resultsGrid.* settings from VS Code configuration into the query results webview state and CSS so the grid can be themed and customized.
Changes:
- Introduces new results-grid settings (alternating row colors, grid line visibility, row padding) and localizes their descriptions.
- Plumbs
gridSettingsthrough query result webview state and applies it in the grid React view + SlickGrid CSS. - Ensures results font size/family changes propagate to the modern results grid and trigger table re-creation when row height changes.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| localization/xliff/vscode-mssql.xlf | Adds localized strings for new results-grid settings. |
| extensions/mssql/package.nls.json | Adds NLS entries for new results-grid setting descriptions and enums. |
| extensions/mssql/package.json | Contributes new mssql.resultsGrid.* settings (schema, defaults, enums). |
| extensions/mssql/src/constants/constants.ts | Adds constants for section-relative config keys used by the webview controller. |
| extensions/mssql/src/sharedInterfaces/queryResult.ts | Extends shared webview state with GridSettings and GridLinesMode. |
| extensions/mssql/src/queryResult/queryResultWebViewController.ts | Reads new settings from configuration and pushes updates to open results webviews. |
| extensions/mssql/src/reactviews/pages/QueryResult/queryResultsGridView.tsx | Applies settings via container classes/CSS variables (grid lines, zebra striping, row padding). |
| extensions/mssql/src/reactviews/pages/QueryResult/resultGrid.tsx | Recreates SlickGrid table when row-height-affecting settings change; adjusts row height calculation. |
| extensions/mssql/src/reactviews/media/slickgrid.css | Adds CSS for zebra striping, configurable grid lines, and row padding via CSS custom property. |
| extensions/mssql/test/unit/queryResultUtils.test.ts | Adds unit tests for new config key constants (and attempted defaults coverage). |
Comments suppressed due to low confidence (1)
extensions/mssql/test/unit/queryResultUtils.test.ts:121
- The added “default gridSettings … when config is undefined” tests don’t exercise any production code—they’re just asserting behavior of the nullish coalescing operator on a stubbed object, and they also stub
vscode.workspace.getConfiguration()without ever calling it. These tests won’t catch regressions inQueryResultWebviewController.getGridSettingsConfig()(including validation/defaulting ofshowGridLines). Consider replacing them with unit tests that call the real config-reading logic (or extracting that logic into a testable helper) and assert the resultingGridSettingsobject.
// NOTE: Tests that previously attempted to verify default gridSettings by directly
// applying `??` to `mockConfig.get(...)` without calling production code have been
// removed because they did not exercise any real implementation.
test("default gridSettings returns rowPadding=null when config is undefined", () => {
const mockConfig = {
get: sandbox.stub().returns(undefined),
} as unknown as vscode.WorkspaceConfiguration;
sandbox.stub(vscode.workspace, "getConfiguration").returns(mockConfig);
const rowPadding = mockConfig.get(Constants.configResultsGridRowPadding) ?? null;
expect(rowPadding).to.equal(null);
});
});
suite("bucketizeRowCount", () => {
const testCases: { value: number; expected: number }[] = [
{ value: 0, expected: 50 },
{ value: 49, expected: 50 },
{ value: 50, expected: 100 },
{ value: 99, expected: 100 },
{ value: 100, expected: 500 },
{ value: 499, expected: 500 },
{ value: 500, expected: 1000 },
{ value: 999, expected: 1000 },
{ value: 1000, expected: 5000 },
{ value: 4999, expected: 5000 },
{ value: 5000, expected: 10000 },
{ value: 12000, expected: 10000 },
];
for (const { value, expected } of testCases) {
test(`returns ${expected} for row count ${value}`, () => {
expect(queryResultUtils.bucketizeRowCount(value)).to.equal(expected);
extensions/mssql/src/queryResult/queryResultWebViewController.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds theme-aware, user-configurable styling controls to the modern (React/SlickGrid) query results grid, and wires existing font settings so they actually apply to the current results grid implementation.
Changes:
- Introduces new
mssql.resultsGrid.*settings for alternating row colors, grid line visibility, and row padding (density). - Threads
gridSettingsthrough the query results webview state and applies it via CSS classes/CSS custom properties. - Updates results grid sizing logic to account for font size and row padding changes (disposing/recreating the table when needed).
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| localization/xliff/vscode-mssql.xlf | Adds localized strings for the new settings (not reviewed for translation correctness). |
| extensions/mssql/package.nls.json | Adds NLS keys for new grid styling settings and enum descriptions. |
| extensions/mssql/package.json | Declares new user settings (alternating rows, grid lines mode, row padding with bounds). |
| extensions/mssql/src/constants/constants.ts | Adds section-relative constants for the new results grid settings keys. |
| extensions/mssql/src/sharedInterfaces/queryResult.ts | Adds GridSettings + GridLinesMode and includes gridSettings in the webview state. |
| extensions/mssql/src/queryResult/queryResultWebViewController.ts | Reads new settings from configuration and pushes updates to open results views/panels. |
| extensions/mssql/src/reactviews/pages/QueryResult/queryResultsGridView.tsx | Applies styling via container classes and CSS variable; fixes font family fallback to editor font var. |
| extensions/mssql/src/reactviews/pages/QueryResult/resultGrid.tsx | Updates row height/column width calculations and recreates tables when row-padding/font-size changes. |
| extensions/mssql/src/reactviews/media/slickgrid.css | Implements CSS for row padding, zebra striping, and grid line visibility modes. |
| extensions/mssql/test/unit/queryResultUtils.test.ts | Adds unit tests asserting new config key constants (plus an extra test needing adjustment). |




Customizable Styling for Results Grid
Fixes #19614
Summary
Adds user-configurable styling options for the query results grid, giving users control over font, row density, grid lines, and alternating row colors. All styling is theme-aware — colors derive from VS Code's CSS custom properties so they look correct across light, dark, and high-contrast themes.
Changes
Fixed existing settings:
mssql.resultsFontSizeandmssql.resultsFontFamilynow correctly apply to the modern React-based results grid. These settings were previously defined inpackage.jsonbut had no effect on the current webview (reported in New Query Results pane does not follow existing font size and font family settings #18351, mssql.resultsFontSize Not changing the font size in the Results Window #18530, Results Window Font Does Not Change #1730).New settings: