From 79f35cc6992d18e97b0bb9e309a2dc37f6f286e8 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 18 Feb 2019 12:07:47 +0300 Subject: More orthogonal method naming --- crates/ra_ide_api/src/completion/complete_keyword.rs | 2 +- crates/ra_ide_api/src/completion/complete_postfix.rs | 2 +- crates/ra_ide_api/src/completion/complete_snippet.rs | 2 +- crates/ra_ide_api/src/completion/completion_item.rs | 7 +------ 4 files changed, 4 insertions(+), 9 deletions(-) (limited to 'crates/ra_ide_api/src') diff --git a/crates/ra_ide_api/src/completion/complete_keyword.rs b/crates/ra_ide_api/src/completion/complete_keyword.rs index 10ae01bc5..b667381a7 100644 --- a/crates/ra_ide_api/src/completion/complete_keyword.rs +++ b/crates/ra_ide_api/src/completion/complete_keyword.rs @@ -40,7 +40,7 @@ pub(super) fn complete_use_tree_keyword(acc: &mut Completions, ctx: &CompletionC fn keyword(ctx: &CompletionContext, kw: &str, snippet: &str) -> CompletionItem { CompletionItem::new(CompletionKind::Keyword, ctx.source_range(), kw) .kind(CompletionItemKind::Keyword) - .snippet(snippet) + .insert_snippet(snippet) .build() } diff --git a/crates/ra_ide_api/src/completion/complete_postfix.rs b/crates/ra_ide_api/src/completion/complete_postfix.rs index cf8c63269..4ba181720 100644 --- a/crates/ra_ide_api/src/completion/complete_postfix.rs +++ b/crates/ra_ide_api/src/completion/complete_postfix.rs @@ -22,7 +22,7 @@ fn postfix_snippet(ctx: &CompletionContext, label: &str, detail: &str, snippet: let mut builder = TextEditBuilder::default(); builder.delete(delete_range); CompletionItem::new(CompletionKind::Postfix, replace_range, label) - .snippet(snippet) + .insert_snippet(snippet) .detail(detail) .text_edit(builder.finish()) } diff --git a/crates/ra_ide_api/src/completion/complete_snippet.rs b/crates/ra_ide_api/src/completion/complete_snippet.rs index d1cea7375..aa3a16fa2 100644 --- a/crates/ra_ide_api/src/completion/complete_snippet.rs +++ b/crates/ra_ide_api/src/completion/complete_snippet.rs @@ -2,7 +2,7 @@ use crate::completion::{CompletionItem, Completions, CompletionKind, CompletionI fn snippet(ctx: &CompletionContext, label: &str, snippet: &str) -> Builder { CompletionItem::new(CompletionKind::Snippet, ctx.source_range(), label) - .snippet(snippet) + .insert_snippet(snippet) .kind(CompletionItemKind::Snippet) } diff --git a/crates/ra_ide_api/src/completion/completion_item.rs b/crates/ra_ide_api/src/completion/completion_item.rs index 7b93b5df8..1cdcde211 100644 --- a/crates/ra_ide_api/src/completion/completion_item.rs +++ b/crates/ra_ide_api/src/completion/completion_item.rs @@ -199,12 +199,7 @@ impl Builder { self.insert_text = Some(insert_text.into()); self } - #[allow(unused)] - pub(crate) fn insert_text_format(mut self, insert_text_format: InsertTextFormat) -> Builder { - self.insert_text_format = insert_text_format; - self - } - pub(crate) fn snippet(mut self, snippet: impl Into) -> Builder { + pub(crate) fn insert_snippet(mut self, snippet: impl Into) -> Builder { self.insert_text_format = InsertTextFormat::Snippet; self.insert_text(snippet) } -- cgit v1.2.3