Skip to content

Multi-workspace doesn't display correct python interpreter if a file that's open is different from the root #6282

Closed

Description

@rchiodo

Steps to reproduce:

  1. Open multi workspace
  2. Open two files from two different folders
  3. Set python interpreter to be different for each
  4. Close workspace
  5. Reopen

One of the files will show the wrong interpreter (might have to switch which one is active by default to get it to repro)

Activity

  1. ghost added
    triage-neededNeeds assignment to the proper sub-team
    on Jun 21, 2019
  2. ghost removed
    triage-neededNeeds assignment to the proper sub-team
    on Jun 24, 2019
  3. karrtikr commented on Jun 28, 2019

    @karrtikr

    Bug is in line 158 of extension.ts .

        interpreterManager.refresh(workspaceService.hasWorkspaceFolders ? workspaceService.workspaceFolders![0].uri : undefined)
            .catch(ex => console.error('Python Extension: interpreterManager.refresh', ex));
    

    When the workspace is reopened, the extension is told to always use the first workspace folder workspaceService.workspaceFolders![0].uri to refresh interpreters instead of using the "Active resource" to get the workspace folder.

    The following code in activationManager.ts provides that.

        private getActiveResource(): Resource {
            if (this.documentManager.activeTextEditor && !this.documentManager.activeTextEditor.document.isUntitled) {
                return this.documentManager.activeTextEditor.document.uri;
            }
            return Array.isArray(this.workspaceService.workspaceFolders) && workspace.workspaceFolders!.length > 0
                ? workspace.workspaceFolders![0].uri
                : undefined;
        }
    
  4. removed their assignment
    on Jun 28, 2019
  5. kimadeline commented on Sep 28, 2019

    @kimadeline

    ✅ Works now:

    first venv (opened by default) second venv third venv
    image image image
  6. locked as resolved and limited conversation to collaborators on Oct 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugIssue identified by VS Code Team member as probable bug

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions