File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
src/tools/rust-analyzer/crates/rust-analyzer/src/bin Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -208,13 +208,24 @@ fn run_server() -> anyhow::Result<()> {
208208 tracing:: info!( "InitializeParams: {}" , initialize_params) ;
209209 let lsp_types:: InitializeParams {
210210 root_uri,
211- capabilities,
211+ mut capabilities,
212212 workspace_folders,
213213 initialization_options,
214214 client_info,
215215 ..
216216 } = from_json :: < lsp_types:: InitializeParams > ( "InitializeParams" , & initialize_params) ?;
217217
218+ // lsp-types has a typo in the `/capabilities/workspace/diagnostics` field, its typoed as `diagnostic`
219+ if let Some ( val) = initialize_params. pointer ( "/capabilities/workspace/diagnostics" ) {
220+ if let Ok ( diag_caps) = from_json :: < lsp_types:: DiagnosticWorkspaceClientCapabilities > (
221+ "DiagnosticWorkspaceClientCapabilities" ,
222+ val,
223+ ) {
224+ tracing:: info!( "Patching lsp-types workspace diagnostics capabilities: {diag_caps:#?}" ) ;
225+ capabilities. workspace . get_or_insert_default ( ) . diagnostic . get_or_insert ( diag_caps) ;
226+ }
227+ }
228+
218229 let root_path = match root_uri
219230 . and_then ( |it| it. to_file_path ( ) . ok ( ) )
220231 . map ( patch_path_prefix)
You can’t perform that action at this time.
0 commit comments