@@ -54,20 +54,21 @@ class WorkspaceContext {
5454 }
5555
5656 async loadWorkspace ( ) {
57- this . #catalogs = undefined
57+ this . #catalogs = Promise . withResolvers ( )
5858 this . packageManager = await getPackageManager ( this . folder . uri )
5959
6060 logger . info ( `[workspace-context] detect package manager: ${ this . packageManager } ` )
6161
6262 if ( this . packageManager !== 'npm' ) {
63- this . #catalogs = Promise . withResolvers ( )
6463 const workspaceFilename = workspaceFileMapping [ this . packageManager ]
6564 this . workspaceFileUri = Uri . joinPath ( this . folder . uri , workspaceFilename )
6665 this . #catalogs. resolve (
6766 await accessOk ( this . workspaceFileUri )
6867 ? ( await this . loadWorkspaceCatalogInfo ( this . workspaceFileUri ) ) ?. catalogs
6968 : undefined ,
7069 )
70+ } else {
71+ this . #catalogs. resolve ( undefined )
7172 }
7273 }
7374
@@ -85,7 +86,7 @@ class WorkspaceContext {
8586 }
8687
8788 async getCatalogs ( ) : Promise < CatalogsInfo | undefined > {
88- return this . #catalogs? .promise
89+ return this . #catalogs! . promise
8990 }
9091
9192 #createResolvedDependencyInfo( dependency : DependencyInfo , catalogs ?: CatalogsInfo ) : ResolvedDependencyInfo {
@@ -131,7 +132,7 @@ class WorkspaceContext {
131132
132133 const [ info , catalogs ] = await Promise . all ( [
133134 getDocumentText ( uri ) . then ( ( text ) => extractor . getPackageManifestInfo ( text ) ) ,
134- this . #catalogs ?. promise ,
135+ this . getCatalogs ( ) ,
135136 ] )
136137
137138 if ( ! info )
0 commit comments