Skip to content

Commit dee7a1e

Browse files
Merge pull request #158 from codacy/add-more-tracking
fix: identify already logged in users on extension activation
2 parents ab5aa6f + 05b8f7f commit dee7a1e

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/extension.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,18 @@ export async function activate(context: vscode.ExtensionContext) {
348348
// If it is not installed, don't do anything. On the next usage of the CLI it will be installed with the most recent version
349349
}
350350

351+
// Identify user if already authenticated
352+
if (Config.apiToken) {
353+
try {
354+
const user = await Account.current()
355+
if (user) {
356+
Telemetry.identify(user, codacyCloud.organization)
357+
}
358+
} catch (error) {
359+
Logger.debug(`Failed to identify user during activation: ${error}`)
360+
}
361+
}
362+
351363
// Update initially
352364
await updateMCPState()
353365
}

0 commit comments

Comments
 (0)