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

Update port attributes arguments to be a property bag #189976

Merged
merged 2 commits into from
Aug 9, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/vs/workbench/api/common/extHostTunnelService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,22 @@ export class ExtHostTunnelService extends Disposable implements IExtHostTunnelSe
});
}

async $providePortAttributes(handles: number[], ports: number[], pid: number | undefined, commandline: string | undefined, cancellationToken: vscode.CancellationToken): Promise<ProvidedPortAttributes[]> {
async $providePortAttributes(handles: number[], ports: number[], pid: number | undefined, commandLine: string | undefined, cancellationToken: vscode.CancellationToken): Promise<ProvidedPortAttributes[]> {
const providedAttributes: { providedAttributes: vscode.PortAttributes | null | undefined; port: number }[] = [];
for (const handle of handles) {
const provider = this._portAttributesProviders.get(handle);
if (!provider) {
return [];
}
providedAttributes.push(...(await Promise.all(ports.map(async (port) => {
return { providedAttributes: (await provider.provider.providePortAttributes(port, pid, commandline, cancellationToken)), port };
let providedAttributes: vscode.PortAttributes | null | undefined;
try {
providedAttributes = await provider.provider.providePortAttributes({ port, pid, commandLine }, cancellationToken);
} catch (e) {
// Call with old signature for breaking API change
providedAttributes = await (provider.provider.providePortAttributes as any as (port: number, pid: number | undefined, commandLine: string | undefined, token: vscode.CancellationToken) => vscode.ProviderResult<vscode.PortAttributes>)(port, pid, commandLine, cancellationToken);
}
return { providedAttributes, port };
}))));
}

Expand Down
2 changes: 1 addition & 1 deletion src/vscode-dts/vscode.proposed.portsAttributes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ declare module 'vscode' {
* @param commandLine The command line of the process that is listening on the port. If the command line is unknown, undefined will be passed.
* @param token A cancellation token that indicates the result is no longer needed.
*/
providePortAttributes(port: number, pid: number | undefined, commandLine: string | undefined, token: CancellationToken): ProviderResult<PortAttributes>;
providePortAttributes(attributes: { port: number; pid?: number; commandLine?: string }, token: CancellationToken): ProviderResult<PortAttributes>;
}

/**
Expand Down