Skip to content

Commit 46fb826

Browse files
author
Kartik Raj
authored
Ensure selected interpreter doesn't change when the extension is loading when in experiment (#16391)
* Ensure configuration service is ready for use before using it * Add news entry
1 parent 245aed0 commit 46fb826

File tree

6 files changed

+7
-3
lines changed

6 files changed

+7
-3
lines changed

news/2 Fixes/16291.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Ensure selected interpreter doesn't change when the extension is starting up and in experiment.

src/client/common/configSettings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ export class PythonSettings implements IPythonSettings {
619619
}
620620
}
621621

622-
protected initialize(): void {
622+
public initialize(): void {
623623
const onDidChange = () => {
624624
const currentConfig = this.workspace.getConfiguration('python', this.workspaceRoot);
625625
this.update(currentConfig);

src/client/common/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ export interface IPythonSettings {
205205
readonly logging: ILoggingSettings;
206206
readonly useIsolation: boolean;
207207
readonly tensorBoard: ITensorBoardSettings | undefined;
208+
initialize(): void;
208209
}
209210

210211
export interface ITensorBoardSettings {

src/client/extensionActivation.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ async function activateLegacy(ext: ExtensionState): Promise<ActivationResult> {
175175
const manager = serviceContainer.get<IExtensionActivationManager>(IExtensionActivationManager);
176176
context.subscriptions.push(manager);
177177

178+
// Settings are dependent on Experiment service, so we need to initialize it after experiments are activated.
179+
serviceContainer.get<IConfigurationService>(IConfigurationService).getSettings().initialize();
178180
await interpreterManager
179181
.refresh(workspaceService.hasWorkspaceFolders ? workspaceService.workspaceFolders![0].uri : undefined)
180182
.catch((ex) => traceError('Python Extension: interpreterManager.refresh', ex));

src/test/common/configSettings/configSettings.pythonPath.unit.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ suite('Python Settings - pythonPath', () => {
2727
protected getPythonExecutable(pythonPath: string) {
2828
return pythonPath;
2929
}
30-
protected initialize() {
30+
public initialize() {
3131
noop();
3232
}
3333
}

src/test/common/configSettings/configSettings.unit.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ suite('Python Settings', async () => {
3333
public update(pythonSettings: WorkspaceConfiguration) {
3434
return super.update(pythonSettings);
3535
}
36-
protected initialize() {
36+
public initialize() {
3737
noop();
3838
}
3939
}

0 commit comments

Comments
 (0)