mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 13:46:13 +00:00
refine remoteAuthority-api, #74188
This commit is contained in:
parent
8c35807271
commit
a429fd1356
18
src/vs/vscode.d.ts
vendored
18
src/vs/vscode.d.ts
vendored
|
@ -6042,15 +6042,19 @@ declare module 'vscode' {
|
|||
export function openExternal(target: Uri): Thenable<boolean>;
|
||||
|
||||
/**
|
||||
* The [authority](#Uri.authority)-component. When `undefined`, extensions are
|
||||
* executed in the same context (e.g. operating system or machine) in which the UI
|
||||
* of the editor is executed. If defined, extensions are running in a different
|
||||
* context, for instance a remote machine.
|
||||
* Information about running remotely. When `undefined`, extensions are executed in the same
|
||||
* context (e.g. operating system or machine) in which the UI of the editor is executed.
|
||||
* If defined, extensions are running in a different context, for instance a remote machine.
|
||||
*
|
||||
* *Note* that no assumptions about the actual value should be made as it is defined
|
||||
* by extensions and not by the editor.
|
||||
* A remote [uri](#Uri) adheres to this format: `remote_scheme://auth_prefix+auth_rest/path` where
|
||||
* the `remote_scheme` is defined by the editor, `auth_prefix` and `auth_rest` are defined by extensions,
|
||||
* and `path` is defined by the user.
|
||||
*
|
||||
* Extensions contributing a remote are encouraged to use a stable `auth_prefix`-value,
|
||||
* e.g `remote_scheme://ssh+23/` and `remote_scheme://ssh+42`. Such prefix is exposed
|
||||
* in the `prefix`-property of the returned object.
|
||||
*/
|
||||
export const remoteAuthority: string | undefined;
|
||||
export const remoteAuthority: { prefix: string } | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -236,7 +236,7 @@ export function createApiFactory(
|
|||
};
|
||||
|
||||
// namespace: env
|
||||
const env: typeof vscode.env = Object.freeze({
|
||||
const env: typeof vscode.env = Object.freeze<typeof vscode.env>({
|
||||
get machineId() { return initData.telemetryInfo.machineId; },
|
||||
get sessionId() { return initData.telemetryInfo.sessionId; },
|
||||
get language() { return initData.environment.appLanguage; },
|
||||
|
@ -257,7 +257,21 @@ export function createApiFactory(
|
|||
openExternal(uri: URI) {
|
||||
return extHostWindow.openUri(uri, { allowTunneling: !!initData.remoteAuthority });
|
||||
},
|
||||
get remoteAuthority() { return initData.remoteAuthority || undefined; }
|
||||
get remoteAuthority() {
|
||||
const { remoteAuthority } = initData;
|
||||
if (!remoteAuthority) {
|
||||
return undefined;
|
||||
}
|
||||
const idx = remoteAuthority.indexOf('+');
|
||||
if (idx < 0) {
|
||||
console.warn(`INVALID remote authority: ${remoteAuthority}`);
|
||||
return undefined;
|
||||
}
|
||||
return {
|
||||
prefix: remoteAuthority.substring(0, idx),
|
||||
toString() { return remoteAuthority; } // compatiblity
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// namespace: extensions
|
||||
|
|
Loading…
Reference in a new issue