Skip to content

Fix for interpreter selection #14693

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 3 commits into from
Nov 11, 2020
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
28 changes: 27 additions & 1 deletion src/client/common/configSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,21 @@ export class PythonSettings implements IPythonSettings {
PythonSettings.pythonSettings.forEach((item) => item && item.dispose());
PythonSettings.pythonSettings.clear();
}

public static toSerializable(settings: IPythonSettings): IPythonSettings {
// tslint:disable-next-line: no-any
const clone: any = {};
const keys = Object.entries(settings);
keys.forEach((e) => {
const [k, v] = e;
if (!k.includes('Manager') && !k.includes('Service') && !k.includes('onDid')) {
clone[k] = v;
}
});

return clone as IPythonSettings;
}

public dispose() {
// tslint:disable-next-line:no-unsafe-any
this.disposables.forEach((disposable) => disposable && disposable.dispose());
Expand Down Expand Up @@ -681,7 +696,18 @@ function getPythonExecutable(pythonPath: string): string {
}
// Keep python right on top, for backwards compatibility.
// tslint:disable-next-line:variable-name
const KnownPythonExecutables = ['python', 'python4', 'python3.6', 'python3.5', 'python3', 'python2.7', 'python2', 'python3.7', 'python3.8', 'python3.9'];
const KnownPythonExecutables = [
'python',
'python4',
'python3.6',
'python3.5',
'python3',
'python2.7',
'python2',
'python3.7',
'python3.8',
'python3.9'
];

for (let executableName of KnownPythonExecutables) {
// Suffix with 'python' for linux and 'osx', and 'python.exe' for 'windows'.
Expand Down
15 changes: 3 additions & 12 deletions src/client/common/startPage/webviewHost.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import * as localize from '../utils/localize';
import { DefaultTheme, Telemetry } from './constants';
import { ICodeCssGenerator, IThemeFinder } from './types';

import { PythonSettings } from '../configSettings';
import { isTestExecution } from '../constants';
import { IConfigurationService, IDisposable, IPythonSettings, Resource } from '../types';
import { CssMessages, IGetCssRequest, IGetMonacoThemeRequest, SharedMessages } from './messages';
Expand Down Expand Up @@ -104,18 +105,8 @@ export abstract class WebviewHost<IMapping> implements IDisposable {
}

protected async generateExtraSettings(): Promise<IPythonSettings> {
const resource = this.owningResource;
// tslint:disable-next-line: no-any
const prunedSettings = this.configService.getSettings(resource) as any;

// Remove keys that aren't serializable
const keys = Object.keys(prunedSettings);
keys.forEach((k) => {
if (k.includes('Manager') || k.includes('Service') || k.includes('onDid')) {
delete prunedSettings[k];
}
});
return prunedSettings;
const settings = this.configService.getSettings(this.owningResource);
return PythonSettings.toSerializable(settings);
}

protected async sendLocStrings() {
Expand Down