|
1 | | -import { commands, extensions, ExtensionContext, LogOutputChannel, Terminal, Uri, window, workspace } from 'vscode'; |
| 1 | +import { commands, ExtensionContext, extensions, LogOutputChannel, Terminal, Uri, window, workspace } from 'vscode'; |
2 | 2 | import { PythonEnvironment, PythonEnvironmentApi, PythonProjectCreator } from './api'; |
3 | 3 | import { ensureCorrectVersion } from './common/extVersion'; |
4 | 4 | import { registerLogger, traceError, traceInfo } from './common/logging'; |
@@ -75,21 +75,9 @@ import { registerPyenvFeatures } from './managers/pyenv/main'; |
75 | 75 | async function collectEnvironmentInfo( |
76 | 76 | context: ExtensionContext, |
77 | 77 | envManagers: EnvironmentManagers, |
78 | | - projectManager: PythonProjectManager |
| 78 | + projectManager: PythonProjectManager, |
79 | 79 | ): Promise<string> { |
80 | 80 | 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 | | - |
93 | 81 | try { |
94 | 82 | // Extension version |
95 | 83 | const extensionVersion = context.extension?.packageJSON?.version || 'unknown'; |
@@ -161,6 +149,17 @@ async function collectEnvironmentInfo( |
161 | 149 | export async function activate(context: ExtensionContext): Promise<PythonEnvironmentApi> { |
162 | 150 | const start = new StopWatch(); |
163 | 151 |
|
| 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 | + |
164 | 163 | // Logging should be set up before anything else. |
165 | 164 | const outputChannel: LogOutputChannel = createLogOutputChannel('Python Environments'); |
166 | 165 | context.subscriptions.push(outputChannel, registerLogger(outputChannel)); |
@@ -376,11 +375,11 @@ export async function activate(context: ExtensionContext): Promise<PythonEnviron |
376 | 375 | commands.registerCommand('python-envs.reportIssue', async () => { |
377 | 376 | try { |
378 | 377 | const issueData = await collectEnvironmentInfo(context, envManagers, projectManager); |
379 | | - |
| 378 | + |
380 | 379 | await commands.executeCommand('workbench.action.openIssueReporter', { |
381 | 380 | extensionId: 'ms-python.vscode-python-envs', |
382 | 381 | 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>`, |
384 | 383 | }); |
385 | 384 | } catch (error) { |
386 | 385 | window.showErrorMessage(`Failed to open issue reporter: ${error}`); |
|
0 commit comments