diff options
Diffstat (limited to 'crates')
4 files changed, 4 insertions, 9 deletions
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 | |||
40 | fn keyword(ctx: &CompletionContext, kw: &str, snippet: &str) -> CompletionItem { | 40 | fn keyword(ctx: &CompletionContext, kw: &str, snippet: &str) -> CompletionItem { |
41 | CompletionItem::new(CompletionKind::Keyword, ctx.source_range(), kw) | 41 | CompletionItem::new(CompletionKind::Keyword, ctx.source_range(), kw) |
42 | .kind(CompletionItemKind::Keyword) | 42 | .kind(CompletionItemKind::Keyword) |
43 | .snippet(snippet) | 43 | .insert_snippet(snippet) |
44 | .build() | 44 | .build() |
45 | } | 45 | } |
46 | 46 | ||
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: | |||
22 | let mut builder = TextEditBuilder::default(); | 22 | let mut builder = TextEditBuilder::default(); |
23 | builder.delete(delete_range); | 23 | builder.delete(delete_range); |
24 | CompletionItem::new(CompletionKind::Postfix, replace_range, label) | 24 | CompletionItem::new(CompletionKind::Postfix, replace_range, label) |
25 | .snippet(snippet) | 25 | .insert_snippet(snippet) |
26 | .detail(detail) | 26 | .detail(detail) |
27 | .text_edit(builder.finish()) | 27 | .text_edit(builder.finish()) |
28 | } | 28 | } |
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 | |||
2 | 2 | ||
3 | fn snippet(ctx: &CompletionContext, label: &str, snippet: &str) -> Builder { | 3 | fn snippet(ctx: &CompletionContext, label: &str, snippet: &str) -> Builder { |
4 | CompletionItem::new(CompletionKind::Snippet, ctx.source_range(), label) | 4 | CompletionItem::new(CompletionKind::Snippet, ctx.source_range(), label) |
5 | .snippet(snippet) | 5 | .insert_snippet(snippet) |
6 | .kind(CompletionItemKind::Snippet) | 6 | .kind(CompletionItemKind::Snippet) |
7 | } | 7 | } |
8 | 8 | ||
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 { | |||
199 | self.insert_text = Some(insert_text.into()); | 199 | self.insert_text = Some(insert_text.into()); |
200 | self | 200 | self |
201 | } | 201 | } |
202 | #[allow(unused)] | 202 | pub(crate) fn insert_snippet(mut self, snippet: impl Into<String>) -> Builder { |
203 | pub(crate) fn insert_text_format(mut self, insert_text_format: InsertTextFormat) -> Builder { | ||
204 | self.insert_text_format = insert_text_format; | ||
205 | self | ||
206 | } | ||
207 | pub(crate) fn snippet(mut self, snippet: impl Into<String>) -> Builder { | ||
208 | self.insert_text_format = InsertTextFormat::Snippet; | 203 | self.insert_text_format = InsertTextFormat::Snippet; |
209 | self.insert_text(snippet) | 204 | self.insert_text(snippet) |
210 | } | 205 | } |