Skip to content
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

Updates to usage of PortAttributes VSC API #13506

Merged
merged 2 commits into from
May 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/kernels/portAttributeProvider.node.ts
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DonJayamanne are you able to use a selector when you register the provider (first param here):

this.disposables.push(workspace.registerPortAttributesProvider({}, this));
} catch (ex) {

I'm thinking about having an error if the selector is empty like this. The selector will result in a better experience for users as it will prevent extra trips to the extension host for ports that won't have attributes provided.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexr00 please could you file an issue, so it never gets forgotten/lost
Will look into it when i get back

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! #13553

Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class PortAttributesProviders implements PortAttributesProvider, IExtensi
): PortAttributes | undefined {
try {
if (UsedPorts.has(port)) {
return new PortAttributes(port, PortAutoForwardAction.Ignore);
return new PortAttributes(PortAutoForwardAction.Ignore);
}
} catch (ex) {
// In case proposed API changes.
Expand Down
9 changes: 1 addition & 8 deletions src/test/mocks/vsc/extHostedTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2398,23 +2398,16 @@ export namespace vscMockExtHostedTypes {
}

export class PortAttributes {
/**
* The port number associated with this this set of attributes.
*/
port: number;

/**
* The action to be taken when this port is detected for auto forwarding.
*/
autoForwardAction: PortAutoForwardAction;

/**
* Creates a new PortAttributes object
* @param port the port number
* @param autoForwardAction the action to take when this port is detected
*/
constructor(port: number, autoForwardAction: PortAutoForwardAction) {
this.port = port;
constructor(autoForwardAction: PortAutoForwardAction) {
this.autoForwardAction = autoForwardAction;
}
}
Expand Down
Loading