aboutsummaryrefslogtreecommitdiff
path: root/crates/completion/src/item.rs
diff options
context:
space:
mode:
authorIgor Aleksanov <[email protected]>2020-10-25 08:26:38 +0000
committerIgor Aleksanov <[email protected]>2020-10-25 08:26:38 +0000
commitf731d910cbfe36bbdfa3a3f1415d5c48c4a79238 (patch)
treecc221d5bad05e1b6dc8e30f876b29d274b05e827 /crates/completion/src/item.rs
parent19c10672023ead0c1d64486154b6c4145b649568 (diff)
Move Completions structure definition into completions module
Diffstat (limited to 'crates/completion/src/item.rs')
-rw-r--r--crates/completion/src/item.rs29
1 files changed, 0 insertions, 29 deletions
diff --git a/crates/completion/src/item.rs b/crates/completion/src/item.rs
index 3cb625a06..6d1d085f4 100644
--- a/crates/completion/src/item.rs
+++ b/crates/completion/src/item.rs
@@ -272,10 +272,6 @@ pub(crate) struct Builder {
272} 272}
273 273
274impl Builder { 274impl Builder {
275 pub(crate) fn add_to(self, acc: &mut Completions) {
276 acc.add(self.build())
277 }
278
279 pub(crate) fn build(self) -> CompletionItem { 275 pub(crate) fn build(self) -> CompletionItem {
280 let label = self.label; 276 let label = self.label;
281 let text_edit = match self.text_edit { 277 let text_edit = match self.text_edit {
@@ -376,28 +372,3 @@ impl<'a> Into<CompletionItem> for Builder {
376 self.build() 372 self.build()
377 } 373 }
378} 374}
379
380/// Represents an in-progress set of completions being built.
381#[derive(Debug, Default)]
382pub struct Completions {
383 buf: Vec<CompletionItem>,
384}
385
386impl Completions {
387 pub fn add(&mut self, item: impl Into<CompletionItem>) {
388 self.buf.push(item.into())
389 }
390 pub fn add_all<I>(&mut self, items: I)
391 where
392 I: IntoIterator,
393 I::Item: Into<CompletionItem>,
394 {
395 items.into_iter().for_each(|item| self.add(item.into()))
396 }
397}
398
399impl Into<Vec<CompletionItem>> for Completions {
400 fn into(self) -> Vec<CompletionItem> {
401 self.buf
402 }
403}