-
Notifications
You must be signed in to change notification settings - Fork 29.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
registerPortAttributesProvider({portRange:[5000,5000]}...
doesn't match port 5000
#183846
Comments
Since other ranges in the API are [inclusive, exclusive] we will keep it consistent here. I'm adding a doc comment and a shorthand for having just one port:
|
`registerPortAttributesProvider({portRange:[5000,5000]}...` doesn't match port 5000 Fixes #183846
I'm still not seeing the portRange being respected when it's a single number. I used |
@andreamah do you set the port range to |
For this, just 5000. |
I am not able to reproduce this. Debugging, I can see that the provider is called when the port is both manually forwarded from the Ports view and when it's auto forwarded. When the port is auto forwarded, I see that the auto forward action is respected. Would you mind testing again during verification this endgame? If you're still seeing the problem let's take a look together. |
Yeah, I'm still seeing this. I'm running in an alpine devcontainer: // This method is called when your extension is activated
// Your extension is activated the very first time the command is executed
export function activate(context: vscode.ExtensionContext) {
const port = 5000;
// Use the console to output diagnostic information (console.log) and errors (console.error)
// This line of code will only be executed once when your extension is activated
console.log('Congratulations, your extension "testtest" is now active!');
// The command has been defined in the package.json file
// Now provide the implementation of the command with registerCommand
// The commandId parameter must match the command field in package.json
vscode.workspace.registerPortAttributesProvider({portRange:port}, {providePortAttributes(
port: number,
pid: number | undefined,
commandLine: string | undefined,
token: vscode.CancellationToken
): vscode.ProviderResult<vscode.PortAttributes> {
return new vscode.PortAttributes(
vscode.PortAutoForwardAction.Notify
);
}});
let disposable = vscode.commands.registerCommand('testtest.helloWorld', () => {
// The code you place here will be executed every time your command is executed
const server = createServer((request: IncomingMessage, response: ServerResponse) => {
response.end('Hello world!');
});
server.listen(port);
});
context.subscriptions.push(disposable);
} Did I register correctly? |
Let's debug this together next week. |
Debugged offline. I had |
Testing #183547
Based on the docs, it's hard to tell whether the range includes the lower and upper number (is the range inclusive of the bounds?). Also, is the array of two numbers a lower and upper range? I feel like I made that assumption myself. It'd be great to specify that in the docs.
Repro steps:
and create a ports attribute provider.
2. Set portRange selector to be
[5000,5000]
3. When port 5000 is auto-forwarded, it doesn't respect the
providePortAttributes
provider 🐛The text was updated successfully, but these errors were encountered: