Introduce UI affordances to make enabling/disabling inline completions easier (#22894)

Release Notes:

- N/A

---------

Co-authored-by: Thorsten <thorsten@zed.dev>
This commit is contained in:
Antonio Scandurra 2025-01-09 14:33:30 +01:00 committed by GitHub
parent 38fbc73ac4
commit 341972c79c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 62 additions and 15 deletions

View file

@ -1787,6 +1787,17 @@ impl Editor {
self.refresh_inline_completion(false, true, cx);
}
pub fn inline_completions_enabled(&self, cx: &AppContext) -> bool {
let cursor = self.selections.newest_anchor().head();
if let Some((buffer, buffer_position)) =
self.buffer.read(cx).text_anchor_for_position(cursor, cx)
{
self.should_show_inline_completions(&buffer, buffer_position, cx)
} else {
false
}
}
fn should_show_inline_completions(
&self,
buffer: &Model<Buffer>,