diff --git a/src/vs/workbench/contrib/remote/browser/tunnelView.ts b/src/vs/workbench/contrib/remote/browser/tunnelView.ts index 949faefeb3c93efa7b4e2bff8f20271d0229820d..ae1bac984fd599632cf8b619737987e36d47a352 100644 --- a/src/vs/workbench/contrib/remote/browser/tunnelView.ts +++ b/src/vs/workbench/contrib/remote/browser/tunnelView.ts @@ -657,6 +657,17 @@ export class TunnelPanelDescriptor implements IViewDescriptor { } } +function validationMessage(validationString: string | null): { content: string, severity: Severity } | null { + if (!validationString) { + return null; + } + + return { + content: validationString, + severity: Severity.Error + }; +} + namespace LabelTunnelAction { export const ID = 'remote.tunnel.label'; export const LABEL = nls.localize('remote.tunnel.label', "Set Label"); @@ -733,17 +744,7 @@ namespace ForwardPortAction { } remoteExplorerService.setEditable(undefined, null); }, - validationMessage: (value) => { - const validationString = validateInput(value); - if (!validationString) { - return null; - } - - return { - content: validationString, - severity: Severity.Error - }; - }, + validationMessage: (value) => validationMessage(validateInput(value)), placeholder: forwardPrompt }); } @@ -926,17 +927,7 @@ namespace ChangeLocalPortAction { } } }, - validationMessage: (value) => { - const validationString = validateInput(value); - if (!validationString) { - return null; - } - - return { - content: validationString, - severity: Severity.Error - }; - }, + validationMessage: (value) => validationMessage(validateInput(value)), placeholder: nls.localize('remote.tunnelsView.changePort', "New local port") }); }