Skip to content

Commit caadaea

Browse files
author
Kartik Raj
committed
Update proposed APIs
1 parent afeedd8 commit caadaea

File tree

6 files changed

+32
-28
lines changed

6 files changed

+32
-28
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"publisher": "ms-python",
2020
"enabledApiProposals": [
2121
"quickPickSortByLabel",
22+
"envShellEvent",
2223
"testObserver"
2324
],
2425
"author": {

src/client/common/application/applicationEnvironment.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,19 +70,15 @@ export class ApplicationEnvironment implements IApplicationEnvironment {
7070
public get extensionName(): string {
7171
return this.packageJson.displayName;
7272
}
73-
/**
74-
* At the time of writing this API, the vscode.env.shell isn't officially released in stable version of VS Code.
75-
* Using this in stable version seems to throw errors in VSC with messages being displayed to the user about use of
76-
* unstable API.
77-
* Solution - log and suppress the errors.
78-
* @readonly
79-
* @type {(string)}
80-
* @memberof ApplicationEnvironment
81-
*/
73+
8274
public get shell(): string {
8375
return vscode.env.shell;
8476
}
8577

78+
public get onDidChangeShell(): vscode.Event<string> {
79+
return vscode.env.onDidChangeShell;
80+
}
81+
8682
public get packageJson(): any {
8783
return require('../../../../package.json');
8884
}

src/client/common/application/types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,6 +1048,10 @@ export interface IApplicationEnvironment {
10481048
* @memberof IApplicationShell
10491049
*/
10501050
readonly shell: string;
1051+
/**
1052+
* An {@link Event} which fires when the default shell changes.
1053+
*/
1054+
readonly onDidChangeShell: Event<string>;
10511055
/**
10521056
* Gets the vscode channel (whether 'insiders' or 'stable').
10531057
*/

src/client/interpreter/activation/service.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,11 @@ export class EnvironmentActivationService
163163
this,
164164
this.disposables,
165165
);
166+
this.applicationEnvironment.onDidChangeShell(
167+
() => this.applyCollectionForSelectedShell(),
168+
this,
169+
this.disposables,
170+
);
166171

167172
this.initializeCollection(undefined).ignoreErrors();
168173
}
@@ -248,7 +253,7 @@ export class EnvironmentActivationService
248253
args[i] = arg.toCommandArgumentForPythonExt();
249254
});
250255
if (interpreter?.envType === EnvironmentType.Conda) {
251-
const conda = await Conda.getConda();
256+
const conda = await Conda.getConda(shell);
252257
const pythonArgv = await conda?.getRunPythonArgs({
253258
name: interpreter.envName,
254259
prefix: interpreter.envPath ?? '',
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
declare module 'vscode' {
7+
8+
// See https://github.com/microsoft/vscode/issues/160694
9+
export namespace env {
10+
11+
/**
12+
* An {@link Event} which fires when the default shell changes.
13+
*/
14+
export const onDidChangeShell: Event<string>;
15+
}
16+
}

types/vscode.proposed.testObserver.d.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -68,24 +68,6 @@ declare module 'vscode' {
6868
readonly removed: ReadonlyArray<TestItem>;
6969
}
7070

71-
/**
72-
* A test item is an item shown in the "test explorer" view. It encompasses
73-
* both a suite and a test, since they have almost or identical capabilities.
74-
*/
75-
export interface TestItem {
76-
/**
77-
* Marks the test as outdated. This can happen as a result of file changes,
78-
* for example. In "auto run" mode, tests that are outdated will be
79-
* automatically rerun after a short delay. Invoking this on a
80-
* test with children will mark the entire subtree as outdated.
81-
*
82-
* Extensions should generally not override this method.
83-
*/
84-
// todo@api still unsure about this
85-
invalidateResults(): void;
86-
}
87-
88-
8971
/**
9072
* TestResults can be provided to the editor in {@link tests.publishTestResult},
9173
* or read from it in {@link tests.testResults}.

0 commit comments

Comments
 (0)