Add execution plan comparison - #22695
Draft
Aasim Khan (aasimkhan30) wants to merge 7 commits into
Draft
Conversation
…lanComparison # Conflicts: # extensions/mssql/l10n/bundle.l10n.json # extensions/mssql/package.json # extensions/mssql/package.nls.json # extensions/mssql/src/controllers/executionPlanWebviewController.ts # extensions/mssql/src/previews/previewService.ts # extensions/mssql/src/queryResult/queryResultWebViewController.ts # extensions/mssql/src/sharedInterfaces/executionPlan.ts # extensions/mssql/src/webviews/common/icons/executionPlanIcons.css # extensions/mssql/src/webviews/common/icons/executionPlanIcons.tsx # extensions/mssql/src/webviews/common/locConstants.ts # extensions/mssql/src/webviews/pages/ExecutionPlan/executionPlanGraph.tsx # extensions/mssql/src/webviews/pages/ExecutionPlan/executionPlanModel.ts # extensions/mssql/src/webviews/pages/ExecutionPlan/executionPlanTooltip.ts # extensions/mssql/src/webviews/pages/ExecutionPlan/executionPlanView.ts # extensions/mssql/src/webviews/pages/ExecutionPlan/executionPlanViewport.ts # extensions/mssql/src/webviews/pages/ExecutionPlan/highlightExpensiveOperations.tsx # extensions/mssql/src/webviews/pages/ExecutionPlan/reactFlowExecutionPlan.css # extensions/mssql/src/webviews/pages/ExecutionPlan/reactFlowExecutionPlan.tsx # extensions/mssql/src/webviews/pages/ExecutionPlan/reactFlowIconMenu.tsx # extensions/mssql/test/e2e/executionPlan.spec.ts # extensions/mssql/test/unit/executionPlanModel.test.ts # extensions/mssql/test/unit/executionPlanViewport.test.ts # extensions/mssql/test/unit/executionPlanWebviewController.test.ts # extensions/mssql/test/unit/previewService.test.ts # extensions/mssql/test/unit/queryResultWebViewController.test.ts # localization/xliff/vscode-mssql.xlf
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a dedicated execution plan comparison experience, wiring new controller/state/model support to a React Flow-based comparison webview with synchronized zoom, selectable statements, and a virtualized properties pane.
Changes:
- Introduces a new execution plan comparison webview (UI + CSS) and a comparison model for matched nodes / property row generation.
- Adds a new
ExecutionPlanComparisonWebviewController, source registry support, and SQL Tools Service compare call plumbing. - Integrates “Compare Execution Plan” entry points from existing execution plan/query result webviews and adds unit test coverage.
Reviewed changes
Copilot reviewed 25 out of 25 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 comparison feature (auto-generated localization). |
| extensions/mssql/l10n/bundle.l10n.json | Adds localized strings for backend/webview comparison labels (generated bundle). |
| extensions/mssql/src/constants/locConstants.ts | Adds backend localized constants for compare editor titles and QuickPick messaging. |
| extensions/mssql/src/controllers/executionPlanComparisonWebviewController.ts | New controller to manage plan selection, loading, and comparison requests/state. |
| extensions/mssql/src/controllers/executionPlanSourceRegistry.ts | New registry for tracking open execution plan sources for reuse in comparison. |
| extensions/mssql/src/controllers/executionPlanWebviewController.ts | Registers opened plan sources and adds a reducer to open the comparison webview. |
| extensions/mssql/src/controllers/sharedExecutionPlanUtils.ts | Adds helper to open the comparison webview controller. |
| extensions/mssql/src/queryResult/utils.ts | Adds reducers to open comparison from query results when React Flow preview is enabled. |
| extensions/mssql/src/services/executionPlanService.ts | Implements compareExecutionPlanGraph request to SQL Tools Service. |
| extensions/mssql/src/sharedInterfaces/executionPlan.ts | Extends shared interfaces/state/provider/service contracts for comparison mode. |
| extensions/mssql/src/webviews/common/icons/executionPlanIcons.tsx | Adds reset-zoom icon and a numbered “search plan” icon. |
| extensions/mssql/src/webviews/common/icons/executionPlanIcons.css | Styles the numbered plan badge and improves high-contrast behavior. |
| extensions/mssql/src/webviews/common/locConstants.ts | Adds webview localized strings for comparison UI and property table labels. |
| extensions/mssql/src/webviews/pages/ExecutionPlan/executionPlanComparison.css | New styling for split panes, toolbar, and virtualized comparison properties grid. |
| extensions/mssql/src/webviews/pages/ExecutionPlan/executionPlanComparison.tsx | New comparison webview UI: pane layout, zoom sync, find, and properties grid. |
| extensions/mssql/src/webviews/pages/ExecutionPlan/executionPlanComparisonModel.ts | New model utilities for match maps and property row comparison/flattening. |
| extensions/mssql/src/webviews/pages/ExecutionPlan/executionPlanGraph.tsx | Passes graph index / compare capability down to the React Flow icon stack. |
| extensions/mssql/src/webviews/pages/ExecutionPlan/executionPlanPage.tsx | Routes to comparison UI when comparison state is present. |
| extensions/mssql/src/webviews/pages/ExecutionPlan/executionPlanStateProvider.tsx | Adds comparison actions to the execution plan webview RPC provider. |
| extensions/mssql/src/webviews/pages/ExecutionPlan/reactFlowExecutionPlan.css | Adds overlay styling for comparison “matched group” bounding boxes. |
| extensions/mssql/src/webviews/pages/ExecutionPlan/reactFlowExecutionPlan.tsx | Adds selection callback, external viewport control, and comparison group overlays. |
| extensions/mssql/src/webviews/pages/ExecutionPlan/reactFlowIconMenu.tsx | Adds “Compare Execution Plan” toolbar button when comparison is available. |
| extensions/mssql/src/webviews/pages/QueryResult/queryResultStateProvider.tsx | Adds comparison-related actions to query result webview RPC provider. |
| extensions/mssql/test/unit/executionPlanComparisonModel.test.ts | New unit tests for comparison model map/row building behavior. |
| extensions/mssql/test/unit/executionPlanWebviewController.test.ts | Adds tests for opening comparison and for comparison controller helper functions. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+360
to
+383
| const comparisonIcon = (row: ExecutionPlanComparisonPropertyRow) => { | ||
| const comparisonLabel = | ||
| row.comparison === "greater" | ||
| ? locConstants.executionPlan.greaterThan | ||
| : row.comparison === "less" | ||
| ? locConstants.executionPlan.lessThan | ||
| : row.comparison === "different" | ||
| ? locConstants.executionPlan.notEqual | ||
| : ""; | ||
| return ( | ||
| <span | ||
| className={`execution-plan-comparison-diff execution-plan-comparison-diff-${row.comparison}`} | ||
| title={comparisonLabel} | ||
| aria-label={comparisonLabel}> | ||
| {row.comparison === "greater" ? ( | ||
| <ChevronRight16Regular /> | ||
| ) : row.comparison === "less" ? ( | ||
| <ChevronLeft16Regular /> | ||
| ) : row.comparison === "different" ? ( | ||
| <Dismiss16Regular /> | ||
| ) : undefined} | ||
| </span> | ||
| ); | ||
| }; |
Comment on lines
+111
to
+117
| const primaryNumber = Number.parseFloat(primary.displayValue); | ||
| const secondaryNumber = Number.parseFloat(secondary.displayValue); | ||
| if (!Number.isFinite(primaryNumber) || !Number.isFinite(secondaryNumber)) { | ||
| return "different"; | ||
| } | ||
| return primaryNumber > secondaryNumber ? "greater" : "less"; | ||
| } |
PR Changes
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #22695 +/- ##
==========================================
+ Coverage 87.53% 87.57% +0.03%
==========================================
Files 340 344 +4
Lines 119835 120879 +1044
Branches 552 594 +42
==========================================
+ Hits 104898 105855 +957
- Misses 14937 15024 +87
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Validation
npm run build:webviewsexecutionPlanComparisonModel.test.tsexecutionPlanWebviewController.test.tsgit diff --checkThe full execution plan E2E suite requires the VS Code and SQL integration test harness and was not run locally.