debugger: Add breakpoint list (#28496)

![image](https://github.com/user-attachments/assets/2cbe60cc-bf04-4233-a7bc-32affff8eef5)
Release Notes:

- N/A

---------

Co-authored-by: Anthony Eid <hello@anthonyeid.me>
This commit is contained in:
Piotr Osiewicz 2025-04-10 20:18:58 +02:00 committed by GitHub
parent 3abf95216c
commit 26f4705198
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 711 additions and 18 deletions

View file

@ -12,7 +12,7 @@ use rpc::{
proto::{self},
};
use std::{hash::Hash, ops::Range, path::Path, sync::Arc};
use text::PointUtf16;
use text::{Point, PointUtf16};
use crate::{Project, ProjectPath, buffer_store::BufferStore, worktree_store::WorktreeStore};
@ -464,6 +464,23 @@ impl BreakpointStore {
cx.notify();
}
pub fn breakpoint_at_row(
&self,
path: &Path,
row: u32,
cx: &App,
) -> Option<(Entity<Buffer>, (text::Anchor, Breakpoint))> {
self.breakpoints.get(path).and_then(|breakpoints| {
let snapshot = breakpoints.buffer.read(cx).text_snapshot();
breakpoints
.breakpoints
.iter()
.find(|(anchor, _)| anchor.summary::<Point>(&snapshot).row == row)
.map(|breakpoint| (breakpoints.buffer.clone(), breakpoint.clone()))
})
}
pub fn breakpoints_from_path(&self, path: &Arc<Path>, cx: &App) -> Vec<SourceBreakpoint> {
self.breakpoints
.get(path)