Tidy up diagnostics more (#29629)
- Stop merging same row diagnostics - (for Rust) show code fragments surrounded by `'s in monospace Co-authored-by: Serge Radinovich <sergeradinovich@gmail.com> Closes #29362 Release Notes: - diagnostics: Diagnostics are no longer merged when they're on the same line - rust: Diagnostics now show code snippets in monospace font: <img width="551" alt="Screenshot 2025-04-29 at 16 13 45" src="https://github.com/user-attachments/assets/d289be31-717d-404f-a76a-a0cda3e96fbe" /> Co-authored-by: Serge Radinovich <sergeradinovich@gmail.com>
This commit is contained in:
parent
b4732235e3
commit
e364e48266
9 changed files with 106 additions and 99 deletions
|
@ -8575,6 +8575,8 @@ impl LspStore {
|
|||
let mut sources_by_group_id = HashMap::default();
|
||||
let mut supporting_diagnostics = HashMap::default();
|
||||
|
||||
let adapter = self.language_server_adapter_for_id(language_server_id);
|
||||
|
||||
// Ensure that primary diagnostics are always the most severe
|
||||
params.diagnostics.sort_by_key(|item| item.severity);
|
||||
|
||||
|
@ -8622,6 +8624,9 @@ impl LspStore {
|
|||
.as_ref()
|
||||
.map(|d| d.href.clone()),
|
||||
severity: diagnostic.severity.unwrap_or(DiagnosticSeverity::ERROR),
|
||||
markdown: adapter.as_ref().and_then(|adapter| {
|
||||
adapter.diagnostic_message_to_markdown(&diagnostic.message)
|
||||
}),
|
||||
message: diagnostic.message.trim().to_string(),
|
||||
group_id,
|
||||
is_primary: true,
|
||||
|
@ -8644,6 +8649,9 @@ impl LspStore {
|
|||
.as_ref()
|
||||
.map(|c| c.href.clone()),
|
||||
severity: DiagnosticSeverity::INFORMATION,
|
||||
markdown: adapter.as_ref().and_then(|adapter| {
|
||||
adapter.diagnostic_message_to_markdown(&info.message)
|
||||
}),
|
||||
message: info.message.trim().to_string(),
|
||||
group_id,
|
||||
is_primary: false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue