Skip to content

Commit

Permalink
If settings contains an {invalid,unsupported} python version, properl…
Browse files Browse the repository at this point in the history
…y clear it from settings (#155)

* If settings contains an {invalid,unsupported} python version, properly clear it from settings
  • Loading branch information
SConaway authored Jan 23, 2025
1 parent d6a4a1a commit 3761deb
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/utils/pythonHelper.mts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ export default async function findPython(): Promise<string | undefined> {
"python path or it is not supported:",
version
);
// TODO: clear python path from settings
// if version is not supported, clear the path
await Settings.getInstance()?.updateGlobal(
SettingsKey.python3Path,
undefined
);
}
} catch (error) {
Logger.warn(
Expand All @@ -75,6 +79,18 @@ export default async function findPython(): Promise<string | undefined> {
);
}
}
// if path does not exist, clear it
else {
Logger.warn(
LoggerSource.pythonHelper,
"Python path set in user settings does not exist:",
pythonPath
);
await Settings.getInstance()?.updateGlobal(
SettingsKey.python3Path,
undefined
);
}
}

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

0 comments on commit 3761deb

Please sign in to comment.