Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Copy link
Copy link
Closed
@karrtikr

Description

@karrtikr
Issue body actions

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 environmentsFeatures relating to handling interpreter environmentsbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bugdebtCovers everything internal: CI, testing, refactoring of the codebase, etc.Covers everything internal: CI, testing, refactoring of the codebase, etc.verifiedVerification succeededVerification succeeded

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.