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

new install proprosed api #117059

Merged
merged 2 commits into from Feb 22, 2021
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
1 change: 1 addition & 0 deletions src/vs/platform/telemetry/common/telemetry.ts
Expand Up @@ -12,6 +12,7 @@ export interface ITelemetryInfo {
sessionId: string;
machineId: string;
instanceId: string;
firstSessionDate: string;
msftInternal?: boolean;
}

Expand Down
3 changes: 2 additions & 1 deletion src/vs/platform/telemetry/common/telemetryService.ts
Expand Up @@ -105,9 +105,10 @@ export class TelemetryService implements ITelemetryService {
let sessionId = values['sessionID'];
let instanceId = values['common.instanceId'];
let machineId = values['common.machineId'];
let firstSessionDate = values['common.firstSessionDate'];
let msftInternal = values['common.msftInternal'];

return { sessionId, instanceId, machineId, msftInternal };
return { sessionId, instanceId, machineId, firstSessionDate, msftInternal };
}

dispose(): void {
Expand Down
3 changes: 2 additions & 1 deletion src/vs/platform/telemetry/common/telemetryUtils.ts
Expand Up @@ -35,7 +35,8 @@ export const NullTelemetryService = new class implements ITelemetryService {
return Promise.resolve({
instanceId: 'someValue.instanceId',
sessionId: 'someValue.sessionId',
machineId: 'someValue.machineId'
machineId: 'someValue.machineId',
firstSessionDate: 'someValue.firstSessionDate'
});
}
};
Expand Down
5 changes: 5 additions & 0 deletions src/vs/vscode.proposed.d.ts
Expand Up @@ -2192,6 +2192,11 @@ declare module 'vscode' {

export interface ExtensionContext {
readonly extensionRuntime: ExtensionRuntime;

/**
* Indicates that this is a fresh install of VS Code.
*/
readonly isNewInstall: boolean;
}

//#endregion
Expand Down
5 changes: 5 additions & 0 deletions src/vs/workbench/api/common/extHostExtensionService.ts
Expand Up @@ -388,6 +388,7 @@ export abstract class AbstractExtHostExtensionService extends Disposable impleme
const extensionMode = extensionDescription.isUnderDevelopment
? (this._initData.environment.extensionTestsLocationURI ? ExtensionMode.Test : ExtensionMode.Development)
: ExtensionMode.Production;
const installAge = Date.now() - new Date(this._initData.telemetryInfo.firstSessionDate).getTime();

this._logService.trace(`ExtensionService#loadExtensionContext ${extensionDescription.identifier.value}`);

Expand Down Expand Up @@ -416,6 +417,10 @@ export abstract class AbstractExtHostExtensionService extends Disposable impleme
checkProposedApiEnabled(extensionDescription);
return that.extensionRuntime;
},
get isNewInstall() {
checkProposedApiEnabled(extensionDescription);
return isNaN(installAge) ? false : installAge < 1000 * 60 * 60 * 24; // installAge is less than a day;
},
jrieken marked this conversation as resolved.
Show resolved Hide resolved
get environmentVariableCollection() { return that._extHostTerminalService.getEnvironmentVariableCollection(extensionDescription); }
});
});
Expand Down
3 changes: 2 additions & 1 deletion src/vs/workbench/electron-sandbox/sandbox.simpleservices.ts
Expand Up @@ -448,7 +448,8 @@ class SimpleTelemetryService implements ITelemetryService {
return {
instanceId: 'someValue.instanceId',
sessionId: 'someValue.sessionId',
machineId: 'someValue.machineId'
machineId: 'someValue.machineId',
firstSessionDate: 'someValue.firstSessionDate'
};
}
}
Expand Down
Expand Up @@ -202,7 +202,8 @@ class TestTelemetryService implements ITelemetryService {
return Promise.resolve({
instanceId: 'someValue.instanceId',
sessionId: 'someValue.sessionId',
machineId: 'someValue.machineId'
machineId: 'someValue.machineId',
firstSessionDate: 'someValue.firstSessionDate'
});
}
}