Skip to content

Commit 5caf372

Browse files
authored
Fix for interpreter selection (#14693)
* Fix for interpreter selection * Fix linting errors * Minor tweak to property removal
1 parent 79d6632 commit 5caf372

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

src/client/common/configSettings.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,21 @@ export class PythonSettings implements IPythonSettings {
196196
PythonSettings.pythonSettings.forEach((item) => item && item.dispose());
197197
PythonSettings.pythonSettings.clear();
198198
}
199+
200+
public static toSerializable(settings: IPythonSettings): IPythonSettings {
201+
// tslint:disable-next-line: no-any
202+
const clone: any = {};
203+
const keys = Object.entries(settings);
204+
keys.forEach((e) => {
205+
const [k, v] = e;
206+
if (!k.includes('Manager') && !k.includes('Service') && !k.includes('onDid')) {
207+
clone[k] = v;
208+
}
209+
});
210+
211+
return clone as IPythonSettings;
212+
}
213+
199214
public dispose() {
200215
// tslint:disable-next-line:no-unsafe-any
201216
this.disposables.forEach((disposable) => disposable && disposable.dispose());

src/client/common/startPage/webviewHost.ts

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import * as localize from '../utils/localize';
1515
import { DefaultTheme, Telemetry } from './constants';
1616
import { ICodeCssGenerator, IThemeFinder } from './types';
1717

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

106107
protected async generateExtraSettings(): Promise<IPythonSettings> {
107-
const resource = this.owningResource;
108-
// tslint:disable-next-line: no-any
109-
const prunedSettings = this.configService.getSettings(resource) as any;
110-
111-
// Remove keys that aren't serializable
112-
const keys = Object.keys(prunedSettings);
113-
keys.forEach((k) => {
114-
if (k.includes('Manager') || k.includes('Service') || k.includes('onDid')) {
115-
delete prunedSettings[k];
116-
}
117-
});
118-
return prunedSettings;
108+
const settings = this.configService.getSettings(this.owningResource);
109+
return PythonSettings.toSerializable(settings);
119110
}
120111

121112
protected async sendLocStrings() {

0 commit comments

Comments
 (0)