Skip to content

Ensure selected interpreter doesn't change when the extension is loading when in experiment #16391

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/2 Fixes/16291.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Ensure selected interpreter doesn't change when the extension is starting up and in experiment.
2 changes: 1 addition & 1 deletion src/client/common/configSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ export class PythonSettings implements IPythonSettings {
}
}

protected initialize(): void {
public initialize(): void {
const onDidChange = () => {
const currentConfig = this.workspace.getConfiguration('python', this.workspaceRoot);
this.update(currentConfig);
Expand Down
1 change: 1 addition & 0 deletions src/client/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ export interface IPythonSettings {
readonly logging: ILoggingSettings;
readonly useIsolation: boolean;
readonly tensorBoard: ITensorBoardSettings | undefined;
initialize(): void;
}

export interface ITensorBoardSettings {
Expand Down
2 changes: 2 additions & 0 deletions src/client/extensionActivation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ async function activateLegacy(ext: ExtensionState): Promise<ActivationResult> {
const manager = serviceContainer.get<IExtensionActivationManager>(IExtensionActivationManager);
context.subscriptions.push(manager);

// Settings are dependent on Experiment service, so we need to initialize it after experiments are activated.
serviceContainer.get<IConfigurationService>(IConfigurationService).getSettings().initialize();
await interpreterManager
.refresh(workspaceService.hasWorkspaceFolders ? workspaceService.workspaceFolders![0].uri : undefined)
.catch((ex) => traceError('Python Extension: interpreterManager.refresh', ex));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ suite('Python Settings - pythonPath', () => {
protected getPythonExecutable(pythonPath: string) {
return pythonPath;
}
protected initialize() {
public initialize() {
noop();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/common/configSettings/configSettings.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ suite('Python Settings', async () => {
public update(pythonSettings: WorkspaceConfiguration) {
return super.update(pythonSettings);
}
protected initialize() {
public initialize() {
noop();
}
}
Expand Down