feat(query-editor): Priority Level support#3063
Open
bk201- wants to merge 11 commits into
Open
Conversation
Introduces request PriorityLevel selection in the Query Editor's Run button menu and propagates it through the tRPC layer down to the Cosmos client. Adds AzureResourceMetadata to centralize Azure control-plane metadata access (subscription, resource group, database account) with deep-readonly typing. Disables Throughput Bucket and Priority Level submenus when connected to the Cosmos DB emulator.
- Add resolveEffectivePriorityLevel helper that picks the per-request priority: user choice wins; otherwise fall back to Low for non-Azure connections (workspace-attached / connection-string), undefined for Azure-backed (SDK uses High default).
- QuerySession passes the resolved priority via FeedOptions so the header travels only with the data-plane query, not with metadata calls.
- DocumentSession applies the same fallback to all five item operations (create, replace, delete, read with _rid query fallback, bulk delete).
- queryEditorRouter exposes getCapabilities { isEmulator, isPriorityLevelEnabled, defaultPriorityLevel } gated on databaseAccount.enablePriorityBasedExecution; removes the dedicated isEmulator mutation.
- RunQueryButton hides the Priority Level submenu unless the account has the ARM flag set, disables it on the emulator, seeds the picker from defaultPriorityLevel or Low, and forwards the choice in runQuery payload.
- Drop-in fixes from working tree: a11y role/output cleanups in MigrationAssistant and GenerateQueryInput, await/void cleanups in extension.ts.
Contributor
🎉 Build Summary🔗 Source
📦 Package Information
🧪 Test Results
✅ Build StatusAll checks completed successfully! |
Views bundle:
- Explicit manualChunks splits node_modules into stable named chunks
(fluentui, griffel, react, monaco-editor, react-data-grid, vendor).
Before, Rolldown used arbitrary source filenames like
'ToolbarOverflowButton-*.js' for shared chunks, which made caching
unreliable across releases and bundle reports unreadable.
- MigrationAssistant no longer pulls react-data-grid or the Fluent UI
shared chunk; Document and QueryEditor get cacheable vendor chunks
across releases.
Extension bundle:
- manualChunks names pure-static vendor groups: azure-cosmos,
azure-identity (+msal), vscode-azext, tslib. main.mjs shrinks from
2.53 MB to 1.58 MB and the bundle report is now readable.
- @azure/arm-cosmosdb is now eagerly imported (used by virtually every
Cosmos DB code path); marked as named static chunk 'azure-arm-cosmosdb'.
- @azure/arm-postgresql{,-flexible} stay dynamic (PG-only). Three
ineffective `await import('../utils/azureClients')` wrappers were
converted to static imports because azureClients.ts is already
statically imported by 5 other files; the actual lazy boundary is
the inner `await import('@azure/arm-postgresql*')` inside the
factory functions.
- Deliberately NO manualChunks rule for @azure/arm-postgresql* or
@azure/core-*: they share code with the static graph through a lazy
boundary, and forcing names there folds shared core code into a
dynamic chunk that main.mjs then must import statically, defeating
the lazy load.
…selection - Remove `;` from autosuggest trigger characters in both Monaco and VSCode completion providers. The widget popping up while the user is still finishing the current statement was distracting; the widget still opens on the subsequent newline (`\n`) which is the start of the next query in multi-query documents. - Align VSCode provider trigger set with Monaco: add `\n` so users see SELECT proposed on a fresh line without needing Ctrl+Space. - QueryMonaco editor: set suggest.selectionMode: 'whenQuickSuggestion' so the suggest widget no longer auto-highlights its first item when opened by a trigger character (most notably `\n`) or by manual invoke. A second Enter on an empty line now inserts a newline instead of accidentally committing the first suggestion (e.g. AND). Auto-highlight still works when the widget is opened by typing letters (quick suggestion), where the highlighted match is the expected UX. - Update the Monaco provider trigger-character unit test accordingly.
# Conflicts: # l10n/bundle.l10n.json # src/panels/trpc/routers/queryEditorRouter.ts # src/webviews/cosmosdb/QueryEditor/QueryPanel/GenerateQueryInput.tsx # src/webviews/cosmosdb/QueryEditor/state/QueryEditorContextProvider.tsx
languy
approved these changes
May 29, 2026
| armClient?: CosmosDBManagementClient; | ||
| resourceGroup?: string; | ||
| databaseAccount?: DatabaseAccountGetResults; | ||
| arm?: AzureResourceMetadata; |
Contributor
There was a problem hiding this comment.
nit: I would choose a more explicit name like azureResourceMetadata to avoid confusion with ARM (Azure resource manager)
| > | ||
| {state.assessmentProgress} | ||
| </Text> | ||
| <output aria-live="polite"> |
Contributor
There was a problem hiding this comment.
It's great to fix it, but next time, let's keep the change separate.
Comment on lines
+18
to
+20
| cosmosDbDocument: () => import('./cosmosdb/Document/Document').then((m) => m.Document), | ||
| cosmosDbMigration: () => import('./cosmosdb/Migration/MigrationAssistant').then((m) => m.MigrationAssistant), | ||
| cosmosDbQuery: () => import('./cosmosdb/QueryEditor/QueryEditor').then((m) => m.QueryEditor), |
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.
What's in this PR
1. Query Editor — Priority Level support (main feature)
Adds Cosmos DB Priority-based execution support to the Query Editor.
Priority Levelsubmenu inside the Run button, withHigh/Lowradio options.isPriorityLevelEnabledcapability) and disabled for the local emulator.queryEditorRouter.runQuery) into the SDK's request options, and intentionally not sent for emulator connections (where the header is meaningless).Touched files:
src/panels/trpc/routers/queryEditorRouter.tssrc/webviews/cosmosdb/QueryEditor/QueryPanel/RunQueryButton.tsxsrc/webviews/cosmosdb/QueryEditor/state/QueryEditorContextProvider.tsxAlso fixed a pre-existing UI bug in the Run-button menu: when both
Throughput BucketandPriority Levelsubmenus were visible, two<MenuDivider />s were rendered back-to-back. Now a single divider is shown when at least one of the config submenus is visible.2. Webview cold-open performance
Opening a webview panel in dev mode previously took ~5 s before content appeared. A DevTools trace pinned the cost to two issues:
@griffel/core,stylis,rtl-css-js,@emotion/hash, Fluent UI runtime, etc.Fixes applied:
src/webviews/WebviewRegistry.ts— entries are now() => import(...)factories. Each view (Document,MigrationAssistant,QueryEditor) is dynamically imported, so opening one panel no longer pays the cost of loading the other two. In prod each view becomes its own Rollup chunk — e.g. opening the Document panel no longer downloads Monaco.src/webviews/index.tsx—render()awaits the dynamic import before mounting React.vite.config.views.mjs— addedserver.warmupforsrc/webviews/**andpackages/*/src/**so the dev server pre-transforms files at startup instead of on first request.vite.config.views.mjs— addedoptimizeDeps.includefor@griffel/core,@griffel/react,stylis,rtl-css-js,@emotion/hash,@fluentui/react-components,@fluentui/react-iconsso Rolldown emits a separate dep pre-bundle entry for each instead of merging them into one monolithic shared chunk that V8 has to parse sequentially on the main thread.3. Initial loader spinner
src/panels/BaseTab.ts— added a CSS-only loader (spinner + localized "Loading…" label) rendered inside#rootdirectly in the HTML template. It appears instantly when the panel opens — before any module is fetched or React hydrates — and is automatically replaced whencreateRoot().render()mounts the React tree.Accessibility:
role="status"+aria-live="polite"on the container so screen readers announce it.aria-hidden="true"on the rotating ring (decorative).--vscode-foreground,--vscode-progressBar-background,--vscode-font-family, …) so it matches the active theme.prefers-reduced-motion.4. Maintenance
npm run lint-fixautofix pass on 5 unrelated files (dropped redundantreturn awaitand unusedeslint-disabledirectives), followed bynpm run prettier-fix.Fixes: #3007