Show inline completions inside the completion menu if both are available (#22093)

Screenshot:

![screenshot-2024-12-17-11 53
41@2x](https://github.com/user-attachments/assets/bace3d20-7175-4833-9326-7b859166c0e8)

Demo:


https://github.com/user-attachments/assets/70197042-4785-4e45-80fd-29d12e68333f



(Note for Joseph/Peter: this supersedes
https://github.com/zed-industries/zed/pull/22069)

Release Notes:
- Changed inline completions to show up inside the normal completions in
case LSP and inline-completions are available. In that case, the inline
completion will be the first entry in the menu and can be selected with
`<tab>`.

---------

Co-authored-by: Bennet <bennet@zed.dev>
Co-authored-by: Danilo <danilo@zed.dev>
This commit is contained in:
Thorsten Ball 2024-12-17 13:34:25 +01:00 committed by GitHub
parent cc56ed7a88
commit 95334cb0ad
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 661 additions and 429 deletions

View file

@ -19,6 +19,7 @@ pub struct InlineCompletion {
pub trait InlineCompletionProvider: 'static + Sized {
fn name() -> &'static str;
fn display_name() -> &'static str;
fn is_enabled(
&self,
buffer: &Model<Buffer>,
@ -51,6 +52,7 @@ pub trait InlineCompletionProvider: 'static + Sized {
pub trait InlineCompletionProviderHandle {
fn name(&self) -> &'static str;
fn display_name(&self) -> &'static str;
fn is_enabled(
&self,
buffer: &Model<Buffer>,
@ -89,6 +91,10 @@ where
T::name()
}
fn display_name(&self) -> &'static str {
T::display_name()
}
fn is_enabled(
&self,
buffer: &Model<Buffer>,