-
Notifications
You must be signed in to change notification settings - Fork 41
Description
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:

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

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":

Even when the prompt mentions folders and scripts, there are only the already set projects:

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
AI Learningis not defined onsettings.jsonas 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.pyand chosing the desired environment for the project on the selector:


-
It's not properly applied and
pylancecant find, for example, the proper libraries

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


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



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
pylanceto investigate sources, docs, usage, etc.

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.