Skip to content

Release 0.8.0#634

Merged
tnaum-ms merged 725 commits into
mainfrom
next
May 13, 2026
Merged

Release 0.8.0#634
tnaum-ms merged 725 commits into
mainfrom
next

Conversation

@tnaum-ms
Copy link
Copy Markdown
Collaborator

@tnaum-ms tnaum-ms commented May 12, 2026

0.8.0

New Features

  • Context-Aware Autocompletion in Collection View: The filter, project, sort, and aggregation editors now provide schema-aware field suggestions, type-aware operator ordering, hover documentation, real-time syntax validation, and relaxed query syntax (unquoted keys, BSON constructors, JavaScript expressions). #508, #506, #513, #518
  • Query Playground: Introduces .documentdb.js files 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 for db.* chains and schema fields. No external tools required: the runtime is bundled and works with Entra ID. #508, #573, #589
  • Interactive Shell: A full REPL terminal in VS Code with shell commands (show dbs, use <db>, help, it, exit), persistent eval context (variables carry over between commands), syntax highlighting, tab completion with ghost text, Ctrl+C cancellation, and clickable result links. Bundled runtime, no external tools needed, works with Entra ID. #508, #573, #576, #580
  • Cross-Feature Navigation: Collection View, Query Playground, and Interactive Shell are linked with toolbar buttons, CodeLens actions, clickable terminal links, and clipboard copy/paste for seamless query movement between surfaces. #589
  • About Dialog: Adds an "About" entry to the Help & Feedback view with extension version, VS Code version, OS details, and registered plugins, plus a Copy button for bug reporting. #612

Improvements

  • Query Insights: Static Analysis: Improved performance evaluation with selectivity and fetch overhead metrics, three-color badge system, index strategy advisories, and edge case fixes. AI analysis now aligns with static analysis to avoid contradictions. Demoted score for single-field bitmap indexes on high-selectivity queries. #615, #616, #623
  • Double-Click to Open Collection View: The Documents tree item now requires a double-click to open the Collection View, preventing tabs from opening accidentally on single-click browse.
  • Custom Editor Tab Icons: Collection View, Document View, and Query Playground tabs now display dedicated icons instead of the default webview icon.
  • Telemetry: Simplified and standardized telemetry instrumentation across connection, discovery, shell, and playground features. #601, #544, #599
  • Internal Package Rename: Renamed internal packages to @documentdb-js scope for consistency. #613
  • Prerelease Version Migration: Implemented migration for prerelease version handling in notifications. #610

Fixes

  • Duplicate Connection Reveal: Fixed an issue where revealing a duplicate connection failed when the connection was inside a folder. #602

Dependencies

  • Dependency Updates: Updated 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

tnaum-ms and others added 30 commits April 17, 2026 12:15
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>
tnaum-ms and others added 13 commits May 12, 2026 13:20
…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)
Copilot AI review requested due to automatic review settings May 12, 2026 15:43
@tnaum-ms tnaum-ms requested a review from a team as a code owner May 12, 2026 15:43
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

tnaum-ms added 10 commits May 12, 2026 22:40
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.
@github-actions
Copy link
Copy Markdown
Contributor

✅ Code Quality Checks

Check Status How to fix
Localization (l10n) ✅ Passed
ESLint ✅ Passed
Prettier formatting ✅ Passed

This comment is updated automatically on each push.

@github-actions
Copy link
Copy Markdown
Contributor

📦 Build Size Report

Metric Size
VSIX (vscode-documentdb-0.8.0.vsix) 7.51 MB
Webview bundle (views.js) 5.79 MB

⚠️ No baseline cached for main yet — delta will appear after the next push to that branch.

Download artifact · updated automatically on each push.

@tnaum-ms tnaum-ms merged commit 63ba00f into main May 13, 2026
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants