File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed
src/client/pythonEnvironments/base Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change 3
3
4
4
import { chain } from '../../common/utils/async' ;
5
5
import { PythonEnvInfo } from './info' ;
6
- import { ILocator , PythonEnvsIterator , PythonLocatorQuery } from './locator' ;
7
- import { PythonEnvsWatchers } from './watchers' ;
6
+ import { ILocator , NOOP_ITERATOR , PythonEnvsIterator , PythonLocatorQuery } from './locator' ;
7
+ import { DisableableEnvsWatcher , PythonEnvsWatchers } from './watchers' ;
8
8
9
9
/**
10
10
* A wrapper around a set of locators.
@@ -24,3 +24,22 @@ export class Locators extends PythonEnvsWatchers {
24
24
return chain < PythonEnvInfo > ( iterators ) ;
25
25
}
26
26
}
27
+
28
+ /**
29
+ * A locator wrapper that can be disabled.
30
+ */
31
+ export class DisableableLocator extends DisableableEnvsWatcher {
32
+ constructor (
33
+ // To wrapp more than one use `Locators`.
34
+ private readonly locator : ILocator
35
+ ) {
36
+ super ( locator ) ;
37
+ }
38
+
39
+ public iterEnvs ( query ?: PythonLocatorQuery ) : PythonEnvsIterator {
40
+ if ( ! this . isEnabled ) {
41
+ return NOOP_ITERATOR ;
42
+ }
43
+ return this . locator . iterEnvs ( query ) ;
44
+ }
45
+ }
You can’t perform that action at this time.
0 commit comments