debugger: Add support for completion triggers in debug console (#33211)

Release Notes:

- Debugger: Add support for completion triggers in debug console
This commit is contained in:
Remco Smits 2025-06-25 04:19:00 +02:00 committed by GitHub
parent aa330fcf2c
commit cf086544e3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -582,14 +582,31 @@ impl CompletionProvider for ConsoleQueryBarCompletionProvider {
fn is_completion_trigger(
&self,
_buffer: &Entity<Buffer>,
_position: language::Anchor,
_text: &str,
buffer: &Entity<Buffer>,
position: language::Anchor,
text: &str,
_trigger_in_words: bool,
_menu_is_open: bool,
_cx: &mut Context<Editor>,
menu_is_open: bool,
cx: &mut Context<Editor>,
) -> bool {
true
let snapshot = buffer.read(cx).snapshot();
if !menu_is_open && !snapshot.settings_at(position, cx).show_completions_on_input {
return false;
}
self.0
.read_with(cx, |console, cx| {
console
.session
.read(cx)
.capabilities()
.completion_trigger_characters
.as_ref()
.map(|triggers| triggers.contains(&text.to_string()))
})
.ok()
.flatten()
.unwrap_or(true)
}
}