Show diagnostic codes (#29296)
Closes #28135 Closes #4388 Closes #28136 Release Notes: - diagnostics: Show the diagnostic code if available --------- Co-authored-by: Neo Nie <nihgwu@live.com> Co-authored-by: Zed AI <ai+claude-3.7@zed.dev>
This commit is contained in:
parent
8836c6fb42
commit
9d10489607
13 changed files with 517 additions and 327 deletions
|
@ -5950,6 +5950,29 @@ impl MultiBufferSnapshot {
|
|||
.map(|(range, diagnostic, _)| DiagnosticEntry { diagnostic, range })
|
||||
}
|
||||
|
||||
pub fn diagnostics_with_buffer_ids_in_range<'a, T>(
|
||||
&'a self,
|
||||
range: Range<T>,
|
||||
) -> impl Iterator<Item = (BufferId, DiagnosticEntry<T>)> + 'a
|
||||
where
|
||||
T: 'a
|
||||
+ text::ToOffset
|
||||
+ text::FromAnchor
|
||||
+ TextDimension
|
||||
+ Ord
|
||||
+ Sub<T, Output = T>
|
||||
+ fmt::Debug,
|
||||
{
|
||||
self.lift_buffer_metadata(range, move |buffer, buffer_range| {
|
||||
Some(
|
||||
buffer
|
||||
.diagnostics_in_range(buffer_range.start..buffer_range.end, false)
|
||||
.map(|entry| (entry.range, entry.diagnostic)),
|
||||
)
|
||||
})
|
||||
.map(|(range, diagnostic, b)| (b.buffer_id, DiagnosticEntry { diagnostic, range }))
|
||||
}
|
||||
|
||||
pub fn syntax_ancestor<T: ToOffset>(
|
||||
&self,
|
||||
range: Range<T>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue