Skip to content
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
1 change: 1 addition & 0 deletions Extension/src/LanguageServer/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1391,6 +1391,7 @@ export class DefaultClient implements Client {
}

this.copilotCompletionProvider = CopilotCompletionContextProvider.Create();
util.setProgress(util.getProgressCopilotSuccess());
this.disposables.push(this.copilotCompletionProvider);

// Listen for messages from the language server.
Expand Down
25 changes: 17 additions & 8 deletions Extension/src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,19 +247,22 @@ export function displayExtensionNotReadyPrompt(): void {
// Users start with a progress of 0 and it increases as they get further along in using the tool.
// This eliminates noise/problems due to re-installs, terminated installs that don't send errors,
// errors followed by workarounds that lead to success, etc.
const progressInstallSuccess: number = 100;
const progressDebuggerStarted: number = 50;
const progressDebuggerSuccess: number = 100;
const progressExecutableStarted: number = 150;
const progressCopilotSuccess: number = 180;
const progressExecutableSuccess: number = 200;
const progressParseRootSuccess: number = 300;
const progressLanguageServiceDisabled: number = 400;
const progressIntelliSenseNoSquiggles: number = 1000;
// Might add more IntelliSense progress measurements later.
// IntelliSense progress is separate from the install progress, because parse root can occur afterwards.
// IntelliSense progress is separate from the activation progress, because parse root can occur afterwards.

const installProgressStr: string = "CPP." + packageJson.version + ".Progress";
const activationProgressStr: string = "CPP." + packageJson.version + ".Progress";
const intelliSenseProgressStr: string = "CPP." + packageJson.version + ".IntelliSenseProgress";

export function getProgress(): number {
return extensionContext ? extensionContext.globalState.get<number>(installProgressStr, -1) : -1;
return extensionContext ? extensionContext.globalState.get<number>(activationProgressStr, -1) : -1;
}

export function getIntelliSenseProgress(): number {
Expand All @@ -268,15 +271,18 @@ export function getIntelliSenseProgress(): number {

export function setProgress(progress: number): void {
if (extensionContext && getProgress() < progress) {
void extensionContext.globalState.update(installProgressStr, progress);
void extensionContext.globalState.update(activationProgressStr, progress);
const telemetryProperties: Record<string, string> = {};
let progressName: string | undefined;
switch (progress) {
case 0: progressName = "install started"; break;
case progressInstallSuccess: progressName = "install succeeded"; break;
case 0: progressName = "activation started"; break;
case progressDebuggerStarted: progressName = "debugger started"; break;
case progressDebuggerSuccess: progressName = "debugger succeeded"; break;
case progressExecutableStarted: progressName = "executable started"; break;
case progressCopilotSuccess: progressName = "copilot succeeded"; break;
case progressExecutableSuccess: progressName = "executable succeeded"; break;
case progressParseRootSuccess: progressName = "parse root succeeded"; break;
case progressLanguageServiceDisabled: progressName = "language service disabled"; break;
}
if (progressName) {
telemetryProperties.progress = progressName;
Expand All @@ -300,10 +306,13 @@ export function setIntelliSenseProgress(progress: number): void {
}
}

export function getProgressInstallSuccess(): number { return progressInstallSuccess; } // Download/install was successful (i.e. not blocked by component acquisition).
export function getProgressDebuggerStarted(): number { return progressDebuggerStarted; } // Debugger initialization was started.
export function getProgressDebuggerSuccess(): number { return progressDebuggerSuccess; } // Debugger was successfully initialized.
export function getProgressExecutableStarted(): number { return progressExecutableStarted; } // The extension was activated and starting the executable was attempted.
export function getProgressCopilotSuccess(): number { return progressCopilotSuccess; } // Copilot activation was successful.
export function getProgressExecutableSuccess(): number { return progressExecutableSuccess; } // Starting the exe was successful (i.e. not blocked by 32-bit or glibc < 2.18 on Linux)
export function getProgressParseRootSuccess(): number { return progressParseRootSuccess; } // Parse root was successful (i.e. not blocked by processing taking too long).
export function getProgressLanguageServiceDisabled(): number { return progressLanguageServiceDisabled; } // The user disabled the language service.
export function getProgressIntelliSenseNoSquiggles(): number { return progressIntelliSenseNoSquiggles; } // IntelliSense was successful and the user got no squiggles.

export function isUri(input: any): input is vscode.Uri {
Expand Down
5 changes: 4 additions & 1 deletion Extension/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ export async function activate(context: vscode.ExtensionContext): Promise<CppToo
});

util.setExtensionContext(context);
Telemetry.activate();
util.setProgress(0);
Telemetry.activate();

// Register a protocol handler to serve localized versions of the schema for c_cpp_properties.json
class SchemaProvider implements vscode.TextDocumentContentProvider {
Expand All @@ -63,7 +63,9 @@ export async function activate(context: vscode.ExtensionContext): Promise<CppToo
vscode.workspace.registerTextDocumentContentProvider('cpptools-schema', instrument(new SchemaProvider()));

// Initialize the DebuggerExtension and register the related commands and providers.
util.setProgress(util.getProgressDebuggerStarted());
await DebuggerExtension.initialize(context);
util.setProgress(util.getProgressDebuggerSuccess());

const info: PlatformInformation = await PlatformInformation.GetPlatformInformation();
sendTelemetry(info);
Expand Down Expand Up @@ -161,6 +163,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<CppToo
// The check here for isIntelliSenseEngineDisabled avoids logging
// the message on old Macs that we've already displayed a warning for.
log(localize("intellisense.disabled", "intelliSenseEngine is disabled"));
util.setProgress(util.getProgressLanguageServiceDisabled());
}

// Send an instrumentation message upon completing activation.
Expand Down