Conversation
Use a shared registrationPromise to prevent duplicate provider registrations when multiple editors call registerDocumentDBQueryLanguage() before the first async import resolves.
Report fieldCompletionDataFetchFailed event when getFieldCompletionData fails, so silent field-completion degradation is visible in telemetry.
…er, acorn validation (#518)
Implements detectCursorContext() - a pure function that determines the semantic position of the cursor within a DocumentDB query expression. Supports: key, value, operator, array-element, and unknown positions. Uses backward character scanning (no AST parsing) for robustness with incomplete/mid-typing input. Includes 41 tests covering: - Core context detection (complete expressions) - Incomplete/broken input (Step 1.5 from plan) - Multi-line expressions - fieldLookup integration for BSON type enrichment
Wire CursorContext into createCompletionItems() to filter completions based on the semantic cursor position: - key position: field names + key-position operators (, , etc.) - value position: BSON constructors only (ObjectId, UUID, ISODate) - operator position: comparison/element/array operators with type-aware sort - array-element: same as key position - unknown/undefined: full list (backward compatible) All 48 existing tests pass unchanged. 16 new context-sensitive tests added.
Call detectCursorContext() in provideCompletionItems to detect the semantic cursor position from editor text + offset. Pass the detected CursorContext through to createCompletionItems() for context-sensitive filtering. Includes field type lookup via completionStore to enrich context with BSON types for type-aware operator sorting.
Issue A - Strip outer braces from operator snippets at operator position:
{ $gt: ${1:value} } → $gt: ${1:value} (when inside { field: { | } })
Prevents double-brace insertion bug.
Issue B - Add category labels to completion items:
Uses CompletionItemLabel.detail for operator category (comparison, logical, etc.)
Uses CompletionItemLabel.description for operator description text.
Issue C - Value position now shows operators + BSON constructors:
Operators sorted first (0_), BSON constructors second (1_).
Operators keep their full brace-wrapping snippets at value position.
Also: trace-level console.debug logging in provideCompletionItems for debugging.
178 tests pass across 6 test suites. Build + lint clean.
- Remove 'detail' field from operator completions (was noisy) - Move category label to label.description (matches field items pattern) - Move entry.description to documentation (was in both detail and desc) - Combine description text + docs link in documentation field - Add range/insertText to trace logging for snippet debugging
Root cause: Monaco snippet syntax interprets $gt as a variable
reference (variable 'gt'), which resolves to empty string for unknown
variables. Result: { $gt: ${1:value} } produces '{ : value }'.
Fix: escapeSnippetDollars() escapes $ before letters ($gt → \$gt)
while preserving tab stop syntax (${1:value} unchanged).
BSON constructors like ObjectId("${1:hex}") are unaffected.
This was the root cause of POC Observation 2 (T5 ⚠️ PARTIAL).
…estions
Refactor:
- Extract completion logic into completions/ folder:
- snippetUtils.ts: stripOuterBraces, escapeSnippetDollars
- mapCompletionItems.ts: operator/field → CompletionItem mapping
- typeSuggestions.ts: type-aware value suggestions (NEW)
- createCompletionItems.ts: main entry point with context branching
- index.ts: barrel exports
- documentdbQueryCompletionProvider.ts now re-exports from completions/
New feature — type-aware value suggestions at value position:
- bool fields → true, false (as first completions)
- int/double/long/decimal → range query { $gt: ▪, $lt: ▪ }
- string → regex snippet, empty string literal
- date → ISODate constructor, date range snippet
- objectid → ObjectId constructor
- null → null literal
- array → $elemMatch, $size snippets
Suggestions get sort prefix 00_ (before operators at 0_).
First suggestion is preselected.
197 tests pass across 6 suites. Build + lint clean.
The schema analyzer uses BSONTypes enum strings ('boolean', 'int32',
'decimal128') while the type suggestions used shortened names ('bool',
'int', 'decimal'). Fix the TYPE_SUGGESTIONS keys to match:
- bool → boolean
- int → int32
- decimal → decimal128
- Added: number (generic BSONTypes.Number)
Also noted the type-name mismatch between schema-analyzer BSONTypes
('int32') and documentdb-constants applicableBsonTypes ('int') —
tracked as a future normalization task.
Replace format pattern 'yyyy-MM-ddTHH:mm:ssZ' with a valid example '2025-01-01T00:00:00Z'. The format pattern was confusing — users typed over it with values like '2222-11-11T11:11:111' which fail ISODate validation. Also update date range snippet with realistic start/end dates.
… and improved sorting
… for unknown identifiers
…ery results After a find/findOne query with a known namespace, the shell appends a clickable action line: '📊 Open collection [db.coll] in Collection View'. - ShellTerminalLinkProvider: TerminalLinkProvider matching the action line pattern, opens Collection View via internal command on click - DocumentDBShellPty: writes action line after Cursor/Document results with source.namespace; tracks active action line state - Terminal registry: maps Terminal → PTY info for the link provider - 16 tests (10 link provider + 6 PTY action line tests) - Query pre-fill deferred to future work (§3.1 in terminal enhancements)
- Show username in banner for SCRAM auth (User: admin | Authentication: SCRAM | Database: mydb) - For Entra ID, show auth method without username (as before) - Update terminal tab name dynamically after connection to include user: 'DocumentDB: user@cluster/db' - Add username field to ShellConnectionMetadata, sourced from CredentialCache - Add onDidChangeName to PTY for dynamic terminal name updates
- Add setTerminal, getTerminalInfo, onDidChangeName to DocumentDBShellPty mock - Mock registerShellTerminal in openInteractiveShell tests - Fix pre-existing test: 'Authenticating and connecting' → 'Connecting and authenticating'
…Ctrl+C during eval - Add _terminatingIntentionally flag to WorkerSessionManager to suppress onWorkerExit callback during intentional kills (Ctrl+C, timeout, dispose) - Allow Ctrl+C to bypass the _enabled guard in ShellInputHandler so users can cancel running evaluations - Reset evaluating state and re-enable input after Ctrl+C kill - Fixes: shell no longer shows 'ended unexpectedly' on Ctrl+C or timeout - Fixes: Ctrl+C now cancels long-running queries instead of being swallowed Addresses review findings #2 and #14.
…es Ctrl+C/timeout) - Add _activeDatabase field to ShellSessionManager, initialized from connectionInfo - Update _activeDatabase when PTY detects a 'use <db>' result - Use _activeDatabase (not original connectionInfo.databaseName) for both buildInitMessage() and evaluate(), so worker re-init uses the correct database - Add setActiveDatabase mock to PTY test suite Addresses review finding #1.
- Extend EXIT_PATTERN regex to match exit(), quit(), exit();, quit(); - Previously these bypassed the interceptor and went to @MongoSH, which called process.exit() in the worker, producing a crash-like exit - Update tests to verify the new function-call forms are intercepted Addresses review finding #7.
- Set _inputHandler.setEnabled(false) at the start of open() - Re-enable input after successful init (before showing prompt) - Re-enable input on init failure (before closing terminal) - Prevents user input from triggering a concurrent initialize() call Addresses review finding #8.
…ll sessions - Replace hardcoded expiresInSeconds: 0 with actual expiration from the JWT - Parse the exp claim from the access token payload - Fall back to 3500 seconds (~1 hour) if JWT parsing fails - Eliminates redundant token acquisition on every database operation in persistent shell sessions (previously every command triggered a full IPC + auth API round-trip) Addresses review finding #9.
… handling - Replace 📊 emoji with 🔗 (link icon) to suggest clickability - Make action line format locale-independent: '🔗 [db.collection]' (no English text to translate — tooltip remains localized) - Regex in ShellTerminalLinkProvider now matches the sentinel prefix instead of hard-coded English text - Fix Unicode input handling: use for...of iteration instead of data[i] to correctly handle surrogate pairs (emoji, CJK Extension B) Addresses review findings #3 and #10.
Remove mockInitialize.mockResolvedValue(undefined) overrides so tests exercise the connected-shell code path with real metadata instead of falling into the error/failure path. Addresses review finding #5.
- Cache username from initialization metadata in _username field - Extract updateTerminalTitle() helper called from both init and updateDatabaseFromResult() - Terminal tabs now reflect the active database after switching Addresses review finding #6.
Change regex from /\S+/ to /.+/ to capture database names containing spaces (e.g., 'my db'). Addresses review finding #11.
Addresses review finding #12.
Addresses review finding #13.
The eraseActionLine method was a no-op (only reset a flag). Remove the method, the _hasActiveActionLine field, and the call site. Action lines in scroll-back remain clickable, which is the intended behavior. Addresses PR thread item B (r3057731102, r3057760296).
…r message - Change getShellTimeoutMs() local fallback from 120 to 30 (matches the contributed setting default in package.json) - Timeout error message now tells users the timeout is configurable in Settings > DocumentDB > Shell > Timeout Addresses PR thread item D (r3057731255, r3057764942).
… Reconnecting message Three user-facing issues fixed: 1. print() output now gets a newline before the next prompt. Track _lastOutputHadTrailingNewline from console output and emit \r\n before the prompt if the last output didn't end with one. 2. Ctrl+C no longer shows 'Worker terminated' error. Set _interrupted flag in handleInterrupt() so evaluateInput()'s catch and handleLineInput()'s finally both skip their output/prompt when the interruption was intentional. 3. After Ctrl+C, show 'Reconnecting...' while the worker respawns. Add onReconnecting callback to ShellSessionCallbacks, fired from evaluate() when re-initialization is needed after a worker kill.
… Playground in DocumentDB views
- Introduced `playground-dark.svg` with a fill color of #C5C5C5. - Introduced `playground-light.svg` with a fill color of #424242. - Both icons share the same shape as the "keyboard" codicon sourced from record-keys.svg in the vscode-codicons repository.
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Umbrella WIP for “shell integration” in the DocumentDB VS Code extension: introduces new workspace packages (schema analyzer, constants, shell runtime, shell API types), adds a pseudoterminal-based interactive shell and Query Playground commands, and removes legacy scrapbook/shell/grammar assets.
Changes:
- Added new monorepo packages for schema analysis, operator metadata, shell evaluation/runtime, and shell API type definitions.
- Implemented Query Playground + Interactive Shell command surfaces and integrated shared schema caching via
SchemaStore. - Removed legacy scrapbook commands, ANTLR grammar, and old shell launcher; updated docs/CI to reflect new terminology and build steps.
Reviewed changes
Copilot reviewed 115 out of 272 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| src/documentdb/grammar/mongoLexer.tokens | Removed legacy lexer token file (scrapbook grammar cleanup). |
| src/documentdb/grammar/mongo.tokens | Removed legacy parser token file (scrapbook grammar cleanup). |
| src/documentdb/connectToClient.ts | Updated import paths after refactor. |
| src/documentdb/ClustersClient.ts | Added MongoClient accessor, schema cache clearing hooks, and in-memory DB/collection list caching; switched projection/sort parsing to shell BSON parser. |
| src/documentdb/ClusterSession.ts | Migrated collection view schema accumulation to shared SchemaStore; updated parsing for projection/sort. |
| src/commands/scrapbook-commands/executeCommand.ts | Removed legacy scrapbook command handler. |
| src/commands/scrapbook-commands/executeAllCommand.ts | Removed legacy scrapbook command handler. |
| src/commands/scrapbook-commands/createScrapbook.ts | Removed legacy scrapbook creation command. |
| src/commands/scrapbook-commands/connectCluster.ts | Removed legacy scrapbook connect command. |
| src/commands/schemaStore/showSchemaStoreStats.ts | Added command to print SchemaStore stats to output channel. |
| src/commands/schemaStore/clearSchemaCache.ts | Added command to clear shared schema cache. |
| src/commands/removeConnection/removeConnection.ts | Clears cluster schema cache when a connection is removed. |
| src/commands/playground/scanCollectionSchema.ts | Added “scan schema” sampling command feeding shared SchemaStore. |
| src/commands/playground/runSelected.ts | Added “run selected / current block” Query Playground command. |
| src/commands/playground/runAll.ts | Added “run all” Query Playground command. |
| src/commands/playground/newPlayground.ts | Added “new Query Playground” command and untitled-file template generation. |
| src/commands/playground/connectDatabase.ts | Added command to connect Query Playground to a database from tree context. |
| src/commands/openInteractiveShell/openInteractiveShell.ts | Added interactive shell command to open a pseudoterminal REPL. |
| src/commands/openInteractiveShell/openInteractiveShell.test.ts | Added Jest tests for interactive shell command behavior. |
| src/commands/openCollectionView/openCollectionView.ts | Disposes ClusterSession when collection view tab closes. |
| src/commands/launchShell/launchShell.ts | Removed legacy external mongosh launcher. |
| src/commands/deleteDatabase/deleteDatabase.ts | Clears database schema cache on successful delete. |
| src/commands/deleteCollection/deleteCollection.ts | Clears collection schema cache on successful delete. |
| playground-language-configuration.json | Added language configuration for Query Playground editor behavior. |
| packages/schema-analyzer/tsconfig.json | Added schema-analyzer package TypeScript config. |
| packages/schema-analyzer/src/index.ts | Converted package entry point to exports (no longer a language server bootstrap). |
| packages/schema-analyzer/src/getKnownFields.ts | Added known-field extraction helper producing FieldEntry[]. |
| packages/schema-analyzer/src/ValueFormatters.ts | Updated value formatter to use new BSONTypes enum. |
| packages/schema-analyzer/src/JSONSchema.ts | Refined JSON Schema typing and documented SchemaAnalyzer extensions. |
| packages/schema-analyzer/src/BSONTypes.ts | Added BSON type enum + helpers and inference. |
| packages/schema-analyzer/package.json | Added schema-analyzer workspace package manifest. |
| packages/schema-analyzer/jest.config.js | Added Jest config for schema-analyzer package. |
| packages/schema-analyzer/README.md | Added schema-analyzer package documentation. |
| packages/documentdb-shell-runtime/tsconfig.json | Added shell-runtime package TypeScript config. |
| packages/documentdb-shell-runtime/src/types.ts | Added public runtime types for shell eval results and options. |
| packages/documentdb-shell-runtime/src/index.ts | Added barrel exports for shell-runtime. |
| packages/documentdb-shell-runtime/src/ResultTransformer.ts | Added result normalization for @mongosh outputs. |
| packages/documentdb-shell-runtime/src/ResultTransformer.test.ts | Added unit tests for ResultTransformer. |
| packages/documentdb-shell-runtime/src/HelpProvider.ts | Added help text generator for shell/playground surfaces. |
| packages/documentdb-shell-runtime/src/HelpProvider.test.ts | Added unit tests for HelpProvider. |
| packages/documentdb-shell-runtime/src/DocumentDBShellRuntime.test.ts | Added unit tests for runtime lifecycle and persistence behavior. |
| packages/documentdb-shell-runtime/src/DocumentDBServiceProvider.ts | Added DocumentDB-specific @mongosh service provider wrapper. |
| packages/documentdb-shell-runtime/src/CommandInterceptor.ts | Added pre-eval command interception (help/exit/clear). |
| packages/documentdb-shell-runtime/src/CommandInterceptor.test.ts | Added unit tests for CommandInterceptor. |
| packages/documentdb-shell-runtime/package.json | Added shell-runtime workspace package manifest. |
| packages/documentdb-shell-runtime/jest.config.js | Added Jest config for shell-runtime package. |
| packages/documentdb-shell-runtime/README.md | Added shell-runtime package documentation. |
| packages/documentdb-shell-api-types/typeDefs/README.md | Added documentation for .d.ts shell API type defs source/maintenance. |
| packages/documentdb-shell-api-types/tsconfig.scripts.json | Added scripts tsconfig for shell-api-types package. |
| packages/documentdb-shell-api-types/tsconfig.json | Added build tsconfig for shell-api-types package. |
| packages/documentdb-shell-api-types/src/types.ts | Added ShellMethodEntry type for method registry. |
| packages/documentdb-shell-api-types/src/methodRegistry.test.ts | Added tests for method registry invariants. |
| packages/documentdb-shell-api-types/src/index.ts | Added exports + lazy loader for .d.ts content. |
| packages/documentdb-shell-api-types/package.json | Added shell-api-types workspace package manifest. |
| packages/documentdb-shell-api-types/jest.config.js | Added Jest config for shell-api-types package. |
| packages/documentdb-shell-api-types/README.md | Added package documentation for shell API types & verification. |
| packages/documentdb-constants/tsconfig.scripts.json | Added scripts tsconfig for constants package. |
| packages/documentdb-constants/tsconfig.json | Added build tsconfig for constants package. |
| packages/documentdb-constants/src/updateOperators.ts | Added generated update-operator metadata registry. |
| packages/documentdb-constants/src/types.ts | Added public types for operator registry and filtering. |
| packages/documentdb-constants/src/systemVariables.ts | Added generated system variable metadata registry. |
| packages/documentdb-constants/src/structuralInvariants.test.ts | Added invariant tests ensuring operator registry consistency. |
| packages/documentdb-constants/src/parseOperatorReference.ts | Added parser for scraped operator reference markdown. |
| packages/documentdb-constants/src/parseOperatorReference.test.ts | Added unit tests for operator reference parser. |
| packages/documentdb-constants/src/metaTags.ts | Added meta tags and completion presets for filtering. |
| packages/documentdb-constants/src/index.ts | Added barrel exports and auto-loading of operator registry. |
| packages/documentdb-constants/src/getFilteredCompletions.ts | Added operator registry + filtering API and registration helpers. |
| packages/documentdb-constants/src/getFilteredCompletions.test.ts | Added filtering/preset/idempotency tests. |
| packages/documentdb-constants/src/docLinks.ts | Added docs URL generator from operator meta tags. |
| packages/documentdb-constants/src/docLinks.test.ts | Added unit tests for docs URL generation. |
| packages/documentdb-constants/src/bsonConstructors.ts | Added BSON constructor completion entries. |
| packages/documentdb-constants/src/accumulators.ts | Added generated accumulator metadata registry. |
| packages/documentdb-constants/scripts/README.md | Added docs for scrape/generate/evaluate workflow. |
| packages/documentdb-constants/resources/overrides/operator-overrides.md | Added hand-maintained overrides for scraped operator data. |
| packages/documentdb-constants/package.json | Added constants workspace package manifest + scripts. |
| packages/documentdb-constants/jest.config.js | Added Jest config for constants package. |
| packages/documentdb-constants/README.md | Added constants package documentation + workflow. |
| grammar/mongo.g4 | Removed legacy ANTLR grammar source. |
| grammar/configuration.json | Removed legacy language configuration. |
| grammar/Regular Expressions (JavaScript).tmLanguage | Removed legacy TextMate regexp grammar. |
| grammar/Readme.md | Removed legacy grammar maintenance notes. |
| extension.bundle.ts | Updated bundle exports to new (non-scrapbook) locations. |
| docs/release-notes/0.4.md | Updated terminology from scrapbook → query playground. |
| docs/release-notes/0.2.4.md | Updated terminology from scrapbook → query playground. |
| docs/release-notes/0.2.1.md | Updated terminology from scrapbook → query playground. |
| README.md | Removed scrapbook/mongosh requirement and scrapbook known issue bullets. |
| CHANGELOG.md | Updated terminology from scrapbook → query playground. |
| .vscode/settings.json | Added local Jest/testing UX settings; fixed JSON formatting. |
| .github/workflows/main.yml | Added step to build workspace packages in CI. |
| .github/copilot-instructions.md | Updated wording + added Git safety and terminology guidance. |
| .azure-pipelines/compliance/CredScanSuppressions.json | Updated suppression path for moved test file. |
Comments suppressed due to low confidence (1)
src/documentdb/ClustersClient.ts:1
- listCollections(databaseName, useCached)
caches by database name but (in the shown diffs) there’s no invalidation on collection create/drop. This can surface as stale autocomplete / UI listings whenuseCached` is used. Add targeted invalidation (e.g., clearCollectionsCache(databaseName) / clearAllCollectionsCache) and invoke it from collection create/drop flows (and database delete should ideally clear the entry too).
/*---------------------------------------------------------------------------------------------
| async listDatabases(useCached?: boolean): Promise<DatabaseItemModel[]> { | ||
| if (useCached && this._databasesCache) { | ||
| return this._databasesCache; | ||
| } | ||
|
|
||
| const rawDatabases: ListDatabasesResult = await this._mongoClient.db().admin().listDatabases(); |
There was a problem hiding this comment.
listDatabases(useCached)introduces a per-client cache, but this cache is never invalidated when databases are created/deleted. After a successful delete, callers usinguseCached: true` may keep seeing stale databases until reconnect. Consider adding explicit cache invalidation APIs on ClustersClient (e.g., clearDatabasesCache/clearCollectionsCache) and calling them from delete/create commands or from the code paths that mutate database/collection state.
| } | ||
| */ | ||
|
|
||
| this._databasesCache = databases; |
There was a problem hiding this comment.
listDatabases(useCached)introduces a per-client cache, but this cache is never invalidated when databases are created/deleted. After a successful delete, callers usinguseCached: true` may keep seeing stale databases until reconnect. Consider adding explicit cache invalidation APIs on ClustersClient (e.g., clearDatabasesCache/clearCollectionsCache) and calling them from delete/create commands or from the code paths that mutate database/collection state.
| public static getExistingClient(clusterId: string): ClustersClient | undefined { | ||
| return ClustersClient._clients.get(clusterId); | ||
| } | ||
|
|
||
| public static async deleteClient(credentialId: string): Promise<void> { |
There was a problem hiding this comment.
There’s an inconsistency between the key naming used by the connection pool APIs (clusterId vs credentialId). getExistingClient(clusterId) reads _clients.get(clusterId), but deleteClient and other methods in this file still use credentialId naming. If the map key is truly the stable clusterId, align parameter names/signatures across these APIs; if not, getExistingClient may return undefined even when a client exists.
| options.projection = parseShellBSON(queryParams.project, { | ||
| mode: ParseMode.Loose, | ||
| }) as Document; |
There was a problem hiding this comment.
After parsing projection/sort with parseShellBSON, the result is cast to Document without validating the parsed value is actually an object. Inputs like 1, [], or a string literal can parse successfully but will produce invalid MongoDB driver options and lead to less actionable downstream errors. Consider verifying the parsed value is a plain object (and for sort, that it matches acceptable sort value shapes) and throw the existing QueryError(INVALID_PROJECTION|INVALID_SORT) with a targeted message when the parsed value isn’t an object.
| options.sort = parseShellBSON(queryParams.sort, { | ||
| mode: ParseMode.Loose, | ||
| }) as Document; |
There was a problem hiding this comment.
After parsing projection/sort with parseShellBSON, the result is cast to Document without validating the parsed value is actually an object. Inputs like 1, [], or a string literal can parse successfully but will produce invalid MongoDB driver options and lead to less actionable downstream errors. Consider verifying the parsed value is a plain object (and for sort, that it matches acceptable sort value shapes) and throw the existing QueryError(INVALID_PROJECTION|INVALID_SORT) with a targeted message when the parsed value isn’t an object.
| { | ||
| value: '$min', | ||
| meta: META_UPDATE_FIELD, | ||
| description: 'Retrieves the minimum value for a specified field', | ||
| snippet: '{ $min: { "${1:field}": ${2:value} } }', | ||
| link: 'https://learn.microsoft.com/en-us/azure/documentdb/operators/accumulators/$min', // inferred from another category | ||
| }, | ||
| { | ||
| value: '$max', | ||
| meta: META_UPDATE_FIELD, | ||
| description: 'The $max operator returns the maximum value from a set of input values.', | ||
| snippet: '{ $max: { "${1:field}": ${2:value} } }', | ||
| link: 'https://learn.microsoft.com/en-us/azure/documentdb/operators/accumulators/$max', // inferred from another category | ||
| }, |
There was a problem hiding this comment.
Several update-operator entries have descriptions/links that refer to accumulator or aggregation-stage semantics (e.g., $min/$max linking to accumulators, $unset described as an aggregation stage). Since these strings are used for autocomplete/hover, they can mislead users. Because this file is auto-generated, the fix should go through the generator inputs: either correct the scraping/category→meta mapping or add overrides in resources/overrides/operator-overrides.md (and regenerate) so update operators point to update docs and have update-specific descriptions.
| { | ||
| value: '$set', | ||
| meta: META_UPDATE_FIELD, | ||
| description: 'The $set operator in Azure DocumentDB updates or creates a new field with a specified value', | ||
| snippet: '{ $set: { "${1:field}": ${2:value} } }', | ||
| link: 'https://learn.microsoft.com/en-us/azure/documentdb/operators/aggregation/$set', // inferred from another category | ||
| }, |
There was a problem hiding this comment.
Several update-operator entries have descriptions/links that refer to accumulator or aggregation-stage semantics (e.g., $min/$max linking to accumulators, $unset described as an aggregation stage). Since these strings are used for autocomplete/hover, they can mislead users. Because this file is auto-generated, the fix should go through the generator inputs: either correct the scraping/category→meta mapping or add overrides in resources/overrides/operator-overrides.md (and regenerate) so update operators point to update docs and have update-specific descriptions.
| { | ||
| value: '$unset', | ||
| meta: META_UPDATE_FIELD, | ||
| description: 'The $unset stage in the aggregation pipeline is used to remove specified fields from documents.', | ||
| snippet: '{ $unset: { "${1:field}": ${2:value} } }', | ||
| link: 'https://learn.microsoft.com/en-us/azure/documentdb/operators/aggregation/$unset', // inferred from another category | ||
| }, |
There was a problem hiding this comment.
Several update-operator entries have descriptions/links that refer to accumulator or aggregation-stage semantics (e.g., $min/$max linking to accumulators, $unset described as an aggregation stage). Since these strings are used for autocomplete/hover, they can mislead users. Because this file is auto-generated, the fix should go through the generator inputs: either correct the scraping/category→meta mapping or add overrides in resources/overrides/operator-overrides.md (and regenerate) so update operators point to update docs and have update-specific descriptions.
| const now = new Date(); | ||
| const timestamp = now | ||
| .toLocaleString(undefined, { | ||
| year: 'numeric', | ||
| month: '2-digit', | ||
| day: '2-digit', | ||
| hour: '2-digit', | ||
| minute: '2-digit', | ||
| second: '2-digit', | ||
| hour12: false, | ||
| }) | ||
| .replace(/[/\\:]/g, '-') | ||
| .replace(/,\s*/g, '_'); |
There was a problem hiding this comment.
Using toLocaleString() for filenames can produce locale-specific characters/separators that aren’t covered by the current replacements (and can lead to inconsistent naming across machines). For a stable, filesystem-friendly filename, consider using an invariant timestamp format (e.g., based on toISOString() with targeted character replacements) so filenames are predictable and avoid unexpected characters.
| const now = new Date(); | |
| const timestamp = now | |
| .toLocaleString(undefined, { | |
| year: 'numeric', | |
| month: '2-digit', | |
| day: '2-digit', | |
| hour: '2-digit', | |
| minute: '2-digit', | |
| second: '2-digit', | |
| hour12: false, | |
| }) | |
| .replace(/[/\\:]/g, '-') | |
| .replace(/,\s*/g, '_'); | |
| const timestamp = new Date() | |
| .toISOString() | |
| .replace(/:/g, '-') | |
| .replace(/\./g, '-') | |
| .replace('T', '_') | |
| .replace('Z', ''); |
Shell Integration — DocumentDB Query Language & Autocomplete
Umbrella PR for the shell integration feature: a custom
documentdb-queryMonaco language with intelligent autocomplete, hover docs, and validation across all query editor surfaces (filter, project, sort, aggregation, query playground).Work is organized as incremental steps, each delivered via a dedicated sub-PR merged into
feature/shell-integration.Progress
SchemaAnalyzer(JSON Schema output, incremental merge, 24 BSON types)@vscode-documentdb/schema-analyzerpackage, enrichedFieldEntrywith BSON types, added schema transformers, introduced monorepo structuredocumentdb-constantsPackage · feat: add documentdb-constants package — operator metadata for autocomplete #513 — 308 operator entries (DocumentDB API query operators, update operators, stages, accumulators, BSON constructors, system variables) as static metadata for autocompletedocumentdb-querycustom language with JS Monarch tokenizer (no TS worker), validated via POC across 8 test criteriaCompletionItemProvider· feat: documentdb-query language — CompletionItemProvider, HoverProvider, acorn validation #518 —documentdb-querylanguage registration, per-editor model URIs, completion data store,CompletionItemProvider(filter/project/sort),HoverProvider,acornvalidation,$-prefix fix, query parser replacement (shell-bson-parser), type-aware operator sorting, legacy JSON Schema pipeline removalcompletions/folderconnectToClient,mongoConnectionStrings).documentdbfiles with JS syntax highlighting, CodeLens (connection status, Run All, per-block Run), in-process@mongosheval reusing existingMongoClient, result formatting with headers/code echo/error hintsSchemaStore) · feat: Shared Schema Cache (SchemaStore) — Step 6.1 #538 — SharedSchemaStoresingleton for cross-tab and query playground schema sharing, Quick Scan action for on-demand schema samplingMongoClientfor infinite-loop safety and eval isolationCompletionItemProvider· Step 7 WI-1/2/3/4/5: Scratchpad IntelliSense — Shell API types, TS Plugin, CompletionItemProvider, Dynamic Schema, Refinements, Shared Logic #543 — VS Code extension-hostCompletionItemProviderfordb.chains, operators, schema fields via.d.ts+ TS server plugin (inline snapshot injection) + custom provider. Fixed VSIX packaging: TS plugin stub now created at runtime (Vue/Volar pattern) since vsce hardcodesnode_modules/**exclusion. Tracked for npm publishing: WIP: Publish TS server plugin as standalone npm package #548query-language/directory: platform-neutral core →shared/, scratchpad completions →playground-completions/, webview folder renamed toquery-language-support/. Pure refactoring, no functionality changes.console.log(),print(), andprintjson()support via@mongoshevaluation listener; dedicated output channel; customPlaygroundResultProviderwith stable per-file result tabs, DocumentDB icon, JSONC grammar, unified error display; console output hint in results; help command updated with Console Output section.shell-runtimepackage extraction,@mongoshmain bundle removal (−47% main.js), wiredisplayBatchSizesetting, help text audit,PlaygroundDiagnosticsprovidershow dbs,use db,help,it,exit/quit; persistent eval context;CommandInterceptor; Ctrl+C cancellation; terminal links;WorkerSessionManagerrefactoring; legacylaunchShellremovalPost-Step 8 — UX Polish & Tree View Enhancements (direct pushes)
After merging Step 8 (Interactive Shell), the following UX improvements were pushed directly to the branch:
Inline action buttons in tree view — Added inline icon buttons to database and collection tree items across Connections, Discovery, and Azure views:
$(terminal) Open Interactive Shelland$(keyboard) New Query Playgroundinline buttons$(files) Open Collection,$(terminal) Open Interactive Shell, and$(keyboard) New Query Playgroundinline buttons$(terminal), collection open →$(files), playground →$(keyboard)Custom editor tab icons — Added dedicated SVG icons for webview editor tabs:
playground-light.svg/playground-dark.svg)Double-click to open Collection View — The
Documentstree item now requires a double-click to open the Collection View, preventing accidental tab opens on single-click browse. Implemented via a reusableregisterDoubleClickCommand()utility (500ms debounce window). Tooltip updated to hint at the double-click behavior.Published AI & dev documentation — Committed the full series of planning documents used during development (
docs/ai-and-plans/interactive-shell/anddocs/ai-and-plans/future-work/), covering the high-level plan, all step-level design docs, and future work proposals.Key Architecture Decisions
documentdb-querycustom language — JS Monarch tokenizer, no TS worker (~400-600 KB saved)CompletionItemProvider+ URI routing (documentdb://{editorType}/{sessionId})documentdb-constantsbundled at build time; field data pushed via tRPC subscriptionacorn.parseExpressionAt()for syntax errors;acorn-walk+documentdb-constantsfor identifier validationlanguage="json"with JSON Schema validationlanguage="documentdb-playground"referencing built-in JS grammar; in-process eval with@mongoshpackages reusing existingMongoClient@mongoshcontext,CommandInterceptorfor shell commands