From 91a1a836015f61accb73f7b855b852fc22e810fc Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Wed, 18 Nov 2020 08:54:52 +0100 Subject: Fill code_description for rust_analyzer diagnostics --- crates/rust-analyzer/src/handlers.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'crates') diff --git a/crates/rust-analyzer/src/handlers.rs b/crates/rust-analyzer/src/handlers.rs index 118e7276f..1cf4139d2 100644 --- a/crates/rust-analyzer/src/handlers.rs +++ b/crates/rust-analyzer/src/handlers.rs @@ -1129,7 +1129,14 @@ pub(crate) fn publish_diagnostics( range: to_proto::range(&line_index, d.range), severity: Some(to_proto::diagnostic_severity(d.severity)), code: d.code.map(|d| d.as_str().to_owned()).map(NumberOrString::String), - code_description: None, + code_description: d.code.and_then(|code| { + lsp_types::Url::parse(&format!( + "https://rust-analyzer.github.io/manual.html#{}", + code.as_str() + )) + .ok() + .map(|href| lsp_types::CodeDescription { href }) + }), source: Some("rust-analyzer".to_string()), message: d.message, related_information: None, -- cgit v1.2.3