Update block diagnostics (#28006)

Release Notes:

- "Block" diagnostics (that show up in the diagnostics view, or when
using `f8`/`shift-f8`) are rendered more clearly
- `f8`/`shift-f8` now always go to the "next" or "prev" diagnostic,
regardless of the state of the editor

![Screenshot 2025-04-09 at 16 42
09](https://github.com/user-attachments/assets/ae6d2ff6-5183-4b74-89d0-fefee1aa11e3)

---------

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
Co-authored-by: Julia Ryan <juliaryan3.14@gmail.com>
This commit is contained in:
Conrad Irwin 2025-04-15 09:35:13 -06:00 committed by GitHub
parent ccf9aef767
commit afabcd1547
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 1794 additions and 1987 deletions

View file

@ -61,7 +61,7 @@ pub struct BlockSnapshot {
}
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct CustomBlockId(usize);
pub struct CustomBlockId(pub usize);
impl From<CustomBlockId> for ElementId {
fn from(val: CustomBlockId) -> Self {
@ -89,7 +89,7 @@ pub enum BlockPlacement<T> {
}
impl<T> BlockPlacement<T> {
fn start(&self) -> &T {
pub fn start(&self) -> &T {
match self {
BlockPlacement::Above(position) => position,
BlockPlacement::Below(position) => position,
@ -187,14 +187,15 @@ impl BlockPlacement<Anchor> {
}
pub struct CustomBlock {
id: CustomBlockId,
placement: BlockPlacement<Anchor>,
height: Option<u32>,
pub id: CustomBlockId,
pub placement: BlockPlacement<Anchor>,
pub height: Option<u32>,
style: BlockStyle,
render: Arc<Mutex<RenderBlock>>,
priority: usize,
}
#[derive(Clone)]
pub struct BlockProperties<P> {
pub placement: BlockPlacement<P>,
// None if the block takes up no space
@ -686,6 +687,9 @@ impl BlockMap {
rows_before_block = position.0 - new_transforms.summary().input_rows;
}
BlockPlacement::Near(position) | BlockPlacement::Below(position) => {
if position.0 + 1 < new_transforms.summary().input_rows {
continue;
}
rows_before_block = (position.0 + 1) - new_transforms.summary().input_rows;
}
BlockPlacement::Replace(range) => {