@@ -116,12 +116,17 @@ function convertEnvInfo(info: PythonEnvInfo): PythonEnvironment {
116
116
class ComponentAdapter implements IComponentAdapter {
117
117
constructor (
118
118
// The adapter only wraps one thing: the component API.
119
- private readonly api : PythonEnvironments
119
+ private readonly api : PythonEnvironments ,
120
+ // For now we effecitvely disable the component.
121
+ private readonly enabled = false
120
122
) { }
121
123
122
124
// IInterpreterHelper
123
125
124
126
public async getInterpreterInformation ( pythonPath : string ) : Promise < undefined | Partial < PythonEnvironment > > {
127
+ if ( ! this . enabled ) {
128
+ return undefined ;
129
+ }
125
130
const env = await this . api . resolveEnv ( pythonPath ) ;
126
131
if ( env === undefined ) {
127
132
return undefined ;
@@ -130,6 +135,9 @@ class ComponentAdapter implements IComponentAdapter {
130
135
}
131
136
132
137
public async isMacDefaultPythonPath ( pythonPath : string ) : Promise < boolean | undefined > {
138
+ if ( ! this . enabled ) {
139
+ return undefined ;
140
+ }
133
141
const env = await this . api . resolveEnv ( pythonPath ) ;
134
142
if ( env === undefined ) {
135
143
return undefined ;
@@ -139,7 +147,10 @@ class ComponentAdapter implements IComponentAdapter {
139
147
140
148
// IInterpreterService
141
149
142
- public get hasInterpreters ( ) : Promise < boolean > {
150
+ public get hasInterpreters ( ) : Promise < boolean > | undefined {
151
+ if ( ! this . enabled ) {
152
+ return undefined ;
153
+ }
143
154
const iterator = this . api . iterEnvs ( ) ;
144
155
return iterator . next ( ) . then ( ( res ) => {
145
156
return ! res . done ;
@@ -149,6 +160,9 @@ class ComponentAdapter implements IComponentAdapter {
149
160
//public async getInterpreters(_resource?: vscode.Uri, _options?: GetInterpreterOptions): Promise<PythonEnvironment[]>;
150
161
151
162
public async getInterpreterDetails ( pythonPath : string , _resource ?: vscode . Uri ) : Promise < undefined | PythonEnvironment > {
163
+ if ( ! this . enabled ) {
164
+ return undefined ;
165
+ }
152
166
const env = await this . api . resolveEnv ( pythonPath ) ;
153
167
if ( env === undefined ) {
154
168
return undefined ;
@@ -159,6 +173,9 @@ class ComponentAdapter implements IComponentAdapter {
159
173
// ICondaService
160
174
161
175
public async isCondaEnvironment ( interpreterPath : string ) : Promise < boolean | undefined > {
176
+ if ( ! this . enabled ) {
177
+ return undefined ;
178
+ }
162
179
const env = await this . api . resolveEnv ( interpreterPath ) ;
163
180
if ( env === undefined ) {
164
181
return undefined ;
@@ -167,6 +184,9 @@ class ComponentAdapter implements IComponentAdapter {
167
184
}
168
185
169
186
public async getCondaEnvironment ( interpreterPath : string ) : Promise < CondaEnvironmentInfo | undefined > {
187
+ if ( ! this . enabled ) {
188
+ return undefined ;
189
+ }
170
190
const env = await this . api . resolveEnv ( interpreterPath ) ;
171
191
if ( env === undefined ) {
172
192
return undefined ;
@@ -184,6 +204,9 @@ class ComponentAdapter implements IComponentAdapter {
184
204
// IWindowsStoreInterpreter
185
205
186
206
public async isWindowsStoreInterpreter ( pythonPath : string ) : Promise < boolean | undefined > {
207
+ if ( ! this . enabled ) {
208
+ return undefined ;
209
+ }
187
210
const env = await this . api . resolveEnv ( pythonPath ) ;
188
211
if ( env === undefined ) {
189
212
return undefined ;
@@ -196,7 +219,10 @@ class ComponentAdapter implements IComponentAdapter {
196
219
public async getInterpreters (
197
220
resource ?: vscode . Uri ,
198
221
_options ?: GetInterpreterLocatorOptions
199
- ) : Promise < PythonEnvironment [ ] > {
222
+ ) : Promise < PythonEnvironment [ ] | undefined > {
223
+ if ( ! this . enabled ) {
224
+ return undefined ;
225
+ }
200
226
// We ignore the options:
201
227
//{
202
228
// ignoreCache?: boolean
0 commit comments