@@ -42,10 +42,11 @@ function createResolvedDependencyInfo(
4242 catalogs ?: CatalogsInfo ,
4343) : ResolvedDependencyInfo {
4444 const resolution = resolveDependencySpec ( dependency . rawName , dependency . rawSpec , catalogs )
45+
4546 const packageInfo = lazyInit (
46- ( ) => resolution . resolvedProtocol === 'npm'
47- ? getPackageInfo ( resolution . resolvedName ) . then ( ( pkg ) => pkg ?? null )
48- : Promise . resolve ( null ) ,
47+ async ( ) => resolution . resolvedProtocol === 'npm'
48+ ? await getPackageInfo ( resolution . resolvedName ) ?? null
49+ : null ,
4950 )
5051
5152 return {
@@ -75,6 +76,7 @@ export const getWorkspaceContextState = memoize<Uri, Promise<WorkspaceContextSta
7576
7677 const loadWorkspaceCatalogInfo = memoize ( async ( uri : Uri ) : Promise < WithResolvedDependencyInfo < WorkspaceCatalogInfo > | undefined > => {
7778 const path = uri . path
79+ logger . info ( `[workspace-context] load workspace catalog info: ${ path } ` )
7880
7981 for ( const entry of workspaceCatalogExtractorEntries ) {
8082 if ( ! path . endsWith ( `/${ entry . basename } ` ) )
@@ -91,7 +93,7 @@ export const getWorkspaceContextState = memoize<Uri, Promise<WorkspaceContextSta
9193 dependencies : info . dependencies . map ( ( dependency ) => createResolvedDependencyInfo ( dependency ) ) ,
9294 }
9395 }
94- } , { ttl : false , maxSize : Number . POSITIVE_INFINITY , fallbackToCachedOnError : false } )
96+ } , { getKey : ( uri ) => uri . path , ttl : false , maxSize : Number . POSITIVE_INFINITY , fallbackToCachedOnError : false } )
9597
9698 let catalogs : CatalogsInfo | undefined
9799
@@ -115,6 +117,7 @@ export const getWorkspaceContextState = memoize<Uri, Promise<WorkspaceContextSta
115117 if ( ! isPackageManifestPath ( uri . path ) )
116118 return
117119
120+ logger . info ( `[workspace-context] load package manifest info: ${ uri . path } ` )
118121 const text = await getDocumentText ( uri )
119122
120123 const info = packageManifestExtractorEntry . extractor . getPackageManifestInfo ( text )
@@ -125,7 +128,7 @@ export const getWorkspaceContextState = memoize<Uri, Promise<WorkspaceContextSta
125128 ...info ,
126129 dependencies : info . dependencies . map ( ( dependency ) => createResolvedDependencyInfo ( dependency , catalogs ) ) ,
127130 }
128- } , { ttl : false , maxSize : Number . POSITIVE_INFINITY , fallbackToCachedOnError : false } ) ,
131+ } , { getKey : ( uri ) => uri . path , ttl : false , maxSize : Number . POSITIVE_INFINITY , fallbackToCachedOnError : false } ) ,
129132 loadWorkspaceCatalogInfo,
130133 }
131134} , {
0 commit comments