Add an "always" options to port source setting

Fixes microsoft/vscode-remote-release#4923
This commit is contained in:
Alex Ross 2021-05-06 15:04:06 +02:00
parent 233a3bd736
commit 46a2b70583
No known key found for this signature in database
GPG key ID: 89DDDBA66CBA7840
3 changed files with 10 additions and 6 deletions

View file

@ -7,7 +7,7 @@ import * as nls from 'vs/nls';
import { MainThreadTunnelServiceShape, IExtHostContext, MainContext, ExtHostContext, ExtHostTunnelServiceShape, CandidatePortSource, PortAttributesProviderSelector } from 'vs/workbench/api/common/extHost.protocol';
import { TunnelDto } from 'vs/workbench/api/common/extHostTunnelService';
import { extHostNamedCustomer } from 'vs/workbench/api/common/extHostCustomers';
import { CandidatePort, IRemoteExplorerService, makeAddress, PORT_AUTO_FORWARD_SETTING, PORT_AUTO_SOURCE_SETTING, PORT_AUTO_SOURCE_SETTING_OUTPUT, PORT_AUTO_SOURCE_SETTING_PROCESS } from 'vs/workbench/services/remote/common/remoteExplorerService';
import { CandidatePort, IRemoteExplorerService, makeAddress, PORT_AUTO_FORWARD_SETTING, PORT_AUTO_SOURCE_SETTING, PORT_AUTO_SOURCE_SETTING_OUTPUT, PORT_AUTO_SOURCE_SETTING_PROCESS, PORT_AUTO_SOURCE_SETTING_PROCESS_ALWAYS } from 'vs/workbench/services/remote/common/remoteExplorerService';
import { ITunnelProvider, ITunnelService, TunnelCreationOptions, TunnelProviderFeatures, TunnelOptions, RemoteTunnel, isPortPrivileged, ProvidedPortAttributes, PortAttributesProvider } from 'vs/platform/remote/common/tunnel';
import { Disposable } from 'vs/base/common/lifecycle';
import type { TunnelDescription } from 'vs/platform/remote/common/remoteAuthorityResolver';
@ -41,7 +41,9 @@ export class MainThreadTunnelService extends Disposable implements MainThreadTun
}
private processFindingEnabled(): boolean {
return (!!this.configurationService.getValue(PORT_AUTO_FORWARD_SETTING)) && (this.configurationService.getValue(PORT_AUTO_SOURCE_SETTING) === PORT_AUTO_SOURCE_SETTING_PROCESS);
const source = this.configurationService.getValue(PORT_AUTO_SOURCE_SETTING);
return (!!this.configurationService.getValue(PORT_AUTO_FORWARD_SETTING)) && (source === PORT_AUTO_SOURCE_SETTING_PROCESS)
|| (source === PORT_AUTO_SOURCE_SETTING_PROCESS_ALWAYS);
}
async $setRemoteTunnelService(processId: number): Promise<void> {

View file

@ -138,11 +138,12 @@ Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration)
},
'remote.autoForwardPortsSource': {
type: 'string',
markdownDescription: localize('remote.autoForwardPortsSource', "Sets the source from which ports are automatically forwarded when `remote.autoForwardPorts` is true. On Windows and Mac remotes, the `process` option has no effect and `output` will be used. Requires a reload to take effect."),
enum: ['process', 'output'],
markdownDescription: localize('remote.autoForwardPortsSource', "Sets the source from which ports information is found. On Windows and Mac remotes, the `process` options have no effect and `output` will be used. Requires a reload to take effect."),
enum: ['process', 'output', 'processAlways'],
enumDescriptions: [
localize('remote.autoForwardPortsSource.process', "Ports will be automatically forwarded when discovered by watching for processes that are started and include a port."),
localize('remote.autoForwardPortsSource.output', "Ports will be automatically forwarded when discovered by reading terminal and debug output. Not all processes that use ports will print to the integrated terminal or debug console, so some ports will be missed. Ports forwarded based on output will not be \"un-forwarded\" until reload or until the port is closed by the user in the Ports view.")
localize('remote.autoForwardPortsSource.process', "When `remote.autoForwardPorts` is `true`, port information will be discovered by watching for processes that are started and include a port."),
localize('remote.autoForwardPortsSource.output', "When `remote.autoForwardPorts` is `true`, port information will be discovered by reading terminal and debug output. Not all processes that use ports will print to the integrated terminal or debug console, so some ports will be missed. Ports forwarded based on output will not be \"un-forwarded\" until reload or until the port is closed by the user in the Ports view."),
localize('remote.autoForwardPortsSource.processAlways', "Port information will always be discovered by watching for processes that are started and include a port, regardless of any other setting value.")
],
default: 'process'
},

View file

@ -30,6 +30,7 @@ export const TUNNEL_VIEW_CONTAINER_ID = '~remote.forwardedPortsContainer';
export const PORT_AUTO_FORWARD_SETTING = 'remote.autoForwardPorts';
export const PORT_AUTO_SOURCE_SETTING = 'remote.autoForwardPortsSource';
export const PORT_AUTO_SOURCE_SETTING_PROCESS = 'process';
export const PORT_AUTO_SOURCE_SETTING_PROCESS_ALWAYS = 'processAlways';
export const PORT_AUTO_SOURCE_SETTING_OUTPUT = 'output';
export enum TunnelType {