Skip to content

Commit 75c2019

Browse files
committed
Add useEnvironmentsExtension value to issue report template and handler
1 parent 502ad70 commit 75c2019

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

resources/report_issue_user_data_template.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
- Python version (& distribution if applicable, e.g. Anaconda): {0}
22
- Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): {1}
33
- Value of the `python.languageServer` setting: {2}
4+
- Value of the `python.useEnvironmentsExtension` setting: {6}
45

56
<details>
67
<summary>User Settings</summary>

src/client/common/application/commands/reportIssueCommand.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { EXTENSION_ROOT_DIR } from '../../../constants';
1414
import { IInterpreterService } from '../../../interpreter/contracts';
1515
import { Commands } from '../../constants';
1616
import { IConfigurationService, IPythonSettings } from '../../types';
17+
import { getConfiguration } from '../../vscodeApis/workspaceApis';
1718
import { sendTelemetryEvent } from '../../../telemetry';
1819
import { EventName } from '../../../telemetry/constants';
1920
import { EnvironmentType } from '../../../pythonEnvironments/info';
@@ -102,6 +103,9 @@ export class ReportIssueCommandHandler implements IExtensionSingleActivationServ
102103
? `Multiroot scenario, following user settings may not apply:${os.EOL}`
103104
: '';
104105

106+
// Get useEnvironmentsExtension value and indicate if it's user-configured
107+
const useEnvExtensionValue = this.getUseEnvironmentsExtensionInfo();
108+
105109
const installedExtensions = getExtensions()
106110
.filter((extension) => !extension.id.startsWith('vscode.'))
107111
.sort((a, b) => {
@@ -128,6 +132,7 @@ export class ReportIssueCommandHandler implements IExtensionSingleActivationServ
128132
hasMultipleFoldersText,
129133
userSettings,
130134
installedExtensions.join('\n'),
135+
useEnvExtensionValue,
131136
),
132137
});
133138
sendTelemetryEvent(EventName.USE_REPORT_ISSUE_COMMAND, undefined, {});
@@ -141,4 +146,25 @@ export class ReportIssueCommandHandler implements IExtensionSingleActivationServ
141146
const systemVariables = new SystemVariables(resource, undefined, this.workspaceService);
142147
return systemVariables.resolveAny(this.packageJSONSettings[`python.${settingKey}`]?.default);
143148
}
149+
150+
private getUseEnvironmentsExtensionInfo(): string {
151+
const config = getConfiguration('python');
152+
const value = config.get<boolean>('useEnvironmentsExtension', false);
153+
const inspection = config.inspect<boolean>('useEnvironmentsExtension');
154+
155+
// Determine where the setting is configured
156+
let source = 'default';
157+
if (inspection?.workspaceFolderValue !== undefined) {
158+
source = 'workspace folder';
159+
} else if (inspection?.workspaceValue !== undefined) {
160+
source = 'workspace';
161+
} else if (inspection?.globalValue !== undefined) {
162+
source = 'user settings';
163+
}
164+
165+
if (source === 'default') {
166+
return `${value}`;
167+
}
168+
return `${value} (set in ${source})`;
169+
}
144170
}

0 commit comments

Comments
 (0)