Skip to content

Commit 3761deb

Browse files
authored
If settings contains an {invalid,unsupported} python version, properly clear it from settings (#155)
* If settings contains an {invalid,unsupported} python version, properly clear it from settings
1 parent d6a4a1a commit 3761deb

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/utils/pythonHelper.mts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ export default async function findPython(): Promise<string | undefined> {
6565
"python path or it is not supported:",
6666
version
6767
);
68-
// TODO: clear python path from settings
68+
// if version is not supported, clear the path
69+
await Settings.getInstance()?.updateGlobal(
70+
SettingsKey.python3Path,
71+
undefined
72+
);
6973
}
7074
} catch (error) {
7175
Logger.warn(
@@ -75,6 +79,18 @@ export default async function findPython(): Promise<string | undefined> {
7579
);
7680
}
7781
}
82+
// if path does not exist, clear it
83+
else {
84+
Logger.warn(
85+
LoggerSource.pythonHelper,
86+
"Python path set in user settings does not exist:",
87+
pythonPath
88+
);
89+
await Settings.getInstance()?.updateGlobal(
90+
SettingsKey.python3Path,
91+
undefined
92+
);
93+
}
7894
}
7995

8096
// Check python extension for any python environments with version >= 3.9

0 commit comments

Comments
 (0)