Make anchor_in_excerpt Optional (#8975)
We were seeing panics due to callers assuming they had valid excerpt_ids, but that cannot easily be guaranteed across await points as anyone may remove an excerpt. Release Notes: - Fixed a panic when hovering in a multibuffer
This commit is contained in:
@@ -227,8 +227,12 @@ impl SyntaxTreeView {
|
||||
let multibuffer = editor_state.editor.read(cx).buffer();
|
||||
let multibuffer = multibuffer.read(cx).snapshot(cx);
|
||||
let excerpt_id = buffer_state.excerpt_id;
|
||||
let range = multibuffer.anchor_in_excerpt(excerpt_id, range.start)
|
||||
..multibuffer.anchor_in_excerpt(excerpt_id, range.end);
|
||||
let range = multibuffer
|
||||
.anchor_in_excerpt(excerpt_id, range.start)
|
||||
.unwrap()
|
||||
..multibuffer
|
||||
.anchor_in_excerpt(excerpt_id, range.end)
|
||||
.unwrap();
|
||||
|
||||
// Update the editor with the anchor range.
|
||||
editor_state.editor.update(cx, |editor, cx| {
|
||||
|
||||
Reference in New Issue
Block a user