Skip to content

Projects selector for status bar environment selector no longer allows select for current script nor does its job properly. #1385

@Carbaz

Description

@Carbaz

First to say, for me this is a "no go" issue, as much I like the extension, breaking this VSCode default behaviour completely breaks my way to work with environments.

I think extensions should not break/replace default features, especially big extensions with so much features like this one, at least not without an opt-in/opt-out option.
(Although in this case I like both the new feature and the default one, but if I'm forced to choose, default one, for me, is a must)

VSCODE DEFAULT BEHABIOUR

  • Without the extension clicking on the status bar selected python environment:
    Image

    Opens a dialog that allows to select the interpreter for the current script:
    Image

EXTENSION NEW BEHABIOUR ("Projects Selector")

When a workspace/Folder is open, the issue is not present if no folder/workspace is open, just stand alone scripts, as the "project selector" feature does not appears)

  • But with the extension enabled the dialog forces to select one of the defined "projects":
    Image

    Even when the prompt mentions folders and scripts, there are only the already set projects:
    Image
    In this image I'm missing some folders from workspace which contains scripts (but no environment definitions)
    and some opened scripts that are not even located on the workspace

    Image
    AI Learning is not defined on settings.json as it is the workspace root so that's why it's offered on the selector shown up, but there are more folders with code there.

EXTENSION NEW BEHABIOUR NOT EVEN WORKS

But the issue do not stops there, even on the expected behaviour, having a script opened from a subfolder of one of the defined projects:

  • I.e: agents_engineering/src/app.py and chosing the desired environment for the project on the selector:
    Image
    Image

  • It's not properly applied and pylance cant find, for example, the proper libraries
    Image

  • For contrast, a notebook with same imports and same chosen environment works properly:
    Image
    Image

  • Or disabling the extension and choosing the environment directly without the "project selector":
    Image
    Image
    Image

In Summary

So, in summary, this "project selector" feature not only kills a previous feature:

  • "setting the environment for the current file with independence of projects - environments assignments"

But also do not works properly because

  • Setting the environment for the project in question does not applies that environment for the scripts on its folders tree.

My proposal

First:

Add to the "projects selector" a way to skip it to affect the currently opened script (VSCode default behaviour) even with an opened folder/workspace to preserve original default behaviour with stand alone scripts.

  • This is much better than try to list all folders and scripts.

  • Is already implemented, just need an option to "skip" the new feature on the same dialog.
    (A SKIP button next to the OK one maybe?)

  • The current script may not belong to any defined project or even be on the workspace tree, or it belongs but anyone may want to set another environment for whatever reason.
    So the new feature, which is not bad itself, does not applies and falling back to the default is preferred.

    I.e: I have several centralized pipenv environments with different combinations of dependency versions so I can check incompatibility or missing features fast without affecting projects environment)

    It deserves to mention the default behaviour even works for new non saved files, you can create a new tab, set as python then choose an environment and then make some imports and start using pylance to investigate sources, docs, usage, etc.
    Image

Second:

Fix the new feature, because it makes sense to have it alongside with the projects definitions and so on, but it's not actually working well and even scripts directly on the projects 'root' folder (I checked that too) do not get flagged with the proper environment, at least for pylance, but I think linters are a priority must have/must work feature on any modern IDE.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions