@@ -67,12 +67,19 @@ impl WorkspaceWorker {
6767 /// Start all programs (linter, formatter) for the worker.
6868 /// This should be called after the client has sent the workspace configuration.
6969 pub async fn start_worker ( & self , options : serde_json:: Value ) {
70- * self . options . lock ( ) . await = Some ( options. clone ( ) ) ;
71- * self . server_linter . write ( ) . await =
72- Some ( ServerLinterBuilder :: new ( self . root_uri . clone ( ) , options. clone ( ) ) . build ( ) ) ;
70+ tokio:: join!(
71+ async {
72+ * self . server_linter. write( ) . await =
73+ Some ( ServerLinterBuilder :: new( self . root_uri. clone( ) , options. clone( ) ) . build( ) ) ;
74+ } ,
75+ async {
76+ * self . server_formatter. write( ) . await = Some (
77+ ServerFormatterBuilder :: new( self . root_uri. clone( ) , options. clone( ) ) . build( ) ,
78+ ) ;
79+ } ,
80+ ) ;
7381
74- * self . server_formatter . write ( ) . await =
75- Some ( ServerFormatterBuilder :: new ( self . root_uri . clone ( ) , options) . build ( ) ) ;
82+ * self . options . lock ( ) . await = Some ( options) ;
7683 }
7784
7885 /// Initialize file system watchers for the workspace.
@@ -84,18 +91,22 @@ impl WorkspaceWorker {
8491 // clone the options to avoid locking the mutex
8592 let options_json = { self . options . lock ( ) . await . clone ( ) . unwrap_or_default ( ) } ;
8693
87- let lint_patterns = self
88- . server_linter
89- . read ( )
90- . await
91- . as_ref ( )
92- . map ( |linter| linter. get_watcher_patterns ( options_json. clone ( ) ) ) ;
93- let format_patterns = self
94- . server_formatter
95- . read ( )
96- . await
97- . as_ref ( )
98- . map ( |formatter| formatter. get_watcher_patterns ( options_json) ) ;
94+ let ( lint_patterns, format_patterns) = tokio:: join!(
95+ async {
96+ self . server_linter
97+ . read( )
98+ . await
99+ . as_ref( )
100+ . map( |linter| linter. get_watcher_patterns( options_json. clone( ) ) )
101+ } ,
102+ async {
103+ self . server_formatter
104+ . read( )
105+ . await
106+ . as_ref( )
107+ . map( |formatter| formatter. get_watcher_patterns( options_json. clone( ) ) )
108+ }
109+ ) ;
99110
100111 if let Some ( lint_patterns) = lint_patterns
101112 && !lint_patterns. is_empty ( )
0 commit comments