Skip to content

Commit 15d8d39

Browse files
authored
Update port selector range (microsoft#184689)
`registerPortAttributesProvider({portRange:[5000,5000]}...` doesn't match port 5000 Fixes microsoft#183846
1 parent 9f2b634 commit 15d8d39

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

src/vs/workbench/api/browser/mainThreadTunnelService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export class MainThreadTunnelService extends Disposable implements MainThreadTun
8383
// Check all the selectors to make sure it's worth going to the extension host.
8484
const appropriateHandles = Array.from(this.portsAttributesProviders.entries()).filter(entry => {
8585
const selector = entry[1];
86-
const portRange = selector.portRange;
86+
const portRange = (typeof selector.portRange === 'number') ? [selector.portRange, selector.portRange + 1] : selector.portRange;
8787
const portInRange = portRange ? ports.some(port => portRange[0] <= port && port < portRange[1]) : true;
8888
const commandMatches = !selector.commandPattern || (commandLine && (commandLine.match(selector.commandPattern)));
8989
return portInRange && commandMatches;

src/vs/workbench/api/common/extHost.protocol.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1424,7 +1424,7 @@ export enum CandidatePortSource {
14241424
}
14251425

14261426
export interface PortAttributesSelector {
1427-
portRange?: [number, number];
1427+
portRange?: [number, number] | number;
14281428
commandPattern?: RegExp;
14291429
}
14301430

src/vscode-dts/vscode.proposed.portsAttributes.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,9 @@ declare module 'vscode' {
7272
export interface PortAttributesSelector {
7373
/**
7474
* Specifying a port range will cause your provider to only be called for ports within the range.
75+
* The start is inclusive and the end is exclusive.
7576
*/
76-
portRange?: [number, number];
77+
portRange?: [number, number] | number;
7778

7879
/**
7980
* Specifying a command pattern will cause your provider to only be called for processes whose command line matches the pattern.

0 commit comments

Comments
 (0)