-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add PythonEnvInfo-related helpers. #14051
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
Changes from all commits
1126834
0d22681
4468e74
94137c8
eea499b
7a2fdfc
ca2ec73
af6c7c5
e737607
51c6dee
2ecd537
9cd6c7d
6b50973
ad8f195
2b70a1c
7b19538
eb746f9
20c46da
9d970f5
ce53e54
3d85fa7
e47322b
f97bb31
1edb76d
fd5e37b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,17 +15,18 @@ import { | |
* A single update to a previously provided Python env object. | ||
*/ | ||
export type PythonEnvUpdatedEvent = { | ||
/** | ||
* The iteration index of The env info that was previously provided. | ||
*/ | ||
index: number; | ||
/** | ||
* The env info that was previously provided. | ||
* | ||
* If the event comes from `IPythonEnvsIterator.onUpdated` then | ||
* `old` was previously yielded during iteration. | ||
*/ | ||
old: PythonEnvInfo; | ||
old?: PythonEnvInfo; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FWIW I don't think we neeed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The only reason to keep it is because the object may not be the same as the one at the index. The one at the index is the one to use as "old", but it can be helpful to have the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Maybe I don't understand your point, but we're using Also, in the resolver, I found out that it's a bit hard to maintain the exact "old" environment to be used for firing in certain circumstances.
Yaa maybe, although if that's the only reason I think we should remove it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It could certainly be used for debugging. However, I can imagine it being used for other things too. |
||
/** | ||
* The env info that replaces the old info. | ||
*/ | ||
new: PythonEnvInfo; | ||
update: PythonEnvInfo; | ||
}; | ||
|
||
/** | ||
|
@@ -73,23 +74,39 @@ export const NOOP_ITERATOR: IPythonEnvsIterator = iterEmpty<PythonEnvInfo>(); | |
* This is directly correlated with the `BasicPythonEnvsChangedEvent` | ||
* emitted by watchers. | ||
* | ||
* @prop kinds - if provided, results should be limited to these env kinds | ||
* @prop kinds - if provided, results should be limited to these env | ||
* kinds; if not provided, the kind of each evnironment | ||
* is not considered when filtering | ||
*/ | ||
export type BasicPythonLocatorQuery = { | ||
kinds?: PythonEnvKind[]; | ||
}; | ||
|
||
/** | ||
* The portion of a query related to env search locations. | ||
*/ | ||
export type SearchLocations = { | ||
/** | ||
* The locations under which to look for environments. | ||
*/ | ||
roots: Uri[]; | ||
/** | ||
* If true, also look for environments that do not have a search location. | ||
*/ | ||
includeNonRooted?: boolean; | ||
}; | ||
|
||
/** | ||
* The full set of possible info to send to a locator when requesting environments. | ||
* | ||
* This is directly correlated with the `PythonEnvsChangedEvent` | ||
* emitted by watchers. | ||
* | ||
* @prop - searchLocations - if provided, results should be limited to | ||
* within these locations | ||
*/ | ||
export type PythonLocatorQuery = BasicPythonLocatorQuery & { | ||
searchLocations?: Uri[]; | ||
/** | ||
* If provided, results should be limited to within these locations. | ||
*/ | ||
searchLocations?: SearchLocations; | ||
}; | ||
|
||
type QueryForEvent<E> = E extends PythonEnvsChangedEvent ? PythonLocatorQuery : BasicPythonLocatorQuery; | ||
|
Uh oh!
There was an error while loading. Please reload this page.