debugger: Fix panics when debugging with inline values or confirming in console (#30677)
The first panic was caused by an unwrap that assumed a file would always have a root syntax node. The second was caused by a double lease panic when clicking enter in the debug console while there was a completion menu open Release Notes: - N/A
This commit is contained in:
parent
ed361ff6a2
commit
f4eea0db2e
2 changed files with 6 additions and 3 deletions
|
@ -150,8 +150,9 @@ impl Console {
|
||||||
pub fn evaluate(&mut self, _: &Confirm, window: &mut Window, cx: &mut Context<Self>) {
|
pub fn evaluate(&mut self, _: &Confirm, window: &mut Window, cx: &mut Context<Self>) {
|
||||||
let expression = self.query_bar.update(cx, |editor, cx| {
|
let expression = self.query_bar.update(cx, |editor, cx| {
|
||||||
let expression = editor.text(cx);
|
let expression = editor.text(cx);
|
||||||
|
cx.defer_in(window, |editor, window, cx| {
|
||||||
editor.clear(window, cx);
|
editor.clear(window, cx);
|
||||||
|
});
|
||||||
|
|
||||||
expression
|
expression
|
||||||
});
|
});
|
||||||
|
|
|
@ -3580,7 +3580,9 @@ impl Project {
|
||||||
|
|
||||||
let snapshot = buffer_handle.read(cx).snapshot();
|
let snapshot = buffer_handle.read(cx).snapshot();
|
||||||
|
|
||||||
let root_node = snapshot.syntax_root_ancestor(range.end).unwrap();
|
let Some(root_node) = snapshot.syntax_root_ancestor(range.end) else {
|
||||||
|
return Task::ready(Ok(vec![]));
|
||||||
|
};
|
||||||
|
|
||||||
let row = snapshot
|
let row = snapshot
|
||||||
.summary_for_anchor::<text::PointUtf16>(&range.end)
|
.summary_for_anchor::<text::PointUtf16>(&range.end)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue