File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
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<()> {
208
208
tracing:: info!( "InitializeParams: {}" , initialize_params) ;
209
209
let lsp_types:: InitializeParams {
210
210
root_uri,
211
- capabilities,
211
+ mut capabilities,
212
212
workspace_folders,
213
213
initialization_options,
214
214
client_info,
215
215
..
216
216
} = from_json :: < lsp_types:: InitializeParams > ( "InitializeParams" , & initialize_params) ?;
217
217
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
+
218
229
let root_path = match root_uri
219
230
. and_then ( |it| it. to_file_path ( ) . ok ( ) )
220
231
. map ( patch_path_prefix)
You can’t perform that action at this time.
0 commit comments