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:
Anthony Eid 2025-05-14 11:50:42 +02:00 committed by GitHub
parent ed361ff6a2
commit f4eea0db2e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 3 deletions

View file

@ -150,8 +150,9 @@ impl Console {
pub fn evaluate(&mut self, _: &Confirm, window: &mut Window, cx: &mut Context<Self>) {
let expression = self.query_bar.update(cx, |editor, cx| {
let expression = editor.text(cx);
editor.clear(window, cx);
cx.defer_in(window, |editor, window, cx| {
editor.clear(window, cx);
});
expression
});