Namespace describing the environment the editor runs in.
Namespace describing the environment the editor runs in.
(app-host)
The hosted location of the application On desktop this is 'desktop' In the web this is the specified embedder i.e. 'github.dev', 'codespaces', or 'web' if the embedder does not provide that information
Returns: string
The hosted location of the application On desktop this is 'desktop' In the web this is the specified embedder i.e. 'github.dev', 'codespaces', or 'web' if the embedder does not provide that information **Returns:** `string`
(app-name)
The application name of the editor, like 'VS Code'.
Returns: string
The application name of the editor, like 'VS Code'. **Returns:** `string`
(app-root)
The application root folder from which the editor is running.
Note that the value is the empty string when running in an environment that has no representation of an application root folder.
Returns: string
The application root folder from which the editor is running. *Note* that the value is the empty string when running in an environment that has no representation of an application root folder. **Returns:** `string`
(as-external-uri target)
Resolves a uri to a form that is accessible externally.
http:
or https:
schemeResolves an external uri, such as a http:
or https:
link, from where the extension is running to a
uri to the same resource on the client machine.
This is a no-op if the extension is running on the client machine.
If the extension is running remotely, this function automatically establishes a port forwarding tunnel
from the local machine to target
on the remote and returns a local uri to the tunnel. The lifetime of
the port forwarding tunnel is managed by the editor and the tunnel can be closed by the user.
Note that uris passed through openExternal
are automatically resolved and you should not call asExternalUri
on them.
vscode.env.uriScheme
Creates a uri that - if opened in a browser (e.g. via openExternal
) - will result in a registered {@link UriHandler }
to trigger.
Extensions should not make any assumptions about the resulting uri and should not alter it in any way. Rather, extensions can e.g. use this uri in an authentication flow, by adding the uri as callback query argument to the server to authenticate to.
Note that if the server decides to add additional query parameters to the uri (e.g. a token or secret), it will appear in the uri that is passed to the {@link UriHandler }.
Example of an authentication flow:
vscode.window.registerUriHandler({
handleUri(uri: vscode.Uri): vscode.ProviderResult<void> {
if (uri.path === '/did-authenticate') {
console.log(uri.toString());
}
}
});
const callableUri = await vscode.env.asExternalUri(vscode.Uri.parse(vscode.env.uriScheme + '://my.extension/did-authenticate'));
await vscode.env.openExternal(callableUri);
Note that extensions should not cache the result of asExternalUri
as the resolved uri may become invalid due to
a system or user action — for example, in remote cases, a user may close a port forwarding tunnel that was opened by
asExternalUri
.
Any other scheme will be handled as if the provided URI is a workspace URI. In that case, the method will return a URI which, when handled, will make the editor open the workspace.
Parameters:
target
: Uri
Returns: Thenable<Uri>
- A uri that can be used on the client machine.
Resolves a uri to a form that is accessible externally. #### `http:` or `https:` scheme Resolves an *external* uri, such as a `http:` or `https:` link, from where the extension is running to a uri to the same resource on the client machine. This is a no-op if the extension is running on the client machine. If the extension is running remotely, this function automatically establishes a port forwarding tunnel from the local machine to `target` on the remote and returns a local uri to the tunnel. The lifetime of the port forwarding tunnel is managed by the editor and the tunnel can be closed by the user. *Note* that uris passed through `openExternal` are automatically resolved and you should not call `asExternalUri` on them. #### `vscode.env.uriScheme` Creates a uri that - if opened in a browser (e.g. via `openExternal`) - will result in a registered {@link UriHandler } to trigger. Extensions should not make any assumptions about the resulting uri and should not alter it in any way. Rather, extensions can e.g. use this uri in an authentication flow, by adding the uri as callback query argument to the server to authenticate to. *Note* that if the server decides to add additional query parameters to the uri (e.g. a token or secret), it will appear in the uri that is passed to the {@link UriHandler }. **Example** of an authentication flow: ```typescript vscode.window.registerUriHandler({ handleUri(uri: vscode.Uri): vscode.ProviderResult<void> { if (uri.path === '/did-authenticate') { console.log(uri.toString()); } } }); const callableUri = await vscode.env.asExternalUri(vscode.Uri.parse(vscode.env.uriScheme + '://my.extension/did-authenticate')); await vscode.env.openExternal(callableUri); ``` *Note* that extensions should not cache the result of `asExternalUri` as the resolved uri may become invalid due to a system or user action — for example, in remote cases, a user may close a port forwarding tunnel that was opened by `asExternalUri`. #### Any other scheme Any other scheme will be handled as if the provided URI is a workspace URI. In that case, the method will return a URI which, when handled, will make the editor open the workspace. **Parameters:** - `target`: `Uri` **Returns:** `Thenable<Uri>` - A uri that can be used on the client machine.
(clipboard)
The system clipboard.
Returns: Clipboard
The system clipboard. **Returns:** `Clipboard`
(create-telemetry-logger sender)
(create-telemetry-logger sender options)
Creates a new {@link TelemetryLogger telemetry logger}.
Parameters:
sender
: TelemetrySender
- The telemetry sender that is used by the telemetry logger.options
: TelemetryLoggerOptions | undefined
- Options for the telemetry logger.Returns: TelemetryLogger
- A new telemetry logger
Creates a new {@link TelemetryLogger telemetry logger}. **Parameters:** - `sender`: `TelemetrySender` - The telemetry sender that is used by the telemetry logger. - `options`: `TelemetryLoggerOptions | undefined` - Options for the telemetry logger. **Returns:** `TelemetryLogger` - A new telemetry logger
(language)
Represents the preferred user-language, like de-CH
, fr
, or en-US
.
Returns: string
Represents the preferred user-language, like `de-CH`, `fr`, or `en-US`. **Returns:** `string`
(log-level)
The current log level of the editor.
Returns: LogLevel
The current log level of the editor. **Returns:** `LogLevel`
(machine-id)
A unique identifier for the computer.
Returns: string
A unique identifier for the computer. **Returns:** `string`
(new-app-install?)
Indicates that this is a fresh install of the application.
true
if within the first day of installation otherwise false
.
Returns: boolean
Indicates that this is a fresh install of the application. `true` if within the first day of installation otherwise `false`. **Returns:** `boolean`
(on-did-change-log-level)
(on-did-change-log-level listener)
(on-did-change-log-level listener this-args)
(on-did-change-log-level listener this-args disposables)
An {@link Event } which fires when the log level of the editor changes.
Parameters:
listener
: (e: T) => any
- The listener function will be called when the event happens.this-args
: any
- The this
-argument which will be used when calling the event listener.disposables
: Disposable[] | undefined
- An array to which a {@link Disposable } will be added.Returns: Disposable
- A disposable which unsubscribes the event listener.
An {@link Event } which fires when the log level of the editor changes. **Parameters:** - `listener`: `(e: T) => any` - The listener function will be called when the event happens. - `this-args`: `any` - The `this`-argument which will be used when calling the event listener. - `disposables`: `Disposable[] | undefined` - An array to which a {@link Disposable } will be added. **Returns:** `Disposable` - A disposable which unsubscribes the event listener.
(on-did-change-shell)
(on-did-change-shell listener)
(on-did-change-shell listener this-args)
(on-did-change-shell listener this-args disposables)
An {@link Event } which fires when the default shell changes. This fires with the new shell path.
Parameters:
listener
: (e: T) => any
- The listener function will be called when the event happens.this-args
: any
- The this
-argument which will be used when calling the event listener.disposables
: Disposable[] | undefined
- An array to which a {@link Disposable } will be added.Returns: Disposable
- A disposable which unsubscribes the event listener.
An {@link Event } which fires when the default shell changes. This fires with the new shell path. **Parameters:** - `listener`: `(e: T) => any` - The listener function will be called when the event happens. - `this-args`: `any` - The `this`-argument which will be used when calling the event listener. - `disposables`: `Disposable[] | undefined` - An array to which a {@link Disposable } will be added. **Returns:** `Disposable` - A disposable which unsubscribes the event listener.
(on-did-change-telemetry-enabled)
(on-did-change-telemetry-enabled listener)
(on-did-change-telemetry-enabled listener this-args)
(on-did-change-telemetry-enabled listener this-args disposables)
An {@link Event } which fires when the user enabled or disables telemetry.
true
if the user has enabled telemetry or false
if the user has disabled telemetry.
Parameters:
listener
: (e: T) => any
- The listener function will be called when the event happens.this-args
: any
- The this
-argument which will be used when calling the event listener.disposables
: Disposable[] | undefined
- An array to which a {@link Disposable } will be added.Returns: Disposable
- A disposable which unsubscribes the event listener.
An {@link Event } which fires when the user enabled or disables telemetry. `true` if the user has enabled telemetry or `false` if the user has disabled telemetry. **Parameters:** - `listener`: `(e: T) => any` - The listener function will be called when the event happens. - `this-args`: `any` - The `this`-argument which will be used when calling the event listener. - `disposables`: `Disposable[] | undefined` - An array to which a {@link Disposable } will be added. **Returns:** `Disposable` - A disposable which unsubscribes the event listener.
(open-external target)
Opens a link externally using the default application. Depending on the used scheme this can be:
http:
, https:
)mailto:
)vscode:
from vscode.env.uriScheme
)Note that {@linkcode window.showTextDocument showTextDocument} is the right way to open a text document inside the editor, not this function.
Parameters:
target
: Uri
- The uri that should be opened.Returns: Thenable<boolean>
- A promise indicating if open was successful.
Opens a link externally using the default application. Depending on the used scheme this can be: * a browser (`http:`, `https:`) * a mail client (`mailto:`) * VSCode itself (`vscode:` from `vscode.env.uriScheme`) *Note* that {@linkcode window.showTextDocument showTextDocument} is the right way to open a text document inside the editor, not this function. **Parameters:** - `target`: `Uri` - The uri that should be opened. **Returns:** `Thenable<boolean>` - A promise indicating if open was successful.
(remote-name)
The name of a remote. Defined by extensions, popular samples are wsl
for the Windows
Subsystem for Linux or ssh-remote
for remotes using a secure shell.
Note that the value is undefined
when there is no remote extension host but that the
value is defined in all extension hosts (local and remote) in case a remote extension host
exists. Use {@link Extension.extensionKind } to know if
a specific extension runs remote or not.
Returns: string | undefined
The name of a remote. Defined by extensions, popular samples are `wsl` for the Windows Subsystem for Linux or `ssh-remote` for remotes using a secure shell. *Note* that the value is `undefined` when there is no remote extension host but that the value is defined in all extension hosts (local and remote) in case a remote extension host exists. Use {@link Extension.extensionKind } to know if a specific extension runs remote or not. **Returns:** `string | undefined`
(session-id)
A unique identifier for the current session. Changes each time the editor is started.
Returns: string
A unique identifier for the current session. Changes each time the editor is started. **Returns:** `string`
(shell)
The detected default shell for the extension host, this is overridden by the
terminal.integrated.defaultProfile
setting for the extension host's platform. Note that in
environments that do not support a shell the value is the empty string.
Returns: string
The detected default shell for the extension host, this is overridden by the `terminal.integrated.defaultProfile` setting for the extension host's platform. Note that in environments that do not support a shell the value is the empty string. **Returns:** `string`
(telemetry-enabled?)
Indicates whether the users has telemetry enabled. Can be observed to determine if the extension should send telemetry.
Returns: boolean
Indicates whether the users has telemetry enabled. Can be observed to determine if the extension should send telemetry. **Returns:** `boolean`
(ui-kind)
The UI kind property indicates from which UI extensions are accessed from. For example, extensions could be accessed from a desktop application or a web browser.
Returns: UIKind
The UI kind property indicates from which UI extensions are accessed from. For example, extensions could be accessed from a desktop application or a web browser. **Returns:** `UIKind`
(uri-scheme)
The custom uri scheme the editor registers to in the operating system.
Returns: string
The custom uri scheme the editor registers to in the operating system. **Returns:** `string`
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close