Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/vscode.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Ross <alros@microsoft.com>2020-05-28 11:04:12 +0300
committerGitHub <noreply@github.com>2020-05-28 11:04:12 +0300
commit1d268b701376470bc638100fbe17d283404ac559 (patch)
tree31c23f0094e0d5924d59aa9c5d0f7a2d41131df3
parent1ca5155a29be48b721156780b82681ca1c35d17b (diff)
showCandidate should have a better name (#98566)
Fixes microsoft/vscode-internalbacklog#995
-rw-r--r--src/vs/workbench/contrib/remote/common/showCandidate.ts5
-rw-r--r--src/vs/workbench/contrib/remote/common/tunnelFactory.ts5
-rw-r--r--src/vs/workbench/workbench.web.api.ts22
3 files changed, 21 insertions, 11 deletions
diff --git a/src/vs/workbench/contrib/remote/common/showCandidate.ts b/src/vs/workbench/contrib/remote/common/showCandidate.ts
index 7ab26b73803..6fa5f01943c 100644
--- a/src/vs/workbench/contrib/remote/common/showCandidate.ts
+++ b/src/vs/workbench/contrib/remote/common/showCandidate.ts
@@ -14,9 +14,10 @@ export class ShowCandidateContribution extends Disposable implements IWorkbenchC
@IWorkbenchEnvironmentService workbenchEnvironmentService: IWorkbenchEnvironmentService,
) {
super();
- if (workbenchEnvironmentService.options && workbenchEnvironmentService.options.showCandidate) {
+ const showPortCandidate = workbenchEnvironmentService.options?.tunnelProvider?.showPortCandidate;
+ if (showPortCandidate) {
this._register(remoteExplorerService.setCandidateFilter(async (candidates: { host: string, port: number, detail: string }[]): Promise<{ host: string, port: number, detail: string }[]> => {
- const filters: boolean[] = await Promise.all(candidates.map(candidate => workbenchEnvironmentService.options!.showCandidate!(candidate.host, candidate.port, candidate.detail)));
+ const filters: boolean[] = await Promise.all(candidates.map(candidate => showPortCandidate(candidate.host, candidate.port, candidate.detail)));
const filteredCandidates: { host: string, port: number, detail: string }[] = [];
if (filters.length !== candidates.length) {
return candidates;
diff --git a/src/vs/workbench/contrib/remote/common/tunnelFactory.ts b/src/vs/workbench/contrib/remote/common/tunnelFactory.ts
index 9414ee117d4..2562cb661fe 100644
--- a/src/vs/workbench/contrib/remote/common/tunnelFactory.ts
+++ b/src/vs/workbench/contrib/remote/common/tunnelFactory.ts
@@ -14,10 +14,11 @@ export class TunnelFactoryContribution extends Disposable implements IWorkbenchC
@IWorkbenchEnvironmentService workbenchEnvironmentService: IWorkbenchEnvironmentService,
) {
super();
- if (workbenchEnvironmentService.options && workbenchEnvironmentService.options.tunnelFactory) {
+ const tunnelFactory = workbenchEnvironmentService.options?.tunnelProvider?.tunnelFactory;
+ if (tunnelFactory) {
this._register(tunnelService.setTunnelProvider({
forwardPort: (tunnelOptions: TunnelOptions): Promise<RemoteTunnel> | undefined => {
- const tunnelPromise = workbenchEnvironmentService.options!.tunnelFactory!(tunnelOptions);
+ const tunnelPromise = tunnelFactory(tunnelOptions);
if (!tunnelPromise) {
return undefined;
}
diff --git a/src/vs/workbench/workbench.web.api.ts b/src/vs/workbench/workbench.web.api.ts
index f72791f8d57..74b7f7f8080 100644
--- a/src/vs/workbench/workbench.web.api.ts
+++ b/src/vs/workbench/workbench.web.api.ts
@@ -35,6 +35,17 @@ interface IExternalUriResolver {
(uri: URI): Promise<URI>;
}
+interface ITunnelProvider {
+ /**
+ * Support for creating tunnels.
+ */
+ tunnelFactory?: ITunnelFactory;
+ /**
+ * Support for filtering candidate ports
+ */
+ showPortCandidate?: IShowPortCandidate;
+}
+
interface ITunnelFactory {
(tunnelOptions: ITunnelOptions): Promise<ITunnel> | undefined;
}
@@ -198,14 +209,10 @@ interface IWorkbenchConstructionOptions {
readonly resolveExternalUri?: IExternalUriResolver;
/**
- * Support for creating tunnels.
- */
- readonly tunnelFactory?: ITunnelFactory;
-
- /**
- * Support for filtering candidate ports
+ * A provider for supplying tunneling functionality,
+ * such as creating tunnels and showing candidate ports to forward.
*/
- readonly showCandidate?: IShowPortCandidate;
+ readonly tunnelProvider?: ITunnelProvider;
//#endregion
@@ -410,6 +417,7 @@ export {
IExternalUriResolver,
// Tunnel
+ ITunnelProvider,
ITunnelFactory,
ITunnel,
ITunnelOptions,