-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Added FSWatching base class and made related changes #14605
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
Conversation
Codecov Report
@@ Coverage Diff @@
## main #14605 +/- ##
===========================================
- Coverage 64.89% 0.00% -64.90%
===========================================
Files 541 4 -537
Lines 25156 11 -25145
Branches 3545 0 -3545
===========================================
- Hits 16324 0 -16324
+ Misses 8170 11 -8159
+ Partials 662 0 -662
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this, @karrtikr. I think you're on the right track. My main recommendation is that you give FSWatchingLocator
a meaningful purpose. Otherwise I don't think there is anything too major here, though I've noted a few places where I have concerns about correctness.
src/client/pythonEnvironments/discovery/locators/services/globalVirtualEnvronmentLocator.ts
Outdated
Show resolved
Hide resolved
src/client/pythonEnvironments/base/locators/lowLevel/locator.ts
Outdated
Show resolved
Hide resolved
src/client/pythonEnvironments/discovery/locators/services/globalVirtualEnvronmentLocator.ts
Outdated
Show resolved
Hide resolved
src/client/pythonEnvironments/discovery/locators/services/globalVirtualEnvronmentLocator.ts
Outdated
Show resolved
Hide resolved
src/client/pythonEnvironments/discovery/locators/services/windowsStoreLocator.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've left a few relatively minor comments for which I'd appreciate a resolution before this gets merged.
Otherwise, LGTM.
/** | ||
* Location(s) to watch for python binaries. | ||
*/ | ||
private readonly getRoots: () => Promise<string[]> | string, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private readonly getRoots: () => Promise<string[]> | string, | |
private readonly getRoots: () => Promise<string[]> | string[], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually it's getRoot(s)
as explained in the doc. Not every locator has an array of locations they want to search (getWindowsAppsRoot
), some just have a single location, so this is just convenience.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added the string[]
type but not removed string
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If they have a single location then they return a single element array. Returning string
means that the caller always has to check typeof result === 'string'
. So it makes things simpler if we only return Promise<string[]> | string[]
.
(Also note that if you support return string
then the return type should be Promise<string[] | string> | string[] | string
. However, as I said, I don't think the distinction between string[]
and string
adds any value while it increases complexity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returning string means that the caller always has to check typeof result === 'string'
I don't think so.. not sure why you say that. The caller for the "string" case here just passes in
constructor() {
super(
getWindowsStoreAppsRoot,
async () => this.kind,
{ executableBaseGlob: pythonExeGlob },
);
}
While in string[]
case
constructor() {
super(
() => [getWindowsStoreAppsRoot()],
async () => this.kind,
{ executableBaseGlob: pythonExeGlob },
);
}
So adding the string
type decreases complexity for the caller. Note this is just convenience.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see the problem. I was expecting it to return one of the following (and I believe it does):
() => Promise<string[]>
() => string[]
() => string
While you appear to be thinking it is:
() => Promise<string[]>
string[]
string
I'm pretty sure the correct form to also meet your expectations is:
string[] | string | () => Promise<string[]> | string[]
Though parentheses might be needed:
string[] | string | (() => Promise<string[]> | string[])
FWIW, I agree that the string[] | string
types are convenient and should be okay.
src/client/pythonEnvironments/base/locators/lowLevel/fsWatchingLocator.ts
Outdated
Show resolved
Hide resolved
Kudos, SonarCloud Quality Gate passed!
|
* Add FSWatching locator base class * Correct glob pattern to not match python3.2whoa * Add documentation of python binary watcher * Fix lint errors * Update ignore list * Add disposable registry * Modify FSWatching Locator * Code reviews * Use string[] * Remove list disposable getter
* Add FSWatching locator base class * Correct glob pattern to not match python3.2whoa * Add documentation of python binary watcher * Fix lint errors * Update ignore list * Add disposable registry * Modify FSWatching Locator * Code reviews * Use string[] * Remove list disposable getter
* Added FSWatching base class and made related changes (#14605) * Add FSWatching locator base class * Correct glob pattern to not match python3.2whoa * Add documentation of python binary watcher * Fix lint errors * Update ignore list * Add disposable registry * Modify FSWatching Locator * Code reviews * Use string[] * Remove list disposable getter * Fix failing global virtual env watcher tests (#14633) Co-authored-by: Kartik Raj <[email protected]>
* Cherry pick from main (#14644) * Update shipped wheels version (#14615) * Update shipped wheels version * News item * Remove redundant files (#14620) * Add extension dependencies at build time (#14636) * Use Node 12.15 in Insiders and Release GitHub Actions (#14641) * Use Node 12.15 on all Insiders and Release GitHub Actions jobs (#14642) Co-authored-by: Joyce Er <[email protected]> * Cherry pic fixes into release for tests. (#14673) * Added FSWatching base class and made related changes (#14605) * Add FSWatching locator base class * Correct glob pattern to not match python3.2whoa * Add documentation of python binary watcher * Fix lint errors * Update ignore list * Add disposable registry * Modify FSWatching Locator * Code reviews * Use string[] * Remove list disposable getter * Fix failing global virtual env watcher tests (#14633) Co-authored-by: Kartik Raj <[email protected]> * Version, change log and cherrypicks for nov release (#14696) * change log updates * Update gifs * Fix for interpreter selection (#14693) * Fix for interpreter selection * Fix linting errors * Minor tweak to property removal * Cherry pick "Bind function to correct this for workspace syms" (#14743) * Fix #14674: Enable overriding "pythonPath" in the launcher Fix #12462: Update launch.json schema to add "python" and remove "pythonPath" Split the "pythonPath" debug property into "python", "debugAdapterPython", and "debugLauncherPython". Do most debug config validation on fully expanded property values via resolveDebugConfigurationWithSubstitutedVariables(). Add fixups for legacy launch.json with "pythonPath". * Point release change log and version update (#14750) * Point release change log and version update * Fix process picker (#14700) * Workaround VSCode bug for process picker * Fix how we pass in icons to VSCode * update change log with cherry pick Co-authored-by: Kartik Raj <[email protected]> Co-authored-by: Joyce Er <[email protected]> Co-authored-by: Kartik Raj <[email protected]> Co-authored-by: Jake Bailey <[email protected]> Co-authored-by: Pavel Minaev <[email protected]>
Created a work item to move all low level locators separately.