Skip to content

Include PYTHONPATH into searchPaths for the new analysis engine #1327

Closed

Description

The following code needs to be modified to use the PYTHONPATH environment variable:

        let searchPaths = interpreterData.searchPaths;
        const settings = this.configuration.getSettings();
        if (settings.autoComplete) {
            const extraPaths = settings.autoComplete.extraPaths;
            if (extraPaths && extraPaths.length > 0) {
                searchPaths = `${searchPaths};${extraPaths.join(';')}`;
            }
        }
        // tslint:disable-next-line:no-string-literal
        properties['SearchPaths'] = searchPaths;

We need to use the following code to get the value for PYTHONPATH as this will merge PYTHONPATH from numerous sources (one of which is the environments file (.env) defined in settings.json):

const envProvider = serviceContainer.get<IEnvironmentVariablesProvider>(IEnvironmentVariablesProvider);
const pythonPath = (await envProvider.getEnvironmentVariables(resource)).PYTHONPATH;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-intellisenseLSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc.bugIssue identified by VS Code Team member as probable bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions