Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add prompt to select virtual environment for the worskpace #4908

Closed
luabud opened this issue Mar 25, 2019 · 6 comments
Closed

Add prompt to select virtual environment for the worskpace #4908

luabud opened this issue Mar 25, 2019 · 6 comments
Assignees
Labels
feature-request Request for new features or functionality

Comments

@luabud
Copy link
Member

luabud commented Mar 25, 2019

If a global interpreter is selected and the extension detects the existence of a new virtual environment in the workspace (e.g. created in the terminal), we could add a prompt asking if the users would like to select it as the interpreter for the workspace.

@ghost ghost added the triage-needed Needs assignment to the proper sub-team label Mar 25, 2019
@DonJayamanne
Copy link

DonJayamanne commented Mar 26, 2019

We should do the same for:

  • pipenv, as Pipenvs are also workspace specific.
  • pyenv (existence of .python-version indicates the usage of pyenv)
    What do you think @luabud ?

@DonJayamanne DonJayamanne added feature-request Request for new features or functionality needs PR labels Mar 26, 2019
@ghost ghost removed triage-needed Needs assignment to the proper sub-team labels Mar 26, 2019
@luabud
Copy link
Member Author

luabud commented Mar 26, 2019

For now we won't do it for pipenv and pyenv

@DonJayamanne
Copy link

DonJayamanne commented Mar 27, 2019

Prescribed solution:

  • When VSC loads if auto selected workspace interpreter != local virtual environment, then display prompt

    • When a new virtual environment is created (attach event handler to IInterpreterWatcher.onDidCreate, then proceed>
    • Check if user has specified interpreter in workspace settings.json.
    • Get a list of workspace virtual environments using ioc.get<IInterpreterLocatorService>(IInterpreterLocatorService, WORKSPACE_VIRTUAL_ENV_SERVICE).getInterpreters(...)
    • If there are items in the above list, then this means we have local workspace interpreters
    • Then display prompt to select the above virtual env (note: use IInterpreterHelper.getBestInterpreter to get the interpreter to use)
    • Add a do not show again button that will never show it for all workspaces
  • Use const notificationPromptEnabled = this.persistentStateFactory.createWorkspace...PersistentState(deprecatedInfo....., true);

  • Do not show again only applies to the current workpace.

@DonJayamanne
Copy link

DonJayamanne commented Mar 27, 2019

@luabud

  • Do we need a setting that will disable this prompt in every workspace folder
  • E.g. assume I keep creating virtual envs in workspace folders, & I always select No for all folders. Do we then need a option so the user turn this prompt off completely.

@luabud
Copy link
Member Author

luabud commented Apr 26, 2019

Can we reopen this so we can remove the condition where this prompt appears only if there isn't an interpreter path set in the settings.json file?

@DonJayamanne
Copy link

DonJayamanne commented Apr 26, 2019

@luabud please create a new issue instead, helps avoid confusions as well (specially with old comments).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

4 participants