Skip to content

Commit e47a286

Browse files
authored
resolvers: add appQuality and appCommit (microsoft#182532)
Currently remote extensions use a hack to read the product.json, but this can't be done on web. Instead expose proper API to get the appQuality and appCommit.
1 parent b7c81ac commit e47a286

File tree

6 files changed

+20
-1
lines changed

6 files changed

+20
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,15 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
397397
registerIssueUriRequestHandler(handler: vscode.IssueUriRequestHandler) {
398398
checkProposedApiEnabled(extension, 'handleIssueUri');
399399
return extHostIssueReporter.registerIssueUriRequestHandler(extension, handler);
400-
}
400+
},
401+
get appQuality(): string | undefined {
402+
checkProposedApiEnabled(extension, 'resolvers');
403+
return initData.quality;
404+
},
405+
get appCommit(): string | undefined {
406+
checkProposedApiEnabled(extension, 'resolvers');
407+
return initData.commit;
408+
},
401409
};
402410
if (!initData.environment.extensionTestsLocationURI) {
403411
// allow to patch env-function when running tests

src/vs/workbench/services/extensions/browser/webWorkerExtensionHost.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ export class WebWorkerExtensionHost extends Disposable implements IExtensionHost
278278
return {
279279
commit: this._productService.commit,
280280
version: this._productService.version,
281+
quality: this._productService.quality,
281282
parentPid: 0,
282283
environment: {
283284
isExtensionDevelopmentDebug: this._environmentService.debugRenderer,

src/vs/workbench/services/extensions/common/extensionHostProtocol.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export interface IExtensionDescriptionDelta {
1919

2020
export interface IExtensionHostInitData {
2121
version: string;
22+
quality: string | undefined;
2223
commit?: string;
2324
/**
2425
* When set to `0`, no polling for the parent process still running will happen.

src/vs/workbench/services/extensions/common/remoteExtensionHost.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ export class RemoteExtensionHost extends Disposable implements IExtensionHost {
208208
return {
209209
commit: this._productService.commit,
210210
version: this._productService.version,
211+
quality: this._productService.quality,
211212
parentPid: remoteInitData.pid,
212213
environment: {
213214
isExtensionDevelopmentDebug,

src/vs/workbench/services/extensions/electron-sandbox/localProcessExtensionHost.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,7 @@ export class NativeLocalProcessExtensionHost implements IExtensionHost {
419419
return {
420420
commit: this._productService.commit,
421421
version: this._productService.version,
422+
quality: this._productService.quality,
422423
parentPid: 0,
423424
environment: {
424425
isExtensionDevelopmentDebug: this._isExtensionDevDebug,

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ declare module 'vscode' {
6060
label: string;
6161
}
6262

63+
export namespace env {
64+
/** Quality of the application. May be undefined if running from sources. */
65+
export const appQuality: string | undefined;
66+
/** Commit of the application. May be undefined if running from sources. */
67+
export const appCommit: string | undefined;
68+
}
69+
6370
interface TunnelOptions {
6471
remoteAddress: { port: number; host: string };
6572
// The desired local port. If this port can't be used, then another will be chosen.

0 commit comments

Comments
 (0)