edit predictions: Preview while holding modifier mode (#24316)
This PR adds a new `inline_completions.inline_preview` config which can be set to `auto` (current behavior) or to `when_holding_modifier`. When set to the latter, instead of showing edit prediction previews inline in the buffer, we'll show it in a popover (even when there's no LSP completion) so your isn't constantly moving as completions arrive. https://github.com/user-attachments/assets/3615d151-3633-4ee4-98b9-66ee0aa735b8 Release Notes: - N/A --------- Co-authored-by: Danilo <danilo@zed.dev>
This commit is contained in:
parent
b4d8b1be3f
commit
8ed8b4d2ec
8 changed files with 113 additions and 60 deletions
|
@ -169,7 +169,6 @@ pub struct CompletionsMenu {
|
|||
resolve_completions: bool,
|
||||
show_completion_documentation: bool,
|
||||
last_rendered_range: Rc<RefCell<Option<Range<usize>>>>,
|
||||
pub previewing_inline_completion: bool,
|
||||
}
|
||||
|
||||
impl CompletionsMenu {
|
||||
|
@ -200,7 +199,6 @@ impl CompletionsMenu {
|
|||
scroll_handle: UniformListScrollHandle::new(),
|
||||
resolve_completions: true,
|
||||
last_rendered_range: RefCell::new(None).into(),
|
||||
previewing_inline_completion: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -257,7 +255,6 @@ impl CompletionsMenu {
|
|||
resolve_completions: false,
|
||||
show_completion_documentation: false,
|
||||
last_rendered_range: RefCell::new(None).into(),
|
||||
previewing_inline_completion: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -410,12 +407,8 @@ impl CompletionsMenu {
|
|||
.detach();
|
||||
}
|
||||
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.entries.borrow().is_empty()
|
||||
}
|
||||
|
||||
pub fn visible(&self) -> bool {
|
||||
!self.is_empty() && !self.previewing_inline_completion
|
||||
!self.entries.borrow().is_empty()
|
||||
}
|
||||
|
||||
fn origin(&self) -> ContextMenuOrigin {
|
||||
|
@ -709,10 +702,6 @@ impl CompletionsMenu {
|
|||
// This keeps the display consistent when y_flipped.
|
||||
self.scroll_handle.scroll_to_item(0, ScrollStrategy::Top);
|
||||
}
|
||||
|
||||
pub fn set_previewing_inline_completion(&mut self, value: bool) {
|
||||
self.previewing_inline_completion = value;
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue