mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 21:09:43 +00:00
parent
eb42d4389b
commit
63e1edc203
|
@ -31,6 +31,7 @@
|
|||
"enum": [
|
||||
"notify",
|
||||
"openBrowser",
|
||||
"openBrowserOnce",
|
||||
"openPreview",
|
||||
"silent",
|
||||
"ignore"
|
||||
|
@ -38,6 +39,7 @@
|
|||
"enumDescriptions": [
|
||||
"Shows a notification when a port is automatically forwarded.",
|
||||
"Opens the browser when the port is automatically forwarded. Depending on your settings, this could open an embedded browser.",
|
||||
"Opens the browser when the port is automatically forwarded, but only the first time the port is forward during a session. Depending on your settings, this could open an embedded browser.",
|
||||
"Opens a preview in the same window when the port is automatically forwarded.",
|
||||
"Shows no notification and takes no action when this port is automatically forwarded.",
|
||||
"This port will not be automatically forwarded."
|
||||
|
|
|
@ -139,6 +139,7 @@
|
|||
"enum": [
|
||||
"notify",
|
||||
"openBrowser",
|
||||
"openBrowserOnce",
|
||||
"openPreview",
|
||||
"silent",
|
||||
"ignore"
|
||||
|
@ -146,6 +147,7 @@
|
|||
"enumDescriptions": [
|
||||
"Shows a notification when a port is automatically forwarded.",
|
||||
"Opens the browser when the port is automatically forwarded. Depending on your settings, this could open an embedded browser.",
|
||||
"Opens the browser when the port is automatically forwarded, but only the first time the port is forward during a session. Depending on your settings, this could open an embedded browser.",
|
||||
"Opens a preview in the same window when the port is automatically forwarded.",
|
||||
"Shows no notification and takes no action when this port is automatically forwarded.",
|
||||
"This port will not be automatically forwarded."
|
||||
|
@ -518,6 +520,7 @@
|
|||
"enum": [
|
||||
"notify",
|
||||
"openBrowser",
|
||||
"openBrowserOnce",
|
||||
"openPreview",
|
||||
"silent",
|
||||
"ignore"
|
||||
|
@ -525,6 +528,7 @@
|
|||
"enumDescriptions": [
|
||||
"Shows a notification when a port is automatically forwarded.",
|
||||
"Opens the browser when the port is automatically forwarded. Depending on your settings, this could open an embedded browser.",
|
||||
"Opens the browser when the port is automatically forwarded, but only the first time the port is forward during a session. Depending on your settings, this could open an embedded browser.",
|
||||
"Opens a preview in the same window when the port is automatically forwarded.",
|
||||
"Shows no notification and takes no action when this port is automatically forwarded.",
|
||||
"This port will not be automatically forwarded."
|
||||
|
@ -873,6 +877,7 @@
|
|||
"enum": [
|
||||
"notify",
|
||||
"openBrowser",
|
||||
"openBrowserOnce",
|
||||
"openPreview",
|
||||
"silent",
|
||||
"ignore"
|
||||
|
@ -880,6 +885,7 @@
|
|||
"enumDescriptions": [
|
||||
"Shows a notification when a port is automatically forwarded.",
|
||||
"Opens the browser when the port is automatically forwarded. Depending on your settings, this could open an embedded browser.",
|
||||
"Opens the browser when the port is automatically forwarded, but only the first time the port is forward during a session. Depending on your settings, this could open an embedded browser.",
|
||||
"Opens a preview in the same window when the port is automatically forwarded.",
|
||||
"Shows no notification and takes no action when this port is automatically forwarded.",
|
||||
"This port will not be automatically forwarded."
|
||||
|
@ -1194,6 +1200,7 @@
|
|||
"enum": [
|
||||
"notify",
|
||||
"openBrowser",
|
||||
"openBrowserOnce",
|
||||
"openPreview",
|
||||
"silent",
|
||||
"ignore"
|
||||
|
@ -1201,6 +1208,7 @@
|
|||
"enumDescriptions": [
|
||||
"Shows a notification when a port is automatically forwarded.",
|
||||
"Opens the browser when the port is automatically forwarded. Depending on your settings, this could open an embedded browser.",
|
||||
"Opens the browser when the port is automatically forwarded, but only the first time the port is forward during a session. Depending on your settings, this could open an embedded browser.",
|
||||
"Opens a preview in the same window when the port is automatically forwarded.",
|
||||
"Shows no notification and takes no action when this port is automatically forwarded.",
|
||||
"This port will not be automatically forwarded."
|
||||
|
@ -1484,6 +1492,7 @@
|
|||
"enum": [
|
||||
"notify",
|
||||
"openBrowser",
|
||||
"openBrowserOnce",
|
||||
"openPreview",
|
||||
"silent",
|
||||
"ignore"
|
||||
|
@ -1491,6 +1500,7 @@
|
|||
"enumDescriptions": [
|
||||
"Shows a notification when a port is automatically forwarded.",
|
||||
"Opens the browser when the port is automatically forwarded. Depending on your settings, this could open an embedded browser.",
|
||||
"Opens the browser when the port is automatically forwarded, but only the first time the port is forward during a session. Depending on your settings, this could open an embedded browser.",
|
||||
"Opens a preview in the same window when the port is automatically forwarded.",
|
||||
"Shows no notification and takes no action when this port is automatically forwarded.",
|
||||
"This port will not be automatically forwarded."
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
"enum": [
|
||||
"notify",
|
||||
"openBrowser",
|
||||
"openBrowserOnce",
|
||||
"openPreview",
|
||||
"silent",
|
||||
"ignore"
|
||||
|
@ -52,6 +53,7 @@
|
|||
"enumDescriptions": [
|
||||
"Shows a notification when a port is automatically forwarded.",
|
||||
"Opens the browser when the port is automatically forwarded. Depending on your settings, this could open an embedded browser.",
|
||||
"Opens the browser when the port is automatically forwarded, but only the first time the port is forward during a session. Depending on your settings, this could open an embedded browser.",
|
||||
"Opens a preview in the same window when the port is automatically forwarded.",
|
||||
"Shows no notification and takes no action when this port is automatically forwarded.",
|
||||
"This port will not be automatically forwarded."
|
||||
|
|
|
@ -55,7 +55,8 @@ export enum ProvidedOnAutoForward {
|
|||
OpenBrowser = 2,
|
||||
OpenPreview = 3,
|
||||
Silent = 4,
|
||||
Ignore = 5
|
||||
Ignore = 5,
|
||||
OpenBrowserOnce = 6
|
||||
}
|
||||
|
||||
export interface ProvidedPortAttributes {
|
||||
|
|
3
src/vs/vscode.proposed.d.ts
vendored
3
src/vs/vscode.proposed.d.ts
vendored
|
@ -2687,7 +2687,8 @@ declare module 'vscode' {
|
|||
OpenBrowser = 2,
|
||||
OpenPreview = 3,
|
||||
Silent = 4,
|
||||
Ignore = 5
|
||||
Ignore = 5,
|
||||
OpenBrowserOnce = 6
|
||||
}
|
||||
|
||||
export class PortAttributes {
|
||||
|
|
|
@ -221,6 +221,7 @@ class OnAutoForwardedAction extends Disposable {
|
|||
private lastNotification: INotificationHandle | undefined;
|
||||
private lastShownPort: number | undefined;
|
||||
private doActionTunnels: RemoteTunnel[] | undefined;
|
||||
private alreadyOpenedOnce: Set<string> = new Set();
|
||||
|
||||
constructor(private readonly notificationService: INotificationService,
|
||||
private readonly remoteExplorerService: IRemoteExplorerService,
|
||||
|
@ -243,6 +244,13 @@ class OnAutoForwardedAction extends Disposable {
|
|||
const attributes = (await this.remoteExplorerService.tunnelModel.getAttributes([tunnel.tunnelRemotePort]))?.get(tunnel.tunnelRemotePort)?.onAutoForward;
|
||||
this.logService.trace(`ForwardedPorts: (OnAutoForwardedAction) onAutoForward action is ${attributes}`);
|
||||
switch (attributes) {
|
||||
case OnPortForward.OpenBrowserOnce: {
|
||||
if (this.alreadyOpenedOnce.has(tunnel.localAddress)) {
|
||||
break;
|
||||
}
|
||||
this.alreadyOpenedOnce.add(tunnel.localAddress);
|
||||
// Intentionally do not break so that the open browser path can be run.
|
||||
}
|
||||
case OnPortForward.OpenBrowser: {
|
||||
const address = makeAddress(tunnel.tunnelRemoteHost, tunnel.tunnelRemotePort);
|
||||
await OpenPortInBrowserAction.run(this.remoteExplorerService.tunnelModel, this.openerService, address);
|
||||
|
|
|
@ -158,10 +158,11 @@ Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration)
|
|||
properties: {
|
||||
'onAutoForward': {
|
||||
type: 'string',
|
||||
enum: ['notify', 'openBrowser', 'openPreview', 'silent', 'ignore'],
|
||||
enum: ['notify', 'openBrowser', 'openBrowserOnce', 'openPreview', 'silent', 'ignore'],
|
||||
enumDescriptions: [
|
||||
localize('remote.portsAttributes.notify', "Shows a notification when a port is automatically forwarded."),
|
||||
localize('remote.portsAttributes.openBrowser', "Opens the browser when the port is automatically forwarded. Depending on your settings, this could open an embedded browser."),
|
||||
localize('remote.portsAttributes.openBrowserOnce', "Opens the browser when the port is automatically forwarded, but only the first time the port is forward during a session. Depending on your settings, this could open an embedded browser."),
|
||||
localize('remote.portsAttributes.openPreview', "Opens a preview in the same window when the port is automatically forwarded."),
|
||||
localize('remote.portsAttributes.silent', "Shows no notification and takes no action when this port is automatically forwarded."),
|
||||
localize('remote.portsAttributes.ignore', "This port will not be automatically forwarded.")
|
||||
|
|
|
@ -145,6 +145,7 @@ export function mapHasAddressLocalhostOrAllInterfaces<T>(map: Map<string, T>, ho
|
|||
export enum OnPortForward {
|
||||
Notify = 'notify',
|
||||
OpenBrowser = 'openBrowser',
|
||||
OpenBrowserOnce = 'openBrowserOnce',
|
||||
OpenPreview = 'openPreview',
|
||||
Silent = 'silent',
|
||||
Ignore = 'ignore'
|
||||
|
@ -328,6 +329,7 @@ export class PortsAttributes extends Disposable {
|
|||
switch (providedAction) {
|
||||
case ProvidedOnAutoForward.Notify: return OnPortForward.Notify;
|
||||
case ProvidedOnAutoForward.OpenBrowser: return OnPortForward.OpenBrowser;
|
||||
case ProvidedOnAutoForward.OpenBrowserOnce: return OnPortForward.OpenBrowserOnce;
|
||||
case ProvidedOnAutoForward.OpenPreview: return OnPortForward.OpenPreview;
|
||||
case ProvidedOnAutoForward.Silent: return OnPortForward.Silent;
|
||||
case ProvidedOnAutoForward.Ignore: return OnPortForward.Ignore;
|
||||
|
|
Loading…
Reference in a new issue