@@ -86,14 +86,14 @@ impl LanguageServer for Backend {
8686 return Some ( new_settings) ;
8787 }
8888
89- let deprecated_settings = value. get ( "settings" ) ;
90-
9189 // the client has deprecated settings and has a deprecated root uri.
9290 // handle all things like the old way
93- if deprecated_settings. is_some ( ) && params. root_uri . is_some ( ) {
91+ if let ( Some ( deprecated_settings) , Some ( root_uri) ) =
92+ ( value. get ( "settings" ) , params. root_uri . as_ref ( ) )
93+ {
9494 return Some ( vec ! [ WorkspaceOption {
95- workspace_uri: params . root_uri. clone( ) . unwrap ( ) ,
96- options: deprecated_settings. unwrap ( ) . clone( ) ,
95+ workspace_uri: root_uri. clone( ) ,
96+ options: deprecated_settings. clone( ) ,
9797 } ] ) ;
9898 }
9999
@@ -129,15 +129,14 @@ impl LanguageServer for Backend {
129129 // start the linter. We do not start the linter when the client support the request,
130130 // we will init the linter after requesting for the workspace configuration.
131131 if !capabilities. workspace_configuration || options. is_some ( ) {
132+ let mut options = options. unwrap_or_default ( ) . into_iter ( ) ;
133+
132134 for worker in & workers {
133135 let option = options
134- . as_deref ( )
135- . unwrap_or_default ( )
136- . iter ( )
137136 . find ( |workspace_option| {
138137 worker. is_responsible_for_uri ( & workspace_option. workspace_uri )
139138 } )
140- . map ( |workspace_options| workspace_options. options . clone ( ) )
139+ . map ( |workspace_options| workspace_options. options )
141140 . unwrap_or_default ( ) ;
142141
143142 worker. start_worker ( option, & self . tool_builders ) . await ;
@@ -522,7 +521,7 @@ impl LanguageServer for Backend {
522521 let content = params. content_changes . first ( ) . map ( |c| c. text . clone ( ) ) ;
523522
524523 if let Some ( content) = & content {
525- self . file_system . write ( ) . await . set ( & uri, content. clone ( ) ) ;
524+ self . file_system . write ( ) . await . set ( uri. clone ( ) , content. clone ( ) ) ;
526525 }
527526
528527 if let Some ( diagnostics) = worker. run_diagnostic_on_change ( & uri, content. as_deref ( ) ) . await {
@@ -545,7 +544,7 @@ impl LanguageServer for Backend {
545544
546545 let content = params. text_document . text ;
547546
548- self . file_system . write ( ) . await . set ( & uri, content. clone ( ) ) ;
547+ self . file_system . write ( ) . await . set ( uri. clone ( ) , content. clone ( ) ) ;
549548
550549 if let Some ( diagnostics) = worker. run_diagnostic ( & uri, Some ( & content) ) . await {
551550 self . client
0 commit comments