@@ -323,6 +323,14 @@ impl WorkspaceServer {
323323 let path: Utf8PathBuf = biome_path. clone ( ) . into ( ) ;
324324
325325 if document_file_source. is_none ( ) && !DocumentFileSource :: can_read ( path. as_path ( ) ) {
326+ if reason. is_index ( )
327+ && path
328+ . file_name ( )
329+ . is_some_and ( |filename| filename == "pnpm-workspace.yaml" )
330+ && let Some ( workspace_root) = path. parent ( )
331+ {
332+ self . refresh_pnpm_workspace_catalogs_for_scope ( project_key, workspace_root) ;
333+ }
326334 return Ok ( Default :: default ( ) ) ;
327335 }
328336
@@ -583,27 +591,38 @@ impl WorkspaceServer {
583591 reason. is_index ( ) || self . is_indexed ( & path)
584592 } ;
585593
586- // Manifest files need to update the module graph
587- if is_indexed
588- && let Some ( root) = syntax
594+ // Manifest files need to update the module graph.
595+ if is_indexed {
596+ if let Some ( root) = syntax
589597 . and_then ( Result :: ok)
590598 . map ( |node| node. unwrap_as_send_node ( ) )
591- {
592- let ( dependencies, diagnostics) = self . update_service_data (
593- & path,
594- UpdateKind :: AddedOrChanged ( reason, root, services) ,
595- project_key,
596- ) ?;
599+ {
600+ let ( dependencies, diagnostics) = self . update_service_data (
601+ & path,
602+ UpdateKind :: AddedOrChanged ( reason, root, services) ,
603+ project_key,
604+ ) ?;
597605
598- Ok ( InternalOpenFileResult {
599- dependencies,
600- diagnostics,
601- } )
602- } else {
603- // If the document was never opened by the scanner, we don't care
604- // about updating service data.
605- Ok ( InternalOpenFileResult :: default ( ) )
606+ return Ok ( InternalOpenFileResult {
607+ dependencies,
608+ diagnostics,
609+ } ) ;
610+ }
611+
612+ // pnpm-workspace.yaml is not a parsed manifest, but updates still need to
613+ // re-apply catalogs to indexed package.json manifests in the same scope.
614+ if path
615+ . file_name ( )
616+ . is_some_and ( |filename| filename == "pnpm-workspace.yaml" )
617+ && let Some ( workspace_root) = path. parent ( )
618+ {
619+ self . refresh_pnpm_workspace_catalogs_for_scope ( project_key, workspace_root) ;
620+ }
606621 }
622+
623+ // If the document was never opened by the scanner, we don't care
624+ // about updating service data.
625+ Ok ( InternalOpenFileResult :: default ( ) )
607626 }
608627
609628 /// Retrieves the parser result for a given file.
@@ -2537,6 +2556,12 @@ impl WorkspaceScannerBridge for WorkspaceServer {
25372556 Some ( "package.json" | "tsconfig.json" | "turbo.json" | "turbo.jsonc" ) => {
25382557 self . project_layout . is_indexed ( path)
25392558 }
2559+ Some ( "pnpm-workspace.yaml" ) => path. parent ( ) . is_some_and ( |workspace_root| {
2560+ self . project_layout
2561+ . package_paths ( )
2562+ . into_iter ( )
2563+ . any ( |package_path| package_path. starts_with ( workspace_root) )
2564+ } ) ,
25402565 _ => self . module_graph . contains ( path) ,
25412566 }
25422567 }
0 commit comments