Skip to content

Commit afd135a

Browse files
committed
check for uv
1 parent d563d5b commit afd135a

1 file changed

Lines changed: 17 additions & 12 deletions

File tree

src/common/telemetry/helpers.ts

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { getDefaultEnvManagerSetting, getDefaultPkgManagerSetting } from '../../features/settings/settingHelpers';
22
import { EnvironmentManagers, PythonProjectManager } from '../../internal.api';
3+
import { getUvEnvironments } from '../../managers/builtin/uvEnvironments';
34
import { getWorkspaceFolders } from '../workspace.apis';
45
import { EventNames } from './constants';
56
import { sendTelemetryEvent } from './sender';
@@ -115,19 +116,23 @@ export async function sendEnvironmentToolUsageTelemetry(
115116
try {
116117
const env = await envManagers.getEnvironment(project.uri);
117118
if (env?.envId?.managerId) {
118-
const toolName = extractToolName(env.envId.managerId);
119-
120-
// Check if this is a UV environment (UV uses venv manager but has 'uv' in description)
121-
const isUv = env.description?.toLowerCase().includes('uv') ?? false;
122-
123-
// Determine the tool name
124-
if (isUv) {
125-
toolsUsed.add('uv');
126-
} else {
127-
// Normalize 'global' to 'system' for consistency
128-
const normalizedTool = toolName === 'global' ? 'system' : toolName;
129-
toolsUsed.add(normalizedTool);
119+
let toolName = extractToolName(env.envId.managerId);
120+
121+
// UV environments share the venv manager. Check the persistent UV env list instead
122+
if (toolName === 'venv' && env.environmentPath) {
123+
// Lazily load UV environment paths only when a venv environment is encountered
124+
const uvEnvPaths = await getUvEnvironments();
125+
if (uvEnvPaths.includes(env.environmentPath.fsPath)) {
126+
toolName = 'uv';
127+
}
130128
}
129+
130+
// Normalize 'global' to 'system' for consistency
131+
if (toolName === 'global') {
132+
toolName = 'system';
133+
}
134+
135+
toolsUsed.add(toolName);
131136
}
132137
} catch {
133138
// Ignore errors when getting environment for a project

0 commit comments

Comments
 (0)