fix: expand ~ in python.venvFolders entries - #1828
Open
Alexandre Kohler (kwy404) wants to merge 1 commit into
Open
Alexandre Kohler (kwy404) wants to merge 1 commit into
Alexandre Kohler (kwy404) wants to merge 1 commit into
Conversation
getPythonSettingAndUntildify only expanded string settings, so python.venvFolders entries such as ~/envs were sent to PET unchanged and those folders were never searched. Expand each array entry the same way python-envs.globalSearchPaths entries are expanded.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
python.venvFoldersentries that start with~are never searched. The settings reference lists~/.virtualenvsas an example value for this setting and says it is merged withpython-envs.globalSearchPaths.getPythonSettingAndUntildifyonly expands~when the setting value is a string. For arrays it returns the value unchanged, so an entry like~/envsreaches PET as the literal path~/envs. PET does not expand~there, so the folder is skipped. The same~/envsworks inpython-envs.globalSearchPaths, because those entries go throughuntildifyArray.The existing unit test noted this ("only untildifies strings, not array items") and passed a pre-expanded path to work around it.
Fix
Expand each entry when the setting value is an array. This covers the three places in
nativePythonFinder.tsthat readvenvFolders: the configure request (getAllExtraSearchPaths), targeted refreshes (getRefreshOptions) and the JSON CLI fallback.Tests
Legacy paths with untildify supportinnativePythonFinder.getAllExtraSearchPaths.unit.test.tsto pass~/conda/envsinvenvFoldersinstead of a pre-expanded path, and removed the note. It fails without the fix (~/conda/envsis returned as is) and passes with it.npm run unittest(Windows, Node 24): 2429 passing, 4 pending.npm run lint,npm run compile-testsandnpm run compilepass.