Skip to content

Remove old code for folder support in interpreter path settings #12452

Closed
@karrtikr

Description

@karrtikr

This check is done to ensure if entered interpreter path is valid, and if so, the path is returned. I don't see the point of these checks, as we shouldn't support entering interpreter paths this way.

Variable 'pythonPath' refers to the path user entered

const KnownPythonExecutables = ['python', 'python4', 'python3.6', 'python3.5', 'python3', 'python2.7', 'python2'];
for (let executableName of KnownPythonExecutables) {
// Suffix with 'python' for linux and 'osx', and 'python.exe' for 'windows'.
if (IS_WINDOWS) {
executableName = `${executableName}.exe`;
if (isValidPythonPath(path.join(pythonPath, executableName))) {
return path.join(pythonPath, executableName);
}
if (isValidPythonPath(path.join(pythonPath, 'scripts', executableName))) {
return path.join(pythonPath, 'scripts', executableName);
}
} else {
if (isValidPythonPath(path.join(pythonPath, executableName))) {
return path.join(pythonPath, executableName);
}
if (isValidPythonPath(path.join(pythonPath, 'bin', executableName))) {
return path.join(pythonPath, 'bin', executableName);
}
}
}
return pythonPath;

Also, the first check when ensuring if interpreter path is valid is we should be checking if the entered path exists, which we're not doing.
This leads to us launching 14 exec commands <python> -c '1234' everytime a user enters an invalid path - leading to extension consuming too much CPU.

cc @DonJayamanne @karthiknadig

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-environmentsFeatures relating to handling interpreter environmentsbugIssue identified by VS Code Team member as probable bugdebtCovers everything internal: CI, testing, refactoring of the codebase, etc.verifiedVerification succeeded

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions