Allow extensions to set hybrid port source (#211696)

Part of #211647
This commit is contained in:
Alex Ross
2024-04-30 15:23:13 +02:00
committed by GitHub
parent 0d9da1e50e
commit 4a37deeeba
3 changed files with 10 additions and 3 deletions

View File

@@ -7,7 +7,7 @@ import * as nls from 'vs/nls';
import { MainThreadTunnelServiceShape, MainContext, ExtHostContext, ExtHostTunnelServiceShape, CandidatePortSource, PortAttributesSelector, TunnelDto } from 'vs/workbench/api/common/extHost.protocol';
import { TunnelDtoConverter } from 'vs/workbench/api/common/extHostTunnelService';
import { extHostNamedCustomer, IExtHostContext } from 'vs/workbench/services/extensions/common/extHostCustomers';
import { IRemoteExplorerService, PORT_AUTO_FORWARD_SETTING, PORT_AUTO_SOURCE_SETTING, PORT_AUTO_SOURCE_SETTING_OUTPUT } from 'vs/workbench/services/remote/common/remoteExplorerService';
import { IRemoteExplorerService, PORT_AUTO_FORWARD_SETTING, PORT_AUTO_SOURCE_SETTING, PORT_AUTO_SOURCE_SETTING_HYBRID, PORT_AUTO_SOURCE_SETTING_OUTPUT } from 'vs/workbench/services/remote/common/remoteExplorerService';
import { ITunnelProvider, ITunnelService, TunnelCreationOptions, TunnelProviderFeatures, TunnelOptions, RemoteTunnel, ProvidedPortAttributes, PortAttributesProvider, TunnelProtocol } from 'vs/platform/tunnel/common/tunnel';
import { Disposable } from 'vs/base/common/lifecycle';
import type { TunnelDescription } from 'vs/platform/remote/common/remoteAuthorityResolver';
@@ -223,6 +223,11 @@ export class MainThreadTunnelService extends Disposable implements MainThreadTun
.registerDefaultConfigurations([{ overrides: { 'remote.autoForwardPortsSource': PORT_AUTO_SOURCE_SETTING_OUTPUT } }]);
break;
}
case CandidatePortSource.Hybrid: {
Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration)
.registerDefaultConfigurations([{ overrides: { 'remote.autoForwardPortsSource': PORT_AUTO_SOURCE_SETTING_HYBRID } }]);
break;
}
default: // Do nothing, the defaults for these settings should be used.
}
}).catch(() => {

View File

@@ -1598,7 +1598,8 @@ export interface MainThreadWindowShape extends IDisposable {
export enum CandidatePortSource {
None = 0,
Process = 1,
Output = 2
Output = 2,
Hybrid = 3
}
export interface PortAttributesSelector {

View File

@@ -141,7 +141,8 @@ declare module 'vscode' {
export enum CandidatePortSource {
None = 0,
Process = 1,
Output = 2
Output = 2,
Hybrid = 3
}
export type ResolverResult = (ResolvedAuthority | ManagedResolvedAuthority) & ResolvedOptions & TunnelInformation;