Skip to content

Commit a4a4dab

Browse files
Copiloteleanorjboyd
andcommitted
Fix code review issues: improve Open Settings action and error handling
Co-authored-by: eleanorjboyd <26030610+eleanorjboyd@users.noreply.github.com>
1 parent e07b89c commit a4a4dab

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

src/features/projectManager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export class PythonProjectManagerImpl implements PythonProjectManager {
3434

3535
// Validate pythonProjects settings on initialization
3636
validateAndNotifyPythonProjectsSettings().catch(() => {
37-
// Error is already logged in the validation function
37+
// Error logging handled in validation function
3838
});
3939

4040
this.disposables.push(
@@ -54,7 +54,7 @@ export class PythonProjectManagerImpl implements PythonProjectManager {
5454
// Validate settings when pythonProjects configuration changes
5555
if (e.affectsConfiguration('python-envs.pythonProjects')) {
5656
validateAndNotifyPythonProjectsSettings().catch(() => {
57-
// Error is already logged in the validation function
57+
// Error logging handled in validation function
5858
});
5959
}
6060
}

src/features/settings/settingsValidation.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4-
import { ConfigurationTarget, l10n, Uri, workspace } from 'vscode';
4+
import { commands, ConfigurationTarget, l10n, Uri, workspace } from 'vscode';
55
import { traceError, traceWarn } from '../../common/logging';
66
import { getGlobalPersistentState } from '../../common/persistentState';
77
import { showWarningMessage } from '../../common/window.apis';
@@ -160,10 +160,8 @@ export async function notifyInvalidPythonProjectsSettings(invalidEntries: Invali
160160
await showWarningMessage(l10n.t('Failed to remove invalid entries. Please check the logs for details.'));
161161
}
162162
} else if (choice === openSettingsOption) {
163-
// Open settings for the user to manually fix
164-
await workspace
165-
.getConfiguration('python-envs')
166-
.update('pythonProjects', undefined, ConfigurationTarget.WorkspaceFolder, false);
163+
// Open settings UI to the pythonProjects setting
164+
await commands.executeCommand('workbench.action.openSettings', '@ext:ms-python.vscode-python-envs pythonProjects');
167165
} else if (choice === dontShowOption) {
168166
// Save preference to not show again
169167
await persistentState.set(DONT_SHOW_INVALID_SETTINGS_KEY, true);

0 commit comments

Comments
 (0)