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
|
@ -8782,6 +8782,10 @@ impl LspStore {
|
|||
.as_ref()
|
||||
.map_or(false, |tags| tags.contains(&DiagnosticTag::UNNECESSARY));
|
||||
|
||||
let underline = self
|
||||
.language_server_adapter_for_id(language_server_id)
|
||||
.map_or(true, |adapter| adapter.underline_diagnostic(diagnostic));
|
||||
|
||||
if is_supporting {
|
||||
supporting_diagnostics.insert(
|
||||
(source, diagnostic.code.clone(), range),
|
||||
|
@ -8814,6 +8818,7 @@ impl LspStore {
|
|||
is_primary: true,
|
||||
is_disk_based,
|
||||
is_unnecessary,
|
||||
underline,
|
||||
data: diagnostic.data.clone(),
|
||||
},
|
||||
});
|
||||
|
@ -8839,6 +8844,7 @@ impl LspStore {
|
|||
is_primary: false,
|
||||
is_disk_based,
|
||||
is_unnecessary: false,
|
||||
underline,
|
||||
data: diagnostic.data.clone(),
|
||||
},
|
||||
});
|
||||
|
|
|
@ -37,6 +37,15 @@ pub fn is_inactive_region(diag: &Diagnostic) -> bool {
|
|||
.is_some_and(|v| v == CLANGD_SERVER_NAME)
|
||||
}
|
||||
|
||||
pub fn is_lsp_inactive_region(diag: &lsp::Diagnostic) -> bool {
|
||||
diag.severity == Some(INACTIVE_DIAGNOSTIC_SEVERITY)
|
||||
&& diag.message == INACTIVE_REGION_MESSAGE
|
||||
&& diag
|
||||
.source
|
||||
.as_ref()
|
||||
.is_some_and(|v| v == CLANGD_SERVER_NAME)
|
||||
}
|
||||
|
||||
pub fn register_notifications(
|
||||
lsp_store: WeakEntity<LspStore>,
|
||||
language_server: &LanguageServer,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue