mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-13 15:35:20 +01:00
Start enforcing the tunnels API (#163187)
* Start enforcing the tunnels API * Fix API test
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
"taskPresentationGroup",
|
||||
"terminalDataWriteEvent",
|
||||
"terminalDimensions",
|
||||
"tunnels",
|
||||
"envShellEvent",
|
||||
"testCoverage",
|
||||
"testObserver",
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
"license": "MIT",
|
||||
"enableProposedApi": true,
|
||||
"enabledApiProposals": [
|
||||
"resolvers"
|
||||
"resolvers",
|
||||
"tunnels"
|
||||
],
|
||||
"private": true,
|
||||
"engines": {
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
"include": [
|
||||
"src/**/*",
|
||||
"../../src/vscode-dts/vscode.d.ts",
|
||||
"../../src/vscode-dts/vscode.proposed.tunnels.d.ts",
|
||||
"../../src/vscode-dts/vscode.proposed.resolvers.d.ts"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1010,7 +1010,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
||||
return extHostFileSystemEvent.getOnWillRenameFileEvent(extension)(listener, thisArg, disposables);
|
||||
},
|
||||
openTunnel: (forward: vscode.TunnelOptions) => {
|
||||
checkProposedApiEnabled(extension, 'resolvers');
|
||||
checkProposedApiEnabled(extension, 'tunnels');
|
||||
return extHostTunnelService.openTunnel(extension, forward).then(value => {
|
||||
if (!value) {
|
||||
throw new Error('cannot open tunnel');
|
||||
@@ -1019,11 +1019,11 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
||||
});
|
||||
},
|
||||
get tunnels() {
|
||||
checkProposedApiEnabled(extension, 'resolvers');
|
||||
checkProposedApiEnabled(extension, 'tunnels');
|
||||
return extHostTunnelService.getTunnels();
|
||||
},
|
||||
onDidChangeTunnels: (listener, thisArg?, disposables?) => {
|
||||
checkProposedApiEnabled(extension, 'resolvers');
|
||||
checkProposedApiEnabled(extension, 'tunnels');
|
||||
return extHostTunnelService.onDidChangeTunnels(listener, thisArg, disposables);
|
||||
},
|
||||
registerPortAttributesProvider: (portSelector: { pid?: number; portRange?: [number, number]; commandMatcher?: RegExp }, provider: vscode.PortAttributesProvider) => {
|
||||
|
||||
+3
-26
@@ -43,7 +43,7 @@ declare module 'vscode' {
|
||||
label: string;
|
||||
}
|
||||
|
||||
export interface TunnelOptions {
|
||||
interface TunnelOptions {
|
||||
remoteAddress: { port: number; host: string };
|
||||
// The desired local port. If this port can't be used, then another will be chosen.
|
||||
localAddressPort?: number;
|
||||
@@ -56,7 +56,7 @@ declare module 'vscode' {
|
||||
protocol?: string;
|
||||
}
|
||||
|
||||
export interface TunnelDescription {
|
||||
interface TunnelDescription {
|
||||
remoteAddress: { port: number; host: string };
|
||||
//The complete local address(ex. localhost:1234)
|
||||
localAddress: { port: number; host: string } | string;
|
||||
@@ -69,7 +69,7 @@ declare module 'vscode' {
|
||||
protocol?: string;
|
||||
}
|
||||
|
||||
export interface Tunnel extends TunnelDescription {
|
||||
interface Tunnel extends TunnelDescription {
|
||||
// Implementers of Tunnel should fire onDidDispose when dispose is called.
|
||||
onDidDispose: Event<void>;
|
||||
dispose(): void | Thenable<void>;
|
||||
@@ -164,29 +164,6 @@ declare module 'vscode' {
|
||||
candidatePortSource?: CandidatePortSource;
|
||||
}
|
||||
|
||||
export namespace workspace {
|
||||
/**
|
||||
* Forwards a port. If the current resolver implements RemoteAuthorityResolver:forwardPort then that will be used to make the tunnel.
|
||||
* By default, openTunnel only support localhost; however, RemoteAuthorityResolver:tunnelFactory can be used to support other ips.
|
||||
*
|
||||
* @throws When run in an environment without a remote.
|
||||
*
|
||||
* @param tunnelOptions The `localPort` is a suggestion only. If that port is not available another will be chosen.
|
||||
*/
|
||||
export function openTunnel(tunnelOptions: TunnelOptions): Thenable<Tunnel>;
|
||||
|
||||
/**
|
||||
* Gets an array of the currently available tunnels. This does not include environment tunnels, only tunnels that have been created by the user.
|
||||
* Note that these are of type TunnelDescription and cannot be disposed.
|
||||
*/
|
||||
// export let tunnels: Thenable<TunnelDescription[]>;
|
||||
|
||||
/**
|
||||
* Fired when the list of tunnels has changed.
|
||||
*/
|
||||
export const onDidChangeTunnels: Event<void>;
|
||||
}
|
||||
|
||||
export interface ResourceLabelFormatter {
|
||||
scheme: string;
|
||||
authority?: string;
|
||||
|
||||
+9
-1
@@ -12,6 +12,10 @@ declare module 'vscode' {
|
||||
// The desired local port. If this port can't be used, then another will be chosen.
|
||||
localAddressPort?: number;
|
||||
label?: string;
|
||||
/**
|
||||
* @deprecated Use privacy instead
|
||||
*/
|
||||
public?: boolean;
|
||||
privacy?: string;
|
||||
protocol?: string;
|
||||
}
|
||||
@@ -20,6 +24,10 @@ declare module 'vscode' {
|
||||
remoteAddress: { port: number; host: string };
|
||||
//The complete local address(ex. localhost:1234)
|
||||
localAddress: { port: number; host: string } | string;
|
||||
/**
|
||||
* @deprecated Use privacy instead
|
||||
*/
|
||||
public?: boolean;
|
||||
privacy?: string;
|
||||
// If protocol is not provided it is assumed to be http, regardless of the localAddress.
|
||||
protocol?: string;
|
||||
@@ -51,6 +59,6 @@ declare module 'vscode' {
|
||||
/**
|
||||
* Fired when the list of tunnels has changed.
|
||||
*/
|
||||
// export const onDidChangeTunnels: Event<void>;
|
||||
export const onDidChangeTunnels: Event<void>;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user