Skip to content

Commit 81cfd1c

Browse files
committed
fix location of setting set
1 parent be5a1b2 commit 81cfd1c

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

src/extension.ts

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { commands, extensions, ExtensionContext, LogOutputChannel, Terminal, Uri, window, workspace } from 'vscode';
1+
import { commands, ExtensionContext, extensions, LogOutputChannel, Terminal, Uri, window, workspace } from 'vscode';
22
import { PythonEnvironment, PythonEnvironmentApi, PythonProjectCreator } from './api';
33
import { ensureCorrectVersion } from './common/extVersion';
44
import { registerLogger, traceError, traceInfo } from './common/logging';
@@ -75,21 +75,9 @@ import { registerPyenvFeatures } from './managers/pyenv/main';
7575
async function collectEnvironmentInfo(
7676
context: ExtensionContext,
7777
envManagers: EnvironmentManagers,
78-
projectManager: PythonProjectManager
78+
projectManager: PythonProjectManager,
7979
): Promise<string> {
8080
const info: string[] = [];
81-
82-
// Attempt to set setting of config.python.useEnvironmentsExtension to true
83-
try {
84-
const config = workspace.getConfiguration('python');
85-
await config.update('useEnvironmentsExtension', true, true);
86-
} catch (err) {
87-
traceError(
88-
'Failed to set config.python.useEnvironmentsExtension to true. Please do so manually in your user settings now to ensure the Python environment extension is enabled during upcoming experimentation.',
89-
err,
90-
);
91-
}
92-
9381
try {
9482
// Extension version
9583
const extensionVersion = context.extension?.packageJSON?.version || 'unknown';
@@ -161,6 +149,17 @@ async function collectEnvironmentInfo(
161149
export async function activate(context: ExtensionContext): Promise<PythonEnvironmentApi> {
162150
const start = new StopWatch();
163151

152+
// Attempt to set setting of config.python.useEnvironmentsExtension to true
153+
try {
154+
const config = workspace.getConfiguration('python');
155+
await config.update('useEnvironmentsExtension', true, true);
156+
} catch (err) {
157+
traceError(
158+
'Failed to set config.python.useEnvironmentsExtension to true. Please do so manually in your user settings now to ensure the Python environment extension is enabled during upcoming experimentation.',
159+
err,
160+
);
161+
}
162+
164163
// Logging should be set up before anything else.
165164
const outputChannel: LogOutputChannel = createLogOutputChannel('Python Environments');
166165
context.subscriptions.push(outputChannel, registerLogger(outputChannel));
@@ -376,11 +375,11 @@ export async function activate(context: ExtensionContext): Promise<PythonEnviron
376375
commands.registerCommand('python-envs.reportIssue', async () => {
377376
try {
378377
const issueData = await collectEnvironmentInfo(context, envManagers, projectManager);
379-
378+
380379
await commands.executeCommand('workbench.action.openIssueReporter', {
381380
extensionId: 'ms-python.vscode-python-envs',
382381
issueTitle: '[Python Environments] ',
383-
issueBody: `<!-- Please describe the issue you're experiencing -->\n\n<!-- The following information was automatically generated -->\n\n<details>\n<summary>Environment Information</summary>\n\n\`\`\`\n${issueData}\n\`\`\`\n\n</details>`
382+
issueBody: `<!-- Please describe the issue you're experiencing -->\n\n<!-- The following information was automatically generated -->\n\n<details>\n<summary>Environment Information</summary>\n\n\`\`\`\n${issueData}\n\`\`\`\n\n</details>`,
384383
});
385384
} catch (error) {
386385
window.showErrorMessage(`Failed to open issue reporter: ${error}`);

0 commit comments

Comments
 (0)