Skip to content

Commit

Permalink
Support category being undefined (#23745)
Browse files Browse the repository at this point in the history
  • Loading branch information
DonJayamanne authored Jul 4, 2024
1 parent 01c3f16 commit a5c42b2
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export interface NativeEnvManagerInfo {
export interface NativeGlobalPythonFinder extends Disposable {

This comment has been minimized.

Copy link
@realg4life121212
resolve(executable: string): Promise<NativeEnvInfo>;
refresh(): AsyncIterable<NativeEnvInfo>;
categoryToKind(category: string): PythonEnvKind;
categoryToKind(category?: string): PythonEnvKind;
}

interface NativeLog {
Expand Down Expand Up @@ -79,7 +79,10 @@ class NativeGlobalPythonFinderImpl extends DisposableBase implements NativeGloba
return environment;
}

categoryToKind(category: string): PythonEnvKind {
categoryToKind(category?: string): PythonEnvKind {
if (!category) {
return PythonEnvKind.Unknown;
}
switch (category.toLowerCase()) {
case 'conda':
return PythonEnvKind.Conda;
Expand Down Expand Up @@ -109,8 +112,6 @@ class NativeGlobalPythonFinderImpl extends DisposableBase implements NativeGloba
return PythonEnvKind.VirtualEnvWrapper;
case 'windowsstore':
return PythonEnvKind.MicrosoftStore;
case 'unknown':
return PythonEnvKind.Unknown;
default: {
this.outputChannel.info(`Unknown Python Environment category '${category}' from Native Locator.`);
return PythonEnvKind.Unknown;
Expand Down

0 comments on commit a5c42b2

Please sign in to comment.