File tree Expand file tree Collapse file tree 3 files changed +24
-3
lines changed Expand file tree Collapse file tree 3 files changed +24
-3
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @biomejs/biome " : patch
3+ ---
4+
5+ Fixed the LSP method ` workspace/didChangeWorkspaceFolders ` to perform incremental updates instead of replacing the entire folder list.
Original file line number Diff line number Diff line change @@ -408,7 +408,8 @@ impl LanguageServer for LSPServer {
408408 }
409409 }
410410
411- self . session . update_workspace_folders ( params. event . added ) ;
411+ self . session
412+ . update_workspace_folders ( params. event . added , params. event . removed ) ;
412413 self . session . load_workspace_settings ( true ) . await ;
413414 }
414415
Original file line number Diff line number Diff line change @@ -587,9 +587,24 @@ impl Session {
587587 self . workspace_folders . read ( ) . unwrap ( ) . clone ( )
588588 }
589589
590- pub ( crate ) fn update_workspace_folders ( & self , folders : Vec < WorkspaceFolder > ) {
590+ pub ( crate ) fn update_workspace_folders (
591+ & self ,
592+ added : Vec < WorkspaceFolder > ,
593+ removed : Vec < WorkspaceFolder > ,
594+ ) {
591595 let mut workspace_folders = self . workspace_folders . write ( ) . unwrap ( ) ;
592- * workspace_folders = Some ( folders) ;
596+
597+ if let Some ( ref mut folders) = * workspace_folders {
598+ if !removed. is_empty ( ) {
599+ folders. retain ( |folder| !removed. contains ( folder) ) ;
600+ }
601+
602+ if !added. is_empty ( ) {
603+ folders. extend ( added) ;
604+ }
605+ } else {
606+ * workspace_folders = Some ( added) ;
607+ }
593608 }
594609
595610 /// Returns the base path of the workspace on the filesystem if it has one
You can’t perform that action at this time.
0 commit comments