mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-29 19:17:12 +00:00
Workaround lsp-types typo
This commit is contained in:
parent
14872a5332
commit
8fcc577b73
1 changed files with 12 additions and 1 deletions
|
|
@ -208,13 +208,24 @@ fn run_server() -> anyhow::Result<()> {
|
||||||
tracing::info!("InitializeParams: {}", initialize_params);
|
tracing::info!("InitializeParams: {}", initialize_params);
|
||||||
let lsp_types::InitializeParams {
|
let lsp_types::InitializeParams {
|
||||||
root_uri,
|
root_uri,
|
||||||
capabilities,
|
mut capabilities,
|
||||||
workspace_folders,
|
workspace_folders,
|
||||||
initialization_options,
|
initialization_options,
|
||||||
client_info,
|
client_info,
|
||||||
..
|
..
|
||||||
} = from_json::<lsp_types::InitializeParams>("InitializeParams", &initialize_params)?;
|
} = from_json::<lsp_types::InitializeParams>("InitializeParams", &initialize_params)?;
|
||||||
|
|
||||||
|
// lsp-types has a typo in the `/capabilities/workspace/diagnostics` field, its typoed as `diagnostic`
|
||||||
|
if let Some(val) = initialize_params.pointer("/capabilities/workspace/diagnostics") {
|
||||||
|
if let Ok(diag_caps) = from_json::<lsp_types::DiagnosticWorkspaceClientCapabilities>(
|
||||||
|
"DiagnosticWorkspaceClientCapabilities",
|
||||||
|
val,
|
||||||
|
) {
|
||||||
|
tracing::info!("Patching lsp-types workspace diagnostics capabilities: {diag_caps:#?}");
|
||||||
|
capabilities.workspace.get_or_insert_default().diagnostic.get_or_insert(diag_caps);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let root_path = match root_uri
|
let root_path = match root_uri
|
||||||
.and_then(|it| it.to_file_path().ok())
|
.and_then(|it| it.to_file_path().ok())
|
||||||
.map(patch_path_prefix)
|
.map(patch_path_prefix)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue