@@ -44,7 +44,10 @@ export class PoetryManager implements EnvironmentManager, Disposable {
4444 private readonly _onDidChangeEnvironments = new EventEmitter < DidChangeEnvironmentsEventArgs > ( ) ;
4545 public readonly onDidChangeEnvironments = this . _onDidChangeEnvironments . event ;
4646
47- constructor ( private readonly nativeFinder : NativePythonFinder , private readonly api : PythonEnvironmentApi ) {
47+ constructor (
48+ private readonly nativeFinder : NativePythonFinder ,
49+ private readonly api : PythonEnvironmentApi ,
50+ ) {
4851 this . name = 'poetry' ;
4952 this . displayName = 'Poetry' ;
5053 this . preferredPackageManagerId = 'ms-python.python:poetry' ;
@@ -71,21 +74,24 @@ export class PoetryManager implements EnvironmentManager, Disposable {
7174
7275 this . _initialized = createDeferred ( ) ;
7376
74- await withProgress (
75- {
76- location : ProgressLocation . Window ,
77- title : PoetryStrings . poetryDiscovering ,
78- } ,
79- async ( ) => {
80- this . collection = await refreshPoetry ( false , this . nativeFinder , this . api , this ) ;
81- await this . loadEnvMap ( ) ;
82-
83- this . _onDidChangeEnvironments . fire (
84- this . collection . map ( ( e ) => ( { environment : e , kind : EnvironmentChangeKind . add } ) ) ,
85- ) ;
86- } ,
87- ) ;
88- this . _initialized . resolve ( ) ;
77+ try {
78+ await withProgress (
79+ {
80+ location : ProgressLocation . Window ,
81+ title : PoetryStrings . poetryDiscovering ,
82+ } ,
83+ async ( ) => {
84+ this . collection = await refreshPoetry ( false , this . nativeFinder , this . api , this ) ;
85+ await this . loadEnvMap ( ) ;
86+
87+ this . _onDidChangeEnvironments . fire (
88+ this . collection . map ( ( e ) => ( { environment : e , kind : EnvironmentChangeKind . add } ) ) ,
89+ ) ;
90+ } ,
91+ ) ;
92+ } finally {
93+ this . _initialized . resolve ( ) ;
94+ }
8995 }
9096
9197 async getEnvironments ( scope : GetEnvironmentsScope ) : Promise < PythonEnvironment [ ] > {
0 commit comments