Allow LSP adapters to decide, which diagnostics to underline (#31450)
Closes https://github.com/zed-industries/zed/pull/31355#issuecomment-2910439798 <img width="1728" alt="image" src="https://github.com/user-attachments/assets/2eaa8e9b-00bc-4e99-ac09-fceb2d932e41" /> Release Notes: - N/A
This commit is contained in:
parent
4c396bcc91
commit
4567360fd9
9 changed files with 53 additions and 5 deletions
|
@ -245,6 +245,10 @@ impl CachedLspAdapter {
|
|||
self.adapter.retain_old_diagnostic(previous_diagnostic, cx)
|
||||
}
|
||||
|
||||
pub fn underline_diagnostic(&self, diagnostic: &lsp::Diagnostic) -> bool {
|
||||
self.adapter.underline_diagnostic(diagnostic)
|
||||
}
|
||||
|
||||
pub fn diagnostic_message_to_markdown(&self, message: &str) -> Option<String> {
|
||||
self.adapter.diagnostic_message_to_markdown(message)
|
||||
}
|
||||
|
@ -470,6 +474,16 @@ pub trait LspAdapter: 'static + Send + Sync {
|
|||
false
|
||||
}
|
||||
|
||||
/// Whether to underline a given diagnostic or not, when rendering in the editor.
|
||||
///
|
||||
/// https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#diagnosticTag
|
||||
/// states that
|
||||
/// > Clients are allowed to render diagnostics with this tag faded out instead of having an error squiggle.
|
||||
/// for the unnecessary diagnostics, so do not underline them.
|
||||
fn underline_diagnostic(&self, _diagnostic: &lsp::Diagnostic) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
/// Post-processes completions provided by the language server.
|
||||
async fn process_completions(&self, _: &mut [lsp::CompletionItem]) {}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue