Theme-kind values plus a scriptable active-theme namespace.
Dispatches to a registered handler, and rejects for an unknown id.
setContext is the exception, and the only one. It is a VS Code built-in
that no extension registers, so rejecting it would be the mock lying
about the platform — and an extension mirroring a setting into a when
clause is a common enough shape that every one of them would have to work
around it. Other built-ins are left rejecting on purpose: they have
effects a mock cannot stand in for, and silently resolving undefined
would hide a test that never did what it claimed. The call is still
recorded, so mock.calls is how a test asserts the key was published.
Stable configuration target values; persistence is not emulated.
Stable language-status severities for adapter translation tests.
Numeric values needed by log-channel code; no filtering is performed.
Stable ProgressLocation values used to assert adapter mapping.
Quick-input button locations; rendering is outside the mock's scope.
Shared back-button identity used by quick-input navigation tests.
Quick-pick item kinds used in structural item fixtures.
Stable status-bar alignment values used by item factories.
Reveal modes for call-shape assertions; there is no viewport to reveal.
Stable checkbox values used by synthetic tree events.
Stable tree collapsibility values; no tree is rendered.
Host UI kind read by runtime preflight; no host is actually launched.
A plausible vscode.version baseline, pinned by the mock's tests. It is
fixture data—not a claim about the editor running the test. Assign the
exact version a scenario requires instead of branching on this default.
Editor-column values accepted by panel/editor call-shape tests. Columns have no layout behavior in this mock.
Dark by default. A plain mutable field, so a test can assign it
directly — use _setColorTheme instead when listeners registered
through onDidChangeActiveColorTheme also need to fire.
Returns a fresh createMockTextEditor fixture. When document
looks like a mock TextDocument (has getText), it's threaded through
so result.document is the same object the caller passed in, matching
the real API's identity guarantee.
Test hook: switches the active theme and notifies
onDidChangeActiveColorTheme listeners, as VS Code does when the user
picks a different theme.
Used by applyWorkspaceEdits/applyEditsGrouped (src/workspace/editor.ts).
Simplified: returns pathOrUri itself for a string, or .fsPath for a Uri.
Honors { language, content } options; otherwise an empty plaintext document.
Builds the documented partial replacement for the
vscodemodule: the value classes and namespaces exported below, with their focused semantics.Pass the result straight to
vi.mock's factory (or the Jest equivalent). Individual builders (createMockQuickPick,createMockFileSystemWatcher, ...) are also exported for tests that want a standalone fixture, e.g. to override a singlewindow.createTreeView()call with a listener-capturing instance.Unsupported API members are absent on purpose. Add a focused builder plus contract tests when this package begins to depend on another member; do not add a catch-all proxy returning no-op functions, because that lets misspelled and unsupported APIs pass tests silently.
Extension-authoring state that VS Code itself only lets the host set (
window.activeTextEditor,window.visibleTextEditors,workspace.workspaceFolders) is exposed as plain, directly-assignable fields here — a test setsvscode.window.activeTextEditor = myEditorinstead of recomposing the whole namespace.