Skip to content

Commit 2d6d6cd

Browse files
committed
Fix free port quick fix on Windows
Valid port numbers are 1-65535, but 1-1023 are reserved. Fixes microsoft#161775
1 parent 0857860 commit 2d6d6cd

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/vs/workbench/contrib/terminal/browser/terminalQuickFixBuiltinActions.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import { IAction } from 'vs/base/common/actions';
7-
import { isWindows } from 'vs/base/common/platform';
87
import { localize } from 'vs/nls';
98
import { IOpenerService } from 'vs/platform/opener/common/opener';
109
import { QuickFixMatchResult, ITerminalQuickFixAction, ITerminalQuickFixOptions, ITerminalInstance } from 'vs/workbench/contrib/terminal/browser/terminal';
@@ -14,7 +13,7 @@ export const GitCommandLineRegex = /git/;
1413
export const GitPushCommandLineRegex = /git\s+push/;
1514
export const AnyCommandLineRegex = /.+/;
1615
export const GitSimilarOutputRegex = /most similar command is\s*([^\s]{3,})/;
17-
export const FreePortOutputRegex = /address already in use \d\.\d\.\d\.\d:(\d\d\d\d)|Unable to bind [^ ]*:(\d+)|can't listen on port (\d+)|listen EADDRINUSE [^ ]*:(\d+)/;
16+
export const FreePortOutputRegex = /address already in use \d+\.\d+\.\d+\.\d+:(\d{4,5})|Unable to bind [^ ]*:(\d{4,5})|can't listen on port (\d{4,5})|listen EADDRINUSE [^ ]*:(\d{4,5})/;
1817
export const GitPushOutputRegex = /git push --set-upstream origin ([^\s]+)/;
1918
export const GitCreatePrOutputRegex = /Create a pull request for \'([^\s]+)\' on GitHub by visiting:\s*remote:\s*(https:.+pull.+)/;
2019

@@ -50,8 +49,7 @@ export function freePort(terminalInstance?: Partial<ITerminalInstance>): ITermin
5049
return {
5150
quickFixLabel: (matchResult: QuickFixMatchResult) => matchResult.outputMatch ? `Free port ${matchResult.outputMatch[1]}` : '',
5251
commandLineMatcher: AnyCommandLineRegex,
53-
// TODO: Support free port on Windows https://github.com/microsoft/vscode/issues/161775
54-
outputMatcher: isWindows ? undefined : {
52+
outputMatcher: {
5553
lineMatcher: FreePortOutputRegex,
5654
anchor: 'bottom',
5755
offset: 0,

0 commit comments

Comments
 (0)