Conversation
…user prompt options
… warning settings
When the terminal is resized, xterm.js reflows content but _lastCursorRow was not updated, causing reRenderLine() to navigate to the wrong prompt row. Reset it to 0 in setColumns().
Change .filter((l) => l.length > 0) to .filter((l) => l.trim().length > 0) so that whitespace-only lines are excluded. Previously, a paste like "db.test\n \n.find()" would produce a spurious double space.
mockPasteBehavior() now preserves documentDB.shell.display.colorOutput=false alongside documentDB.timeout, preventing brittleness if paste tests ever check rendered ANSI output.
- Remove inaccurate 'or Enter is pressed' from class doc comment - Add activeTextEditor guard to prevent leaveSnippet in wrong editor - Move jest.mock() before imports per repo convention - Add test for active editor document mismatch scenario
… statements
When a playground block starts with a bare direct command like 'use mydb'
followed by a query on the next line, only the 'use' is executed and the
query is silently discarded. This happens because the evaluation pipeline
detects 'use' as a special command token by splitting on all whitespace
(including newlines), consuming the entire multi-line input as arguments
to the 'use' handler.
Fix: normalize bare 'use <name>' and 'show <name>' into function-call
form ('use("name")' / 'show("name")') before evaluation when the
input contains multiple lines. The function-call form bypasses the
direct command short-circuit and lets the full block be evaluated
normally. Single-line inputs are left unchanged.
Bug Bash #1 — two additional fixes: 1. Playground error messages contained raw ANSI escape sequences (color codes, bold, reset) that rendered as visible control characters in the read-only output panel. Added stripAnsi() in resultFormatter.ts to remove SGR sequences before display. The interactive shell is unaffected (it renders ANSI codes via the PTY). 2. The cls/clear command in the interactive shell cleared the visible screen but left the scrollback buffer intact — users could scroll up to see previous output. Added the \x1b[3J (Erase Scrollback) escape sequence to match standard terminal behavior.
The documentDB.timeout setting controlled a setTimeout that killed the worker thread after 30s, ignoring user-specified .maxTimeMS() values. Changes: - Removed the documentDB.timeout setting entirely - Removed all IPC-level setTimeout logic for eval messages in WorkerSessionManager — the user cancels via Cancel button or Ctrl+C - Init timeout (documentDB.shell.initTimeout) is unchanged - MaxTimeMSExpired errors from the DocumentDB API are now detected in both playground and shell, with a tip to use .maxTimeMS()
The previous global regex rewrote any matching `use <name>` / `show <name>` line anywhere in the multi-line input, including text inside template literals, multi-line strings, and block comments. That changed program semantics for any block that happened to contain the pattern in a non-code region. Scope the rewrite to the first non-empty statement line only — that is the single observed failure mode (bare `use`/`show` as the first token of a multi-line block short-circuits the evaluator and silently drops the rest of the block). Addresses PR #592 review comment (discussion r3111470977).
`normalizeDirectCommands()` rewrote `use <name>` to `use("<name>")`
without a trailing semicolon. If the next line began with `[`, `(`,
`+`, `-`, or `/`, JavaScript's Automatic Semicolon Insertion would
fail to split the statements and parse them as a single expression
(e.g. `use("mydb")[1,2,3].forEach(...)` becomes member access on
the call result).
Always emit a trailing `;` in the rewrite so the next line is
guaranteed to start a fresh statement. Added a regression test.
Addresses PR #592 review comment (discussion r3111470941).
The `documentDB.timeout` setting was removed in the preceding commit but a few references lingered in JSDoc examples and in the shell terminal link-provider tests. Replace them with `documentDB.shell.initTimeout` (the remaining timeout-related setting) so the code and tests no longer reference a non-existent configuration key. No behavioral change. Addresses PR #592 review comment (discussion r3111470914).
`normalizeDirectCommands` is an internal helper applied automatically by `DocumentDBShellRuntime.evaluate()`. Re-exporting it from `@microsoft/documentdb-vscode-shell-runtime` expanded the public API surface for a test-oriented helper. The unit test already imports it directly from `./DocumentDBShellRuntime`, so the entrypoint export was unused by consumers and is safe to remove. Addresses PR #592 review comment (discussion r3111470833).
`sendRequest()` used a hardcoded `documentDB.shell.initTimeout` setting key in the `SettingsHintError` it raised on timeout. That made sense for the init call, but the shutdown path (5-second timeout, error is swallowed) would have produced a misleading hint had it ever surfaced, since `documentDB.shell.initTimeout` does not control shutdown. Parameterize the setting key. The init caller passes `documentDB.shell.initTimeout`; the shutdown caller omits it, which causes a plain `Error` to be thrown instead of a `SettingsHintError` with the wrong key. No user-facing behavior change today (shutdown swallows the error), but the class invariant is now consistent and robust to future callers.
The previous first-line-only heuristic was conservative but narrow:
a bare `use`/`show` on any subsequent line was still passed through
unchanged and would short-circuit the evaluator.
Switch to a tiny hand-written lexical scanner that tracks strings,
template literals (including `${...}` nesting), line/block comments,
and regex literals. Line starts that fall outside every one of those
contexts are candidates for rewriting, so a `use`/`show` anywhere
in the input is normalized while text inside quoted/escaped regions is
still left alone.
Zero new dependencies. A full JS parser (e.g. `acorn`) would be
needed to also disambiguate nested-block positions and declared-
identifier shadowing from statement starters, but those cases are not
observed in user input and adding a parser to a package intended to
ship standalone for CLI tooling is disproportionate.
Tests updated to assert the extended coverage (mid-block rewrites,
multiple top-level commands, strings/templates/comments/regex literals
left unchanged).
…splay.colorSupport` for consistency and clarity in configuration settings
# Conflicts: # l10n/bundle.l10n.json # package-lock.json # package.json
- Remove redundant result override in manageCredentials catch block (wrapper auto-sets result='Failed' on throw) - Convert boolean .toString() to explicit ternary pattern across survey.ts, CopyPasteCollectionTask.ts, clusterHelpers, extension.ts, FilterTenantSubStep.ts - Move numeric values from string properties to measurements: triggerActionScore, fullScore, pageNumber, tenantCountFromSubscriptions, receivedAuthMethodsCount
Co-authored-by: Copilot <copilot@github.com>
…ension Co-authored-by: Copilot <copilot@github.com>
Agent-Logs-Url: https://github.com/microsoft/vscode-documentdb/sessions/b41b25fe-d7b6-4752-b2ac-beaf87e748cf Co-authored-by: tnaum-ms <171359267+tnaum-ms@users.noreply.github.com>
…tings hint helper - Add startIndex/length assertions to all 4 underline-wrapped link tests to verify visual and interactive boundaries stay aligned (LOW-1) - Extract private writeSettingsHintLine() to deduplicate the settings hint formatting pattern in DocumentDBShellPty (INFO-1)
…shell, query playground, and insights
…ot with new hero screenshot
ShellGhostText.show() returns early when the same text is already visible, but trackCompletionGhostShown() and trackClosingBracketsShown() fired unconditionally after the call. This inflated shown counts. Changed show() to return a boolean indicating whether it rendered new content, and gate the telemetry calls on that return value.
applySingleCompletion() recorded acceptance telemetry before verifying the Tab press changed the buffer. Fully typed inputs (e.g., 'use' matching candidate 'use') produced empty remaining text but still incremented completion.accepted, inflating acceptance counts. Moved trackCompletionAccepted() to fire only after a successful insert or replace. Also removed candidateCount from shell.completionList accumulating telemetry — accumulating telemetry is designed to count how often events occur (shown/accepted), not to sum variable-length values like candidate list sizes.
All ghost text clear sites now use a single clearGhostState() method that resets _ghostText, _ghostTextIsHint, _ghostTextIsClosingBrackets, and _ghostCandidateKind together. Previously, several call sites only partially reset state fields, which was harmless but inconsistent and fragile for future additions.
The runtime node_modules stub install + TS server restart used to fail silently into outputChannel.debug. On read-only extension installs (Snap, system package, locked enterprise, some container setups) the stub install throws EACCES/EROFS and playground IntelliSense breaks with no signal to operators and no possibility to recover during the session. Changes: - Wrap ensureTsRestart in callWithTelemetryAndErrorHandling so failures are reported via the standard playground.tsPluginBootstrap event with result, error name, and errorMessage captured automatically. - Add a stage property (stubInstall, tsActivate, tsWait, tsRestart, complete) so we can tell which phase failed without parsing error messages. - Track stubCreated and tsExtensionFound for additional context. - Reset tsRestarted on failure so opening another playground retries the bootstrap instead of being stuck for the rest of the session. No additional logic change to the 2-second wait before typescript.restartTsServer; that magic delay is tracked separately for a future revisit (see follow-up issue).
Previously the worker reported the error to the main thread and stayed alive. mongoClient and shellRuntime could be in a corrupted state, so a subsequent eval might silently misbehave on the same connection. Now the worker schedules process.exit(1) after a short delay (to allow the IPC error message to flush). WorkerSessionManager already handles unexpected worker exits: it rejects pending requests with a meaningful error and emits worker.unexpectedExit telemetry. The next eval call on the same cluster will respawn a fresh worker via ensureWorker.
…-01) stubCreated=false was ambiguous: the stub may have already existed, or the stub-install branch may never have been reached (for example if an error fired before that block). Add an explicit stubExisted property so the combinations are unambiguous: stubCreated=true, stubExisted=false -> first-time install on this profile stubCreated=false, stubExisted=true -> stub already present, no work stubCreated=false, stubExisted=false -> bootstrap never reached the stub step Pure telemetry refinement; no behavior change.
The uncaughtException handler was updated to schedule process.exit(1) so the supervisor can respawn a clean worker (F-04). The companion unhandledRejection handler was left as log-only, which means a late promise rejection that escapes all eval-scoped catch blocks can leave the worker running with potentially the same kind of corrupted state F-04 set out to prevent. Apply the same treatment symmetrically: - If an eval is in flight, forward the rejection as an evalError so the user sees a meaningful failure instead of 'Worker exited unexpectedly'. - Log the message and stack. - Schedule process.exit(1) with the same 50 ms IPC-flush delay used by uncaughtException. WorkerSessionManager already handles the resulting unexpected exit and emits worker.unexpectedExit telemetry. Pushes us closer to the 'crash early, respawn fresh' invariant for the playground worker.
…xit on uncaught (#646)
sajeetharan
approved these changes
May 13, 2026
Contributor
✅ Code Quality Checks
This comment is updated automatically on each push. |
Contributor
📦 Build Size Report
Download artifact · updated automatically on each push. |
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.
0.8.0
New Features
.documentdb.jsfiles for writing and running JavaScript scripts against your cluster with CodeLens execution (per-block and Run All),console.log()/print()/printjson()support, per-file connections, and autocompletion fordb.*chains and schema fields. No external tools required: the runtime is bundled and works with Entra ID. #508, #573, #589show dbs,use <db>,help,it,exit), persistent eval context (variables carry over between commands), syntax highlighting, tab completion with ghost text,Ctrl+Ccancellation, and clickable result links. Bundled runtime, no external tools needed, works with Entra ID. #508, #573, #576, #580Improvements
@documentdb-jsscope for consistency. #613Fixes
Dependencies
fast-uri,fast-xml-builder,basic-ftp,path-to-regexp,fast-xml-parser, and@aws-sdk/xml-builder. #624, #606, #607, #609, #627, #628, #629