Skip to content

Commit 91a1a83

Browse files
committed
Fill code_description for rust_analyzer diagnostics
1 parent 56a0021 commit 91a1a83

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

crates/rust-analyzer/src/handlers.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1129,7 +1129,14 @@ pub(crate) fn publish_diagnostics(
11291129
range: to_proto::range(&line_index, d.range),
11301130
severity: Some(to_proto::diagnostic_severity(d.severity)),
11311131
code: d.code.map(|d| d.as_str().to_owned()).map(NumberOrString::String),
1132-
code_description: None,
1132+
code_description: d.code.and_then(|code| {
1133+
lsp_types::Url::parse(&format!(
1134+
"https://rust-analyzer.github.io/manual.html#{}",
1135+
code.as_str()
1136+
))
1137+
.ok()
1138+
.map(|href| lsp_types::CodeDescription { href })
1139+
}),
11331140
source: Some("rust-analyzer".to_string()),
11341141
message: d.message,
11351142
related_information: None,

0 commit comments

Comments
 (0)