Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-term/src/handlers/completion/item.rs')
-rw-r--r--helix-term/src/handlers/completion/item.rs22
1 files changed, 10 insertions, 12 deletions
diff --git a/helix-term/src/handlers/completion/item.rs b/helix-term/src/handlers/completion/item.rs
index 136d72db..de08d0db 100644
--- a/helix-term/src/handlers/completion/item.rs
+++ b/helix-term/src/handlers/completion/item.rs
@@ -1,13 +1,11 @@
-use std::mem;
-
use helix_core::completion::CompletionProvider;
use helix_lsp::{lsp, LanguageServerId};
-use helix_view::handlers::completion::ResponseContext;
pub struct CompletionResponse {
pub items: CompletionItems,
+ pub incomplete: bool,
pub provider: CompletionProvider,
- pub context: ResponseContext,
+ pub priority: i8,
}
pub enum CompletionItems {
@@ -25,21 +23,21 @@ impl CompletionItems {
}
impl CompletionResponse {
- pub fn take_items(&mut self, dst: &mut Vec<CompletionItem>) {
- match &mut self.items {
- CompletionItems::Lsp(items) => dst.extend(items.drain(..).map(|item| {
+ pub fn into_items(self, dst: &mut Vec<CompletionItem>) {
+ match self.items {
+ CompletionItems::Lsp(items) => dst.extend(items.into_iter().map(|item| {
CompletionItem::Lsp(LspCompletionItem {
item,
provider: match self.provider {
CompletionProvider::Lsp(provider) => provider,
- _ => unreachable!(),
+ CompletionProvider::PathCompletions => unreachable!(),
},
resolved: false,
- provider_priority: self.context.priority,
+ provider_priority: self.priority,
})
})),
- CompletionItems::Other(items) if dst.is_empty() => mem::swap(dst, items),
- CompletionItems::Other(items) => dst.append(items),
+ CompletionItems::Other(items) if dst.is_empty() => *dst = items,
+ CompletionItems::Other(mut items) => dst.append(&mut items),
}
}
}
@@ -53,6 +51,7 @@ pub struct LspCompletionItem {
// according to the spec but vscode does that anyway and most servers (
// including rust-analyzer) rely on that.. so we can't do that without
// breaking completions.
+ // pub incomplete_completion_list: bool,
pub provider_priority: i8,
}
@@ -67,7 +66,6 @@ impl LspCompletionItem {
}
}
-#[allow(clippy::large_enum_variant)] // TODO: In a separate PR attempt the `Box<LspCompletionItem>` pattern.
#[derive(Debug, PartialEq, Clone)]
pub enum CompletionItem {
Lsp(LspCompletionItem),