-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Resolved Environments have an invalid type for workspaceFolder #20104
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
Comments
@DonJayamanne this is my proposal to address this issue. The Cause: The Interim Solution:
Long term solution: |
For #20104 The Cause: The `workspaceFolder` field is set using an internal field `searchLocation`. `searchLocation` is what gets saved to Memento as `Uri`. when we read it back it looks like this:  Interim Solution: * Reading (broken case): Since there are already existing cases where this is broken. The surgical fix is to read bad value, extract the `scheme` and `path`, use that to re-create the URI. * Reading/Writing (new case): Make sure that we convert Uri to string before writing and parse back the Uri when reading. Long term solution: Object written to memento needs to be serialized using a custom serializer that validates all values before writing and after reading.
What are some verification steps for this issue? |
I think if you're able to see all local environments this issue can be considered as verified 👍 Don can confirm. |
We are no longer using the property |
When using the Python Extension API, the resolve Enviornments have an incorrect type for the property
workspaceFolder
.workspaceFolder
is not a Uri object, but a regular Object.I've looked at the code, the problem is the fact that enviornments are serialized into JSON and then restored back again when storing from/into the memento.
Note: Objects with Uris cannot be stored in Memento nor can they be serialized into JSON and then parsed back
https://github.com/DonJayamanne/pythonVSCode/blob/main/src/client/pythonEnvironments/base/locators/composite/envsCollectionCache.ts#L186
This is causing issues in the Python extension and new environments are not geting picked up because we're now filtering these enviornments based on the workspace Folder, however since the worksapceFolder isn't a Uri object the conditions fail and as a result new Python virtual envoirnments end up getting excluded in Jupyter extension.
The text was updated successfully, but these errors were encountered: