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 13:33:30 +00:00
committed by GitHub
co-authored by Thorsten
parent 38fbc73ac4
commit 341972c79c
3 changed files with 62 additions and 15 deletions
+11
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>,