aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_ide_api/src/completion/complete_keyword.rs2
-rw-r--r--crates/ra_ide_api/src/completion/complete_postfix.rs17
-rw-r--r--crates/ra_ide_api/src/completion/complete_snippet.rs2
-rw-r--r--crates/ra_ide_api/src/completion/completion_item.rs114
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_for.snap10
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_if_let.snap12
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_let.snap12
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__completes_break_and_continue_in_loops1.snap44
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__completes_break_and_continue_in_loops2.snap32
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__completes_prelude.snap12
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__completes_use_paths_across_crates.snap4
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__deeply_nested_use_tree.snap4
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__dont_add_semi_after_return_if_not_a_statement.snap32
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__dont_render_function_parens_if_already_call.snap6
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__dont_render_function_parens_if_already_call_assoc_fn.snap4
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__dont_render_function_parens_in_use_item.snap4
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__dont_show_both_completions_for_shadowing.snap10
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__enum_variant.snap6
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__enum_variant_with_details.snap8
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__extern_prelude.snap4
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__generic_params.snap10
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__generic_params_in_struct.snap6
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__inserts_parens_for_function_calls1.snap14
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__inserts_parens_for_function_calls2.snap14
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__inserts_parens_for_function_calls3.snap8
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function1.snap32
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function2.snap44
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function3.snap32
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function4.snap32
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_use_stmt1.snap16
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_use_stmt2.snap10
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_use_stmt3.snap10
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__last_return_in_block_has_semi1.snap32
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__last_return_in_block_has_semi2.snap32
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__method_attr_filtering.snap8
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__method_completion.snap8
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__mod_with_docs.snap4
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__module_items.snap12
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__module_items_in_nested_modules.snap10
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__nested_use_tree.snap6
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__no_semi_after_break_continue_in_expr.snap32
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__param_completion_last_param.snap4
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__param_completion_nth_param.snap4
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__param_completion_trait_param.snap4
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__postfix_completion_works_for_trivial_path_expression.snap100
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__return_type.snap10
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__self_in_methods.snap6
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__snippets_in_expressions.snap14
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__snippets_in_items.snap14
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__struct_associated_const.snap4
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__struct_associated_method.snap8
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__struct_associated_type.snap4
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__struct_field_completion.snap4
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__struct_field_completion_autoderef.snap10
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__struct_field_completion_self.snap10
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__tuple_field_completion.snap6
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__use_item_starting_with_crate.snap6
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__use_item_starting_with_self.snap4
-rw-r--r--crates/ra_lsp_server/src/conv.rs32
59 files changed, 522 insertions, 433 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
40fn keyword(ctx: &CompletionContext, kw: &str, snippet: &str) -> CompletionItem { 40fn 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..ce3d6ed3c 100644
--- a/crates/ra_ide_api/src/completion/complete_postfix.rs
+++ b/crates/ra_ide_api/src/completion/complete_postfix.rs
@@ -16,15 +16,16 @@ use ra_syntax::{
16use ra_text_edit::TextEditBuilder; 16use ra_text_edit::TextEditBuilder;
17 17
18fn postfix_snippet(ctx: &CompletionContext, label: &str, detail: &str, snippet: &str) -> Builder { 18fn postfix_snippet(ctx: &CompletionContext, label: &str, detail: &str, snippet: &str) -> Builder {
19 let replace_range = ctx.source_range(); 19 let edit = {
20 let receiver_range = ctx.dot_receiver.expect("no receiver available").syntax().range(); 20 let receiver_range = ctx.dot_receiver.expect("no receiver available").syntax().range();
21 let delete_range = TextRange::from_to(receiver_range.start(), replace_range.start()); 21 let delete_range = TextRange::from_to(receiver_range.start(), ctx.source_range().end());
22 let mut builder = TextEditBuilder::default(); 22 let mut builder = TextEditBuilder::default();
23 builder.delete(delete_range); 23 builder.replace(delete_range, snippet.to_string());
24 CompletionItem::new(CompletionKind::Postfix, replace_range, label) 24 builder.finish()
25 .snippet(snippet) 25 };
26 CompletionItem::new(CompletionKind::Postfix, ctx.source_range(), label)
26 .detail(detail) 27 .detail(detail)
27 .text_edit(builder.finish()) 28 .snippet_edit(edit)
28} 29}
29 30
30pub(super) fn complete_postfix(acc: &mut Completions, ctx: &CompletionContext) { 31pub(super) fn complete_postfix(acc: &mut Completions, ctx: &CompletionContext) {
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
3fn snippet(ctx: &CompletionContext, label: &str, snippet: &str) -> Builder { 3fn 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..95bdd59b4 100644
--- a/crates/ra_ide_api/src/completion/completion_item.rs
+++ b/crates/ra_ide_api/src/completion/completion_item.rs
@@ -2,7 +2,7 @@ use std::fmt;
2 2
3use hir::{Docs, Documentation, PerNs, Resolution}; 3use hir::{Docs, Documentation, PerNs, Resolution};
4use ra_syntax::TextRange; 4use ra_syntax::TextRange;
5use ra_text_edit::TextEdit; 5use ra_text_edit::{ TextEditBuilder, TextEdit};
6use test_utils::tested_by; 6use test_utils::tested_by;
7 7
8use crate::completion::{ 8use crate::completion::{
@@ -17,29 +17,53 @@ use crate::completion::{
17/// `CompletionItem`, use `new` method and the `Builder` struct. 17/// `CompletionItem`, use `new` method and the `Builder` struct.
18pub struct CompletionItem { 18pub struct CompletionItem {
19 /// Used only internally in tests, to check only specific kind of 19 /// Used only internally in tests, to check only specific kind of
20 /// completion. 20 /// completion (postfix, keyword, reference, etc).
21 #[allow(unused)] 21 #[allow(unused)]
22 completion_kind: CompletionKind, 22 completion_kind: CompletionKind,
23 /// Label in the completion pop up which identifies completion.
23 label: String, 24 label: String,
25 /// Range of identifier that is being completed.
26 ///
27 /// It should be used primarily for UI, but we also use this to convert
28 /// genetic TextEdit into LSP's completion edit (see conv.rs).
29 ///
30 /// `source_range` must contain the completion offset. `insert_text` should
31 /// start with what `source_range` points to, or VSCode will filter out the
32 /// completion silently.
33 source_range: TextRange,
34 /// What happens when user selects this item.
35 ///
36 /// Typically, replaces `source_range` with new identifier.
37 text_edit: TextEdit,
38 insert_text_format: InsertTextFormat,
39
40 /// What item (struct, function, etc) are we completing.
24 kind: Option<CompletionItemKind>, 41 kind: Option<CompletionItemKind>,
42
43 /// Lookup is used to check if completion item indeed can complete current
44 /// ident.
45 ///
46 /// That is, in `foo.bar<|>` lookup of `abracadabra` will be accepted (it
47 /// contains `bar` sub sequence), and `quux` will rejected.
25 lookup: Option<String>, 48 lookup: Option<String>,
49
50 /// Additional info to show in the UI pop up.
26 detail: Option<String>, 51 detail: Option<String>,
27 documentation: Option<Documentation>, 52 documentation: Option<Documentation>,
28 insert_text: Option<String>,
29 insert_text_format: InsertTextFormat,
30 /// Where completion occurs. `source_range` must contain the completion offset.
31 /// `insert_text` should start with what `source_range` points to, or VSCode
32 /// will filter out the completion silently.
33 source_range: TextRange,
34 /// Additional text edit, ranges in `text_edit` must never intersect with `source_range`.
35 /// Or VSCode will drop it silently.
36 text_edit: Option<TextEdit>,
37} 53}
38 54
55// We use custom debug for CompletionItem to make `insta`'s diffs more readable.
39impl fmt::Debug for CompletionItem { 56impl fmt::Debug for CompletionItem {
40 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 57 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
41 let mut s = f.debug_struct("CompletionItem"); 58 let mut s = f.debug_struct("CompletionItem");
42 s.field("label", &self.label()).field("source_range", &self.source_range()); 59 s.field("label", &self.label()).field("source_range", &self.source_range());
60 if self.text_edit().as_atoms().len() == 1 {
61 let atom = &self.text_edit().as_atoms()[0];
62 s.field("delete", &atom.delete);
63 s.field("insert", &atom.insert);
64 } else {
65 s.field("text_edit", &self.text_edit);
66 }
43 if let Some(kind) = self.kind().as_ref() { 67 if let Some(kind) = self.kind().as_ref() {
44 s.field("kind", kind); 68 s.field("kind", kind);
45 } 69 }
@@ -52,13 +76,6 @@ impl fmt::Debug for CompletionItem {
52 if let Some(documentation) = self.documentation() { 76 if let Some(documentation) = self.documentation() {
53 s.field("documentation", &documentation); 77 s.field("documentation", &documentation);
54 } 78 }
55 if self.insert_text() != self.label() {
56 s.field("insert_text", &self.insert_text())
57 .field("insert_text_format", &self.insert_text_format());
58 }
59 if let Some(edit) = self.text_edit.as_ref() {
60 s.field("text_edit", edit);
61 }
62 s.finish() 79 s.finish()
63 } 80 }
64} 81}
@@ -103,12 +120,12 @@ pub enum InsertTextFormat {
103impl CompletionItem { 120impl CompletionItem {
104 pub(crate) fn new( 121 pub(crate) fn new(
105 completion_kind: CompletionKind, 122 completion_kind: CompletionKind,
106 replace_range: TextRange, 123 source_range: TextRange,
107 label: impl Into<String>, 124 label: impl Into<String>,
108 ) -> Builder { 125 ) -> Builder {
109 let label = label.into(); 126 let label = label.into();
110 Builder { 127 Builder {
111 source_range: replace_range, 128 source_range,
112 completion_kind, 129 completion_kind,
113 label, 130 label,
114 insert_text: None, 131 insert_text: None,
@@ -124,6 +141,18 @@ impl CompletionItem {
124 pub fn label(&self) -> &str { 141 pub fn label(&self) -> &str {
125 &self.label 142 &self.label
126 } 143 }
144 pub fn source_range(&self) -> TextRange {
145 self.source_range
146 }
147
148 pub fn insert_text_format(&self) -> InsertTextFormat {
149 self.insert_text_format
150 }
151
152 pub fn text_edit(&self) -> &TextEdit {
153 &self.text_edit
154 }
155
127 /// Short one-line additional information, like a type 156 /// Short one-line additional information, like a type
128 pub fn detail(&self) -> Option<&str> { 157 pub fn detail(&self) -> Option<&str> {
129 self.detail.as_ref().map(|it| it.as_str()) 158 self.detail.as_ref().map(|it| it.as_str())
@@ -137,24 +166,9 @@ impl CompletionItem {
137 self.lookup.as_ref().map(|it| it.as_str()).unwrap_or_else(|| self.label()) 166 self.lookup.as_ref().map(|it| it.as_str()).unwrap_or_else(|| self.label())
138 } 167 }
139 168
140 pub fn insert_text_format(&self) -> InsertTextFormat {
141 self.insert_text_format
142 }
143 pub fn insert_text(&self) -> String {
144 match &self.insert_text {
145 Some(t) => t.clone(),
146 None => self.label.clone(),
147 }
148 }
149 pub fn kind(&self) -> Option<CompletionItemKind> { 169 pub fn kind(&self) -> Option<CompletionItemKind> {
150 self.kind 170 self.kind
151 } 171 }
152 pub fn take_text_edit(&mut self) -> Option<TextEdit> {
153 self.text_edit.take()
154 }
155 pub fn source_range(&self) -> TextRange {
156 self.source_range
157 }
158} 172}
159 173
160/// A helper to make `CompletionItem`s. 174/// A helper to make `CompletionItem`s.
@@ -178,17 +192,27 @@ impl Builder {
178 } 192 }
179 193
180 pub(crate) fn build(self) -> CompletionItem { 194 pub(crate) fn build(self) -> CompletionItem {
195 let label = self.label;
196 let text_edit = match self.text_edit {
197 Some(it) => it,
198 None => {
199 let mut builder = TextEditBuilder::default();
200 builder
201 .replace(self.source_range, self.insert_text.unwrap_or_else(|| label.clone()));
202 builder.finish()
203 }
204 };
205
181 CompletionItem { 206 CompletionItem {
182 source_range: self.source_range, 207 source_range: self.source_range,
183 label: self.label, 208 label,
209 insert_text_format: self.insert_text_format,
210 text_edit,
184 detail: self.detail, 211 detail: self.detail,
185 documentation: self.documentation, 212 documentation: self.documentation,
186 insert_text_format: self.insert_text_format,
187 lookup: self.lookup, 213 lookup: self.lookup,
188 kind: self.kind, 214 kind: self.kind,
189 completion_kind: self.completion_kind, 215 completion_kind: self.completion_kind,
190 text_edit: self.text_edit,
191 insert_text: self.insert_text,
192 } 216 }
193 } 217 }
194 pub(crate) fn lookup_by(mut self, lookup: impl Into<String>) -> Builder { 218 pub(crate) fn lookup_by(mut self, lookup: impl Into<String>) -> Builder {
@@ -199,12 +223,7 @@ impl Builder {
199 self.insert_text = Some(insert_text.into()); 223 self.insert_text = Some(insert_text.into());
200 self 224 self
201 } 225 }
202 #[allow(unused)] 226 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; 227 self.insert_text_format = InsertTextFormat::Snippet;
209 self.insert_text(snippet) 228 self.insert_text(snippet)
210 } 229 }
@@ -212,11 +231,14 @@ impl Builder {
212 self.kind = Some(kind); 231 self.kind = Some(kind);
213 self 232 self
214 } 233 }
215 #[allow(unused)]
216 pub(crate) fn text_edit(mut self, edit: TextEdit) -> Builder { 234 pub(crate) fn text_edit(mut self, edit: TextEdit) -> Builder {
217 self.text_edit = Some(edit); 235 self.text_edit = Some(edit);
218 self 236 self
219 } 237 }
238 pub(crate) fn snippet_edit(mut self, edit: TextEdit) -> Builder {
239 self.insert_text_format = InsertTextFormat::Snippet;
240 self.text_edit(edit)
241 }
220 #[allow(unused)] 242 #[allow(unused)]
221 pub(crate) fn detail(self, detail: impl Into<String>) -> Builder { 243 pub(crate) fn detail(self, detail: impl Into<String>) -> Builder {
222 self.set_detail(Some(detail)) 244 self.set_detail(Some(detail))
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_for.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_for.snap
index 799daa724..bd7f99f71 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_for.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_for.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.736783986Z" 2created: "2019-02-18T09:22:24.132341107Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,14 +8,16 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "quux", 9 label: "quux",
10 source_range: [83; 83), 10 source_range: [83; 83),
11 delete: [83; 83),
12 insert: "quux()$0",
11 kind: Function, 13 kind: Function,
12 detail: "fn quux()", 14 detail: "fn quux()"
13 insert_text: "quux()$0",
14 insert_text_format: Snippet
15 }, 15 },
16 CompletionItem { 16 CompletionItem {
17 label: "x", 17 label: "x",
18 source_range: [83; 83), 18 source_range: [83; 83),
19 delete: [83; 83),
20 insert: "x",
19 kind: Binding 21 kind: Binding
20 } 22 }
21] 23]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_if_let.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_if_let.snap
index e6c1a936a..3b374c4de 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_if_let.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_if_let.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.739513594Z" 2created: "2019-02-18T09:22:24.126809445Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,19 +8,23 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "a", 9 label: "a",
10 source_range: [214; 214), 10 source_range: [214; 214),
11 delete: [214; 214),
12 insert: "a",
11 kind: Binding 13 kind: Binding
12 }, 14 },
13 CompletionItem { 15 CompletionItem {
14 label: "b", 16 label: "b",
15 source_range: [214; 214), 17 source_range: [214; 214),
18 delete: [214; 214),
19 insert: "b",
16 kind: Binding 20 kind: Binding
17 }, 21 },
18 CompletionItem { 22 CompletionItem {
19 label: "quux", 23 label: "quux",
20 source_range: [214; 214), 24 source_range: [214; 214),
25 delete: [214; 214),
26 insert: "quux()$0",
21 kind: Function, 27 kind: Function,
22 detail: "fn quux()", 28 detail: "fn quux()"
23 insert_text: "quux()$0",
24 insert_text_format: Snippet
25 } 29 }
26] 30]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_let.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_let.snap
index 2b0da7d73..173f5319a 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_let.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_let.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.739513592Z" 2created: "2019-02-18T09:22:24.126696322Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,19 +8,23 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "quux", 9 label: "quux",
10 source_range: [79; 79), 10 source_range: [79; 79),
11 delete: [79; 79),
12 insert: "quux($0)",
11 kind: Function, 13 kind: Function,
12 detail: "fn quux(x: i32)", 14 detail: "fn quux(x: i32)"
13 insert_text: "quux($0)",
14 insert_text_format: Snippet
15 }, 15 },
16 CompletionItem { 16 CompletionItem {
17 label: "x", 17 label: "x",
18 source_range: [79; 79), 18 source_range: [79; 79),
19 delete: [79; 79),
20 insert: "x",
19 kind: Binding 21 kind: Binding
20 }, 22 },
21 CompletionItem { 23 CompletionItem {
22 label: "y", 24 label: "y",
23 source_range: [79; 79), 25 source_range: [79; 79),
26 delete: [79; 79),
27 insert: "y",
24 kind: Binding 28 kind: Binding
25 } 29 }
26] 30]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__completes_break_and_continue_in_loops1.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__completes_break_and_continue_in_loops1.snap
index 5d62a6cb0..42ff02469 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__completes_break_and_continue_in_loops1.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__completes_break_and_continue_in_loops1.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.630948152Z" 2created: "2019-02-18T09:22:23.976673150Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,50 +8,50 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "break", 9 label: "break",
10 source_range: [55; 55), 10 source_range: [55; 55),
11 kind: Keyword, 11 delete: [55; 55),
12 insert_text: "break;", 12 insert: "break;",
13 insert_text_format: Snippet 13 kind: Keyword
14 }, 14 },
15 CompletionItem { 15 CompletionItem {
16 label: "continue", 16 label: "continue",
17 source_range: [55; 55), 17 source_range: [55; 55),
18 kind: Keyword, 18 delete: [55; 55),
19 insert_text: "continue;", 19 insert: "continue;",
20 insert_text_format: Snippet 20 kind: Keyword
21 }, 21 },
22 CompletionItem { 22 CompletionItem {
23 label: "if", 23 label: "if",
24 source_range: [55; 55), 24 source_range: [55; 55),
25 kind: Keyword, 25 delete: [55; 55),
26 insert_text: "if $0 {}", 26 insert: "if $0 {}",
27 insert_text_format: Snippet 27 kind: Keyword
28 }, 28 },
29 CompletionItem { 29 CompletionItem {
30 label: "loop", 30 label: "loop",
31 source_range: [55; 55), 31 source_range: [55; 55),
32 kind: Keyword, 32 delete: [55; 55),
33 insert_text: "loop {$0}", 33 insert: "loop {$0}",
34 insert_text_format: Snippet 34 kind: Keyword
35 }, 35 },
36 CompletionItem { 36 CompletionItem {
37 label: "match", 37 label: "match",
38 source_range: [55; 55), 38 source_range: [55; 55),
39 kind: Keyword, 39 delete: [55; 55),
40 insert_text: "match $0 {}", 40 insert: "match $0 {}",
41 insert_text_format: Snippet 41 kind: Keyword
42 }, 42 },
43 CompletionItem { 43 CompletionItem {
44 label: "return", 44 label: "return",
45 source_range: [55; 55), 45 source_range: [55; 55),
46 kind: Keyword, 46 delete: [55; 55),
47 insert_text: "return $0;", 47 insert: "return $0;",
48 insert_text_format: Snippet 48 kind: Keyword
49 }, 49 },
50 CompletionItem { 50 CompletionItem {
51 label: "while", 51 label: "while",
52 source_range: [55; 55), 52 source_range: [55; 55),
53 kind: Keyword, 53 delete: [55; 55),
54 insert_text: "while $0 {}", 54 insert: "while $0 {}",
55 insert_text_format: Snippet 55 kind: Keyword
56 } 56 }
57] 57]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__completes_break_and_continue_in_loops2.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__completes_break_and_continue_in_loops2.snap
index aeedd0e80..057ff8a7a 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__completes_break_and_continue_in_loops2.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__completes_break_and_continue_in_loops2.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.662074625Z" 2created: "2019-02-18T09:22:24.068967569Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,36 +8,36 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "if", 9 label: "if",
10 source_range: [60; 60), 10 source_range: [60; 60),
11 kind: Keyword, 11 delete: [60; 60),
12 insert_text: "if $0 {}", 12 insert: "if $0 {}",
13 insert_text_format: Snippet 13 kind: Keyword
14 }, 14 },
15 CompletionItem { 15 CompletionItem {
16 label: "loop", 16 label: "loop",
17 source_range: [60; 60), 17 source_range: [60; 60),
18 kind: Keyword, 18 delete: [60; 60),
19 insert_text: "loop {$0}", 19 insert: "loop {$0}",
20 insert_text_format: Snippet 20 kind: Keyword
21 }, 21 },
22 CompletionItem { 22 CompletionItem {
23 label: "match", 23 label: "match",
24 source_range: [60; 60), 24 source_range: [60; 60),
25 kind: Keyword, 25 delete: [60; 60),
26 insert_text: "match $0 {}", 26 insert: "match $0 {}",
27 insert_text_format: Snippet 27 kind: Keyword
28 }, 28 },
29 CompletionItem { 29 CompletionItem {
30 label: "return", 30 label: "return",
31 source_range: [60; 60), 31 source_range: [60; 60),
32 kind: Keyword, 32 delete: [60; 60),
33 insert_text: "return $0;", 33 insert: "return $0;",
34 insert_text_format: Snippet 34 kind: Keyword
35 }, 35 },
36 CompletionItem { 36 CompletionItem {
37 label: "while", 37 label: "while",
38 source_range: [60; 60), 38 source_range: [60; 60),
39 kind: Keyword, 39 delete: [60; 60),
40 insert_text: "while $0 {}", 40 insert: "while $0 {}",
41 insert_text_format: Snippet 41 kind: Keyword
42 } 42 }
43] 43]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__completes_prelude.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__completes_prelude.snap
index a22205dad..16126ee77 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__completes_prelude.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__completes_prelude.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.774580359Z" 2created: "2019-02-18T09:22:24.180517434Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,19 +8,23 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "Option", 9 label: "Option",
10 source_range: [18; 18), 10 source_range: [18; 18),
11 delete: [18; 18),
12 insert: "Option",
11 kind: Struct 13 kind: Struct
12 }, 14 },
13 CompletionItem { 15 CompletionItem {
14 label: "foo", 16 label: "foo",
15 source_range: [18; 18), 17 source_range: [18; 18),
18 delete: [18; 18),
19 insert: "foo()$0",
16 kind: Function, 20 kind: Function,
17 detail: "fn foo()", 21 detail: "fn foo()"
18 insert_text: "foo()$0",
19 insert_text_format: Snippet
20 }, 22 },
21 CompletionItem { 23 CompletionItem {
22 label: "std", 24 label: "std",
23 source_range: [18; 18), 25 source_range: [18; 18),
26 delete: [18; 18),
27 insert: "std",
24 kind: Module 28 kind: Module
25 } 29 }
26] 30]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__completes_use_paths_across_crates.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__completes_use_paths_across_crates.snap
index fcbb592e1..2420e7744 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__completes_use_paths_across_crates.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__completes_use_paths_across_crates.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.729954589Z" 2created: "2019-02-18T09:22:24.118807216Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,6 +8,8 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "bar", 9 label: "bar",
10 source_range: [9; 9), 10 source_range: [9; 9),
11 delete: [9; 9),
12 insert: "bar",
11 kind: Module 13 kind: Module
12 } 14 }
13] 15]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__deeply_nested_use_tree.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__deeply_nested_use_tree.snap
index 3c5460319..c472f7965 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__deeply_nested_use_tree.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__deeply_nested_use_tree.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.663233766Z" 2created: "2019-02-18T09:22:24.044567777Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,6 +8,8 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "Spam", 9 label: "Spam",
10 source_range: [23; 25), 10 source_range: [23; 25),
11 delete: [23; 25),
12 insert: "Spam",
11 kind: Struct 13 kind: Struct
12 } 14 }
13] 15]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_add_semi_after_return_if_not_a_statement.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_add_semi_after_return_if_not_a_statement.snap
index 493684e5b..97bd76c49 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_add_semi_after_return_if_not_a_statement.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_add_semi_after_return_if_not_a_statement.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.637726929Z" 2created: "2019-02-18T09:22:23.987788705Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,36 +8,36 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "if", 9 label: "if",
10 source_range: [85; 85), 10 source_range: [85; 85),
11 kind: Keyword, 11 delete: [85; 85),
12 insert_text: "if $0 {}", 12 insert: "if $0 {}",
13 insert_text_format: Snippet 13 kind: Keyword
14 }, 14 },
15 CompletionItem { 15 CompletionItem {
16 label: "loop", 16 label: "loop",
17 source_range: [85; 85), 17 source_range: [85; 85),
18 kind: Keyword, 18 delete: [85; 85),
19 insert_text: "loop {$0}", 19 insert: "loop {$0}",
20 insert_text_format: Snippet 20 kind: Keyword
21 }, 21 },
22 CompletionItem { 22 CompletionItem {
23 label: "match", 23 label: "match",
24 source_range: [85; 85), 24 source_range: [85; 85),
25 kind: Keyword, 25 delete: [85; 85),
26 insert_text: "match $0 {}", 26 insert: "match $0 {}",
27 insert_text_format: Snippet 27 kind: Keyword
28 }, 28 },
29 CompletionItem { 29 CompletionItem {
30 label: "return", 30 label: "return",
31 source_range: [85; 85), 31 source_range: [85; 85),
32 kind: Keyword, 32 delete: [85; 85),
33 insert_text: "return $0", 33 insert: "return $0",
34 insert_text_format: Snippet 34 kind: Keyword
35 }, 35 },
36 CompletionItem { 36 CompletionItem {
37 label: "while", 37 label: "while",
38 source_range: [85; 85), 38 source_range: [85; 85),
39 kind: Keyword, 39 delete: [85; 85),
40 insert_text: "while $0 {}", 40 insert: "while $0 {}",
41 insert_text_format: Snippet 41 kind: Keyword
42 } 42 }
43] 43]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_render_function_parens_if_already_call.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_render_function_parens_if_already_call.snap
index 4e37dbef1..1de0efb5b 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_render_function_parens_if_already_call.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_render_function_parens_if_already_call.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.812347626Z" 2created: "2019-02-18T09:22:24.211680376Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,12 +8,16 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "frobnicate", 9 label: "frobnicate",
10 source_range: [35; 39), 10 source_range: [35; 39),
11 delete: [35; 39),
12 insert: "frobnicate",
11 kind: Function, 13 kind: Function,
12 detail: "fn frobnicate()" 14 detail: "fn frobnicate()"
13 }, 15 },
14 CompletionItem { 16 CompletionItem {
15 label: "main", 17 label: "main",
16 source_range: [35; 39), 18 source_range: [35; 39),
19 delete: [35; 39),
20 insert: "main",
17 kind: Function, 21 kind: Function,
18 detail: "fn main()" 22 detail: "fn main()"
19 } 23 }
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_render_function_parens_if_already_call_assoc_fn.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_render_function_parens_if_already_call_assoc_fn.snap
index 2ba9c82b0..39fff2cb7 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_render_function_parens_if_already_call_assoc_fn.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_render_function_parens_if_already_call_assoc_fn.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.843178841Z" 2created: "2019-02-18T09:22:24.268227065Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,6 +8,8 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "new", 9 label: "new",
10 source_range: [67; 69), 10 source_range: [67; 69),
11 delete: [67; 69),
12 insert: "new",
11 kind: Method, 13 kind: Method,
12 detail: "fn new() -> Foo" 14 detail: "fn new() -> Foo"
13 } 15 }
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_render_function_parens_in_use_item.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_render_function_parens_in_use_item.snap
index c071ff198..ef77816ec 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_render_function_parens_in_use_item.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_render_function_parens_in_use_item.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.808400485Z" 2created: "2019-02-18T09:22:24.213677341Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,6 +8,8 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "foo", 9 label: "foo",
10 source_range: [40; 41), 10 source_range: [40; 41),
11 delete: [40; 41),
12 insert: "foo",
11 kind: Function, 13 kind: Function,
12 detail: "pub fn foo()" 14 detail: "pub fn foo()"
13 } 15 }
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_show_both_completions_for_shadowing.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_show_both_completions_for_shadowing.snap
index 68bfbcdcd..87691b304 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_show_both_completions_for_shadowing.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_show_both_completions_for_shadowing.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.810202671Z" 2created: "2019-02-18T09:22:24.188564584Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,14 +8,16 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "bar", 9 label: "bar",
10 source_range: [129; 129), 10 source_range: [129; 129),
11 delete: [129; 129),
12 insert: "bar",
11 kind: Binding 13 kind: Binding
12 }, 14 },
13 CompletionItem { 15 CompletionItem {
14 label: "foo", 16 label: "foo",
15 source_range: [129; 129), 17 source_range: [129; 129),
18 delete: [129; 129),
19 insert: "foo()$0",
16 kind: Function, 20 kind: Function,
17 detail: "fn foo() ->", 21 detail: "fn foo() ->"
18 insert_text: "foo()$0",
19 insert_text_format: Snippet
20 } 22 }
21] 23]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__enum_variant.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__enum_variant.snap
index b4a8443a0..1df121523 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__enum_variant.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__enum_variant.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.672144115Z" 2created: "2019-02-18T09:22:24.045355450Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,6 +8,8 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "Bar", 9 label: "Bar",
10 source_range: [116; 116), 10 source_range: [116; 116),
11 delete: [116; 116),
12 insert: "Bar",
11 kind: EnumVariant, 13 kind: EnumVariant,
12 detail: "(i32)", 14 detail: "(i32)",
13 documentation: Documentation( 15 documentation: Documentation(
@@ -17,6 +19,8 @@ expression: kind_completions
17 CompletionItem { 19 CompletionItem {
18 label: "Foo", 20 label: "Foo",
19 source_range: [116; 116), 21 source_range: [116; 116),
22 delete: [116; 116),
23 insert: "Foo",
20 kind: EnumVariant, 24 kind: EnumVariant,
21 detail: "()", 25 detail: "()",
22 documentation: Documentation( 26 documentation: Documentation(
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__enum_variant_with_details.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__enum_variant_with_details.snap
index 8f6defc4f..70ea96e1b 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__enum_variant_with_details.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__enum_variant_with_details.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.686329490Z" 2created: "2019-02-18T09:22:24.062138085Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,6 +8,8 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "Bar", 9 label: "Bar",
10 source_range: [180; 180), 10 source_range: [180; 180),
11 delete: [180; 180),
12 insert: "Bar",
11 kind: EnumVariant, 13 kind: EnumVariant,
12 detail: "(i32, u32)", 14 detail: "(i32, u32)",
13 documentation: Documentation( 15 documentation: Documentation(
@@ -17,6 +19,8 @@ expression: kind_completions
17 CompletionItem { 19 CompletionItem {
18 label: "Foo", 20 label: "Foo",
19 source_range: [180; 180), 21 source_range: [180; 180),
22 delete: [180; 180),
23 insert: "Foo",
20 kind: EnumVariant, 24 kind: EnumVariant,
21 detail: "()", 25 detail: "()",
22 documentation: Documentation( 26 documentation: Documentation(
@@ -26,6 +30,8 @@ expression: kind_completions
26 CompletionItem { 30 CompletionItem {
27 label: "S", 31 label: "S",
28 source_range: [180; 180), 32 source_range: [180; 180),
33 delete: [180; 180),
34 insert: "S",
29 kind: EnumVariant, 35 kind: EnumVariant,
30 detail: "(S)" 36 detail: "(S)"
31 } 37 }
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__extern_prelude.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__extern_prelude.snap
index 2a2959fd2..0d36fd603 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__extern_prelude.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__extern_prelude.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.763042807Z" 2created: "2019-02-18T09:22:24.137183638Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,6 +8,8 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "other_crate", 9 label: "other_crate",
10 source_range: [4; 4), 10 source_range: [4; 4),
11 delete: [4; 4),
12 insert: "other_crate",
11 kind: Module 13 kind: Module
12 } 14 }
13] 15]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__generic_params.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__generic_params.snap
index 5e1a876da..210e5a02d 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__generic_params.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__generic_params.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.765665697Z" 2created: "2019-02-18T09:22:24.143253235Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,14 +8,16 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "T", 9 label: "T",
10 source_range: [44; 44), 10 source_range: [44; 44),
11 delete: [44; 44),
12 insert: "T",
11 kind: TypeParam 13 kind: TypeParam
12 }, 14 },
13 CompletionItem { 15 CompletionItem {
14 label: "quux", 16 label: "quux",
15 source_range: [44; 44), 17 source_range: [44; 44),
18 delete: [44; 44),
19 insert: "quux()$0",
16 kind: Function, 20 kind: Function,
17 detail: "fn quux<T>()", 21 detail: "fn quux<T>()"
18 insert_text: "quux()$0",
19 insert_text_format: Snippet
20 } 22 }
21] 23]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__generic_params_in_struct.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__generic_params_in_struct.snap
index b0c9bff03..ab8c30446 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__generic_params_in_struct.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__generic_params_in_struct.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.768275744Z" 2created: "2019-02-18T09:22:24.149424158Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,11 +8,15 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "T", 9 label: "T",
10 source_range: [46; 46), 10 source_range: [46; 46),
11 delete: [46; 46),
12 insert: "T",
11 kind: TypeParam 13 kind: TypeParam
12 }, 14 },
13 CompletionItem { 15 CompletionItem {
14 label: "X", 16 label: "X",
15 source_range: [46; 46), 17 source_range: [46; 46),
18 delete: [46; 46),
19 insert: "X",
16 kind: Struct 20 kind: Struct
17 } 21 }
18] 22]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__inserts_parens_for_function_calls1.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__inserts_parens_for_function_calls1.snap
index 8ef0a4b7a..a4fc447b2 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__inserts_parens_for_function_calls1.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__inserts_parens_for_function_calls1.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.808403924Z" 2created: "2019-02-18T09:22:24.224510370Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,17 +8,17 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "main", 9 label: "main",
10 source_range: [53; 56), 10 source_range: [53; 56),
11 delete: [53; 56),
12 insert: "main()$0",
11 kind: Function, 13 kind: Function,
12 detail: "fn main()", 14 detail: "fn main()"
13 insert_text: "main()$0",
14 insert_text_format: Snippet
15 }, 15 },
16 CompletionItem { 16 CompletionItem {
17 label: "no_args", 17 label: "no_args",
18 source_range: [53; 56), 18 source_range: [53; 56),
19 delete: [53; 56),
20 insert: "no_args()$0",
19 kind: Function, 21 kind: Function,
20 detail: "fn no_args()", 22 detail: "fn no_args()"
21 insert_text: "no_args()$0",
22 insert_text_format: Snippet
23 } 23 }
24] 24]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__inserts_parens_for_function_calls2.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__inserts_parens_for_function_calls2.snap
index 32730639e..b124355d5 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__inserts_parens_for_function_calls2.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__inserts_parens_for_function_calls2.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.843178843Z" 2created: "2019-02-18T09:22:24.267013140Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,17 +8,17 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "main", 9 label: "main",
10 source_range: [72; 77), 10 source_range: [72; 77),
11 delete: [72; 77),
12 insert: "main()$0",
11 kind: Function, 13 kind: Function,
12 detail: "fn main()", 14 detail: "fn main()"
13 insert_text: "main()$0",
14 insert_text_format: Snippet
15 }, 15 },
16 CompletionItem { 16 CompletionItem {
17 label: "with_args", 17 label: "with_args",
18 source_range: [72; 77), 18 source_range: [72; 77),
19 delete: [72; 77),
20 insert: "with_args($0)",
19 kind: Function, 21 kind: Function,
20 detail: "fn with_args(x: i32, y: String)", 22 detail: "fn with_args(x: i32, y: String)"
21 insert_text: "with_args($0)",
22 insert_text_format: Snippet
23 } 23 }
24] 24]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__inserts_parens_for_function_calls3.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__inserts_parens_for_function_calls3.snap
index 99f21b258..fec729d48 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__inserts_parens_for_function_calls3.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__inserts_parens_for_function_calls3.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.877573951Z" 2created: "2019-02-18T09:22:24.303360770Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,9 +8,9 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "foo", 9 label: "foo",
10 source_range: [139; 140), 10 source_range: [139; 140),
11 delete: [139; 140),
12 insert: "foo()$0",
11 kind: Method, 13 kind: Method,
12 detail: "fn foo(&self)", 14 detail: "fn foo(&self)"
13 insert_text: "foo()$0",
14 insert_text_format: Snippet
15 } 15 }
16] 16]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function1.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function1.snap
index 022e3f6e9..045e2a4e6 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function1.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function1.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.639066512Z" 2created: "2019-02-18T09:22:23.987788720Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,36 +8,36 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "if", 9 label: "if",
10 source_range: [41; 41), 10 source_range: [41; 41),
11 kind: Keyword, 11 delete: [41; 41),
12 insert_text: "if $0 {}", 12 insert: "if $0 {}",
13 insert_text_format: Snippet 13 kind: Keyword
14 }, 14 },
15 CompletionItem { 15 CompletionItem {
16 label: "loop", 16 label: "loop",
17 source_range: [41; 41), 17 source_range: [41; 41),
18 kind: Keyword, 18 delete: [41; 41),
19 insert_text: "loop {$0}", 19 insert: "loop {$0}",
20 insert_text_format: Snippet 20 kind: Keyword
21 }, 21 },
22 CompletionItem { 22 CompletionItem {
23 label: "match", 23 label: "match",
24 source_range: [41; 41), 24 source_range: [41; 41),
25 kind: Keyword, 25 delete: [41; 41),
26 insert_text: "match $0 {}", 26 insert: "match $0 {}",
27 insert_text_format: Snippet 27 kind: Keyword
28 }, 28 },
29 CompletionItem { 29 CompletionItem {
30 label: "return", 30 label: "return",
31 source_range: [41; 41), 31 source_range: [41; 41),
32 kind: Keyword, 32 delete: [41; 41),
33 insert_text: "return;", 33 insert: "return;",
34 insert_text_format: Snippet 34 kind: Keyword
35 }, 35 },
36 CompletionItem { 36 CompletionItem {
37 label: "while", 37 label: "while",
38 source_range: [41; 41), 38 source_range: [41; 41),
39 kind: Keyword, 39 delete: [41; 41),
40 insert_text: "while $0 {}", 40 insert: "while $0 {}",
41 insert_text_format: Snippet 41 kind: Keyword
42 } 42 }
43] 43]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function2.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function2.snap
index fd63c1678..b08efa522 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function2.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function2.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.630760038Z" 2created: "2019-02-18T09:22:23.984740354Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,50 +8,50 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "else", 9 label: "else",
10 source_range: [92; 92), 10 source_range: [92; 92),
11 kind: Keyword, 11 delete: [92; 92),
12 insert_text: "else {$0}", 12 insert: "else {$0}",
13 insert_text_format: Snippet 13 kind: Keyword
14 }, 14 },
15 CompletionItem { 15 CompletionItem {
16 label: "else if", 16 label: "else if",
17 source_range: [92; 92), 17 source_range: [92; 92),
18 kind: Keyword, 18 delete: [92; 92),
19 insert_text: "else if $0 {}", 19 insert: "else if $0 {}",
20 insert_text_format: Snippet 20 kind: Keyword
21 }, 21 },
22 CompletionItem { 22 CompletionItem {
23 label: "if", 23 label: "if",
24 source_range: [92; 92), 24 source_range: [92; 92),
25 kind: Keyword, 25 delete: [92; 92),
26 insert_text: "if $0 {}", 26 insert: "if $0 {}",
27 insert_text_format: Snippet 27 kind: Keyword
28 }, 28 },
29 CompletionItem { 29 CompletionItem {
30 label: "loop", 30 label: "loop",
31 source_range: [92; 92), 31 source_range: [92; 92),
32 kind: Keyword, 32 delete: [92; 92),
33 insert_text: "loop {$0}", 33 insert: "loop {$0}",
34 insert_text_format: Snippet 34 kind: Keyword
35 }, 35 },
36 CompletionItem { 36 CompletionItem {
37 label: "match", 37 label: "match",
38 source_range: [92; 92), 38 source_range: [92; 92),
39 kind: Keyword, 39 delete: [92; 92),
40 insert_text: "match $0 {}", 40 insert: "match $0 {}",
41 insert_text_format: Snippet 41 kind: Keyword
42 }, 42 },
43 CompletionItem { 43 CompletionItem {
44 label: "return", 44 label: "return",
45 source_range: [92; 92), 45 source_range: [92; 92),
46 kind: Keyword, 46 delete: [92; 92),
47 insert_text: "return;", 47 insert: "return;",
48 insert_text_format: Snippet 48 kind: Keyword
49 }, 49 },
50 CompletionItem { 50 CompletionItem {
51 label: "while", 51 label: "while",
52 source_range: [92; 92), 52 source_range: [92; 92),
53 kind: Keyword, 53 delete: [92; 92),
54 insert_text: "while $0 {}", 54 insert: "while $0 {}",
55 insert_text_format: Snippet 55 kind: Keyword
56 } 56 }
57] 57]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function3.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function3.snap
index 90f769078..e2b9214fb 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function3.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function3.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.659527166Z" 2created: "2019-02-18T09:22:24.049699338Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,36 +8,36 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "if", 9 label: "if",
10 source_range: [48; 48), 10 source_range: [48; 48),
11 kind: Keyword, 11 delete: [48; 48),
12 insert_text: "if $0 {}", 12 insert: "if $0 {}",
13 insert_text_format: Snippet 13 kind: Keyword
14 }, 14 },
15 CompletionItem { 15 CompletionItem {
16 label: "loop", 16 label: "loop",
17 source_range: [48; 48), 17 source_range: [48; 48),
18 kind: Keyword, 18 delete: [48; 48),
19 insert_text: "loop {$0}", 19 insert: "loop {$0}",
20 insert_text_format: Snippet 20 kind: Keyword
21 }, 21 },
22 CompletionItem { 22 CompletionItem {
23 label: "match", 23 label: "match",
24 source_range: [48; 48), 24 source_range: [48; 48),
25 kind: Keyword, 25 delete: [48; 48),
26 insert_text: "match $0 {}", 26 insert: "match $0 {}",
27 insert_text_format: Snippet 27 kind: Keyword
28 }, 28 },
29 CompletionItem { 29 CompletionItem {
30 label: "return", 30 label: "return",
31 source_range: [48; 48), 31 source_range: [48; 48),
32 kind: Keyword, 32 delete: [48; 48),
33 insert_text: "return $0;", 33 insert: "return $0;",
34 insert_text_format: Snippet 34 kind: Keyword
35 }, 35 },
36 CompletionItem { 36 CompletionItem {
37 label: "while", 37 label: "while",
38 source_range: [48; 48), 38 source_range: [48; 48),
39 kind: Keyword, 39 delete: [48; 48),
40 insert_text: "while $0 {}", 40 insert: "while $0 {}",
41 insert_text_format: Snippet 41 kind: Keyword
42 } 42 }
43] 43]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function4.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function4.snap
index 5e7ec108c..1ea7eb5ce 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function4.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function4.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.696757543Z" 2created: "2019-02-18T09:22:24.090949782Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,36 +8,36 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "if", 9 label: "if",
10 source_range: [41; 41), 10 source_range: [41; 41),
11 kind: Keyword, 11 delete: [41; 41),
12 insert_text: "if $0 {}", 12 insert: "if $0 {}",
13 insert_text_format: Snippet 13 kind: Keyword
14 }, 14 },
15 CompletionItem { 15 CompletionItem {
16 label: "loop", 16 label: "loop",
17 source_range: [41; 41), 17 source_range: [41; 41),
18 kind: Keyword, 18 delete: [41; 41),
19 insert_text: "loop {$0}", 19 insert: "loop {$0}",
20 insert_text_format: Snippet 20 kind: Keyword
21 }, 21 },
22 CompletionItem { 22 CompletionItem {
23 label: "match", 23 label: "match",
24 source_range: [41; 41), 24 source_range: [41; 41),
25 kind: Keyword, 25 delete: [41; 41),
26 insert_text: "match $0 {}", 26 insert: "match $0 {}",
27 insert_text_format: Snippet 27 kind: Keyword
28 }, 28 },
29 CompletionItem { 29 CompletionItem {
30 label: "return", 30 label: "return",
31 source_range: [41; 41), 31 source_range: [41; 41),
32 kind: Keyword, 32 delete: [41; 41),
33 insert_text: "return;", 33 insert: "return;",
34 insert_text_format: Snippet 34 kind: Keyword
35 }, 35 },
36 CompletionItem { 36 CompletionItem {
37 label: "while", 37 label: "while",
38 source_range: [41; 41), 38 source_range: [41; 41),
39 kind: Keyword, 39 delete: [41; 41),
40 insert_text: "while $0 {}", 40 insert: "while $0 {}",
41 insert_text_format: Snippet 41 kind: Keyword
42 } 42 }
43] 43]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_use_stmt1.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_use_stmt1.snap
index f969a843b..76d5daf55 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_use_stmt1.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_use_stmt1.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.633925638Z" 2created: "2019-02-18T09:22:23.988755424Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,20 +8,22 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "crate", 9 label: "crate",
10 source_range: [17; 17), 10 source_range: [17; 17),
11 kind: Keyword, 11 delete: [17; 17),
12 insert_text: "crate::", 12 insert: "crate::",
13 insert_text_format: PlainText 13 kind: Keyword
14 }, 14 },
15 CompletionItem { 15 CompletionItem {
16 label: "self", 16 label: "self",
17 source_range: [17; 17), 17 source_range: [17; 17),
18 delete: [17; 17),
19 insert: "self",
18 kind: Keyword 20 kind: Keyword
19 }, 21 },
20 CompletionItem { 22 CompletionItem {
21 label: "super", 23 label: "super",
22 source_range: [17; 17), 24 source_range: [17; 17),
23 kind: Keyword, 25 delete: [17; 17),
24 insert_text: "super::", 26 insert: "super::",
25 insert_text_format: PlainText 27 kind: Keyword
26 } 28 }
27] 29]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_use_stmt2.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_use_stmt2.snap
index bbbdeae8f..ee8bf4ca1 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_use_stmt2.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_use_stmt2.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.658885169Z" 2created: "2019-02-18T09:22:24.030382527Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,13 +8,15 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "self", 9 label: "self",
10 source_range: [20; 20), 10 source_range: [20; 20),
11 delete: [20; 20),
12 insert: "self",
11 kind: Keyword 13 kind: Keyword
12 }, 14 },
13 CompletionItem { 15 CompletionItem {
14 label: "super", 16 label: "super",
15 source_range: [20; 20), 17 source_range: [20; 20),
16 kind: Keyword, 18 delete: [20; 20),
17 insert_text: "super::", 19 insert: "super::",
18 insert_text_format: PlainText 20 kind: Keyword
19 } 21 }
20] 22]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_use_stmt3.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_use_stmt3.snap
index 84475e0d8..b44db276e 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_use_stmt3.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_use_stmt3.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.688856977Z" 2created: "2019-02-18T09:22:24.073607133Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,13 +8,15 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "self", 9 label: "self",
10 source_range: [24; 24), 10 source_range: [24; 24),
11 delete: [24; 24),
12 insert: "self",
11 kind: Keyword 13 kind: Keyword
12 }, 14 },
13 CompletionItem { 15 CompletionItem {
14 label: "super", 16 label: "super",
15 source_range: [24; 24), 17 source_range: [24; 24),
16 kind: Keyword, 18 delete: [24; 24),
17 insert_text: "super::", 19 insert: "super::",
18 insert_text_format: PlainText 20 kind: Keyword
19 } 21 }
20] 22]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__last_return_in_block_has_semi1.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__last_return_in_block_has_semi1.snap
index 5d12dd41b..f220d35c2 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__last_return_in_block_has_semi1.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__last_return_in_block_has_semi1.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.638715790Z" 2created: "2019-02-18T09:22:23.989188654Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,36 +8,36 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "if", 9 label: "if",
10 source_range: [83; 83), 10 source_range: [83; 83),
11 kind: Keyword, 11 delete: [83; 83),
12 insert_text: "if $0 {}", 12 insert: "if $0 {}",
13 insert_text_format: Snippet 13 kind: Keyword
14 }, 14 },
15 CompletionItem { 15 CompletionItem {
16 label: "loop", 16 label: "loop",
17 source_range: [83; 83), 17 source_range: [83; 83),
18 kind: Keyword, 18 delete: [83; 83),
19 insert_text: "loop {$0}", 19 insert: "loop {$0}",
20 insert_text_format: Snippet 20 kind: Keyword
21 }, 21 },
22 CompletionItem { 22 CompletionItem {
23 label: "match", 23 label: "match",
24 source_range: [83; 83), 24 source_range: [83; 83),
25 kind: Keyword, 25 delete: [83; 83),
26 insert_text: "match $0 {}", 26 insert: "match $0 {}",
27 insert_text_format: Snippet 27 kind: Keyword
28 }, 28 },
29 CompletionItem { 29 CompletionItem {
30 label: "return", 30 label: "return",
31 source_range: [83; 83), 31 source_range: [83; 83),
32 kind: Keyword, 32 delete: [83; 83),
33 insert_text: "return $0;", 33 insert: "return $0;",
34 insert_text_format: Snippet 34 kind: Keyword
35 }, 35 },
36 CompletionItem { 36 CompletionItem {
37 label: "while", 37 label: "while",
38 source_range: [83; 83), 38 source_range: [83; 83),
39 kind: Keyword, 39 delete: [83; 83),
40 insert_text: "while $0 {}", 40 insert: "while $0 {}",
41 insert_text_format: Snippet 41 kind: Keyword
42 } 42 }
43] 43]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__last_return_in_block_has_semi2.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__last_return_in_block_has_semi2.snap
index 5866369b6..d2093acdf 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__last_return_in_block_has_semi2.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__last_return_in_block_has_semi2.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.661936290Z" 2created: "2019-02-18T09:22:24.036383875Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,36 +8,36 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "if", 9 label: "if",
10 source_range: [83; 83), 10 source_range: [83; 83),
11 kind: Keyword, 11 delete: [83; 83),
12 insert_text: "if $0 {}", 12 insert: "if $0 {}",
13 insert_text_format: Snippet 13 kind: Keyword
14 }, 14 },
15 CompletionItem { 15 CompletionItem {
16 label: "loop", 16 label: "loop",
17 source_range: [83; 83), 17 source_range: [83; 83),
18 kind: Keyword, 18 delete: [83; 83),
19 insert_text: "loop {$0}", 19 insert: "loop {$0}",
20 insert_text_format: Snippet 20 kind: Keyword
21 }, 21 },
22 CompletionItem { 22 CompletionItem {
23 label: "match", 23 label: "match",
24 source_range: [83; 83), 24 source_range: [83; 83),
25 kind: Keyword, 25 delete: [83; 83),
26 insert_text: "match $0 {}", 26 insert: "match $0 {}",
27 insert_text_format: Snippet 27 kind: Keyword
28 }, 28 },
29 CompletionItem { 29 CompletionItem {
30 label: "return", 30 label: "return",
31 source_range: [83; 83), 31 source_range: [83; 83),
32 kind: Keyword, 32 delete: [83; 83),
33 insert_text: "return $0;", 33 insert: "return $0;",
34 insert_text_format: Snippet 34 kind: Keyword
35 }, 35 },
36 CompletionItem { 36 CompletionItem {
37 label: "while", 37 label: "while",
38 source_range: [83; 83), 38 source_range: [83; 83),
39 kind: Keyword, 39 delete: [83; 83),
40 insert_text: "while $0 {}", 40 insert: "while $0 {}",
41 insert_text_format: Snippet 41 kind: Keyword
42 } 42 }
43] 43]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__method_attr_filtering.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__method_attr_filtering.snap
index 4753eece7..ce8af2159 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__method_attr_filtering.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__method_attr_filtering.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.598946710Z" 2created: "2019-02-18T09:22:23.941335305Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,9 +8,9 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "the_method", 9 label: "the_method",
10 source_range: [249; 249), 10 source_range: [249; 249),
11 delete: [249; 249),
12 insert: "the_method()$0",
11 kind: Method, 13 kind: Method,
12 detail: "fn the_method(&self)", 14 detail: "fn the_method(&self)"
13 insert_text: "the_method()$0",
14 insert_text_format: Snippet
15 } 15 }
16] 16]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__method_completion.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__method_completion.snap
index 6cc8ab26c..41a10de14 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__method_completion.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__method_completion.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.598948318Z" 2created: "2019-02-18T09:22:23.939676100Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,9 +8,9 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "the_method", 9 label: "the_method",
10 source_range: [144; 144), 10 source_range: [144; 144),
11 delete: [144; 144),
12 insert: "the_method()$0",
11 kind: Method, 13 kind: Method,
12 detail: "fn the_method(&self)", 14 detail: "fn the_method(&self)"
13 insert_text: "the_method()$0",
14 insert_text_format: Snippet
15 } 15 }
16] 16]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__mod_with_docs.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__mod_with_docs.snap
index 47579bde1..1da3c3ba2 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__mod_with_docs.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__mod_with_docs.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.682030298Z" 2created: "2019-02-18T09:22:24.066918191Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,6 +8,8 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "my", 9 label: "my",
10 source_range: [23; 25), 10 source_range: [23; 25),
11 delete: [23; 25),
12 insert: "my",
11 kind: Module, 13 kind: Module,
12 documentation: Documentation( 14 documentation: Documentation(
13 "Some simple\ndocs describing `mod my`." 15 "Some simple\ndocs describing `mod my`."
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__module_items.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__module_items.snap
index 28efac43f..86bc8679d 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__module_items.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__module_items.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.770568686Z" 2created: "2019-02-18T09:22:24.161888678Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,19 +8,23 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "Baz", 9 label: "Baz",
10 source_range: [89; 89), 10 source_range: [89; 89),
11 delete: [89; 89),
12 insert: "Baz",
11 kind: Enum 13 kind: Enum
12 }, 14 },
13 CompletionItem { 15 CompletionItem {
14 label: "Foo", 16 label: "Foo",
15 source_range: [89; 89), 17 source_range: [89; 89),
18 delete: [89; 89),
19 insert: "Foo",
16 kind: Struct 20 kind: Struct
17 }, 21 },
18 CompletionItem { 22 CompletionItem {
19 label: "quux", 23 label: "quux",
20 source_range: [89; 89), 24 source_range: [89; 89),
25 delete: [89; 89),
26 insert: "quux()$0",
21 kind: Function, 27 kind: Function,
22 detail: "fn quux()", 28 detail: "fn quux()"
23 insert_text: "quux()$0",
24 insert_text_format: Snippet
25 } 29 }
26] 30]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__module_items_in_nested_modules.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__module_items_in_nested_modules.snap
index 01b6b968c..9f796b7ca 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__module_items_in_nested_modules.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__module_items_in_nested_modules.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.770992040Z" 2created: "2019-02-18T09:22:24.180517419Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,14 +8,16 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "Bar", 9 label: "Bar",
10 source_range: [101; 101), 10 source_range: [101; 101),
11 delete: [101; 101),
12 insert: "Bar",
11 kind: Struct 13 kind: Struct
12 }, 14 },
13 CompletionItem { 15 CompletionItem {
14 label: "quux", 16 label: "quux",
15 source_range: [101; 101), 17 source_range: [101; 101),
18 delete: [101; 101),
19 insert: "quux()$0",
16 kind: Function, 20 kind: Function,
17 detail: "fn quux()", 21 detail: "fn quux()"
18 insert_text: "quux()$0",
19 insert_text_format: Snippet
20 } 22 }
21] 23]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__nested_use_tree.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__nested_use_tree.snap
index e95763580..4920e500e 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__nested_use_tree.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__nested_use_tree.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.689653720Z" 2created: "2019-02-18T09:22:24.085605313Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,11 +8,15 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "Spam", 9 label: "Spam",
10 source_range: [12; 14), 10 source_range: [12; 14),
11 delete: [12; 14),
12 insert: "Spam",
11 kind: Struct 13 kind: Struct
12 }, 14 },
13 CompletionItem { 15 CompletionItem {
14 label: "foo", 16 label: "foo",
15 source_range: [12; 14), 17 source_range: [12; 14),
18 delete: [12; 14),
19 insert: "foo",
16 kind: Module 20 kind: Module
17 } 21 }
18] 22]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__no_semi_after_break_continue_in_expr.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__no_semi_after_break_continue_in_expr.snap
index 1295355a2..038e7f402 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__no_semi_after_break_continue_in_expr.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__no_semi_after_break_continue_in_expr.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.641375216Z" 2created: "2019-02-18T09:22:23.999953358Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,44 +8,50 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "break", 9 label: "break",
10 source_range: [106; 108), 10 source_range: [106; 108),
11 delete: [106; 108),
12 insert: "break",
11 kind: Keyword 13 kind: Keyword
12 }, 14 },
13 CompletionItem { 15 CompletionItem {
14 label: "continue", 16 label: "continue",
15 source_range: [106; 108), 17 source_range: [106; 108),
18 delete: [106; 108),
19 insert: "continue",
16 kind: Keyword 20 kind: Keyword
17 }, 21 },
18 CompletionItem { 22 CompletionItem {
19 label: "if", 23 label: "if",
20 source_range: [106; 108), 24 source_range: [106; 108),
21 kind: Keyword, 25 delete: [106; 108),
22 insert_text: "if $0 {}", 26 insert: "if $0 {}",
23 insert_text_format: Snippet 27 kind: Keyword
24 }, 28 },
25 CompletionItem { 29 CompletionItem {
26 label: "loop", 30 label: "loop",
27 source_range: [106; 108), 31 source_range: [106; 108),
28 kind: Keyword, 32 delete: [106; 108),
29 insert_text: "loop {$0}", 33 insert: "loop {$0}",
30 insert_text_format: Snippet 34 kind: Keyword
31 }, 35 },
32 CompletionItem { 36 CompletionItem {
33 label: "match", 37 label: "match",
34 source_range: [106; 108), 38 source_range: [106; 108),
35 kind: Keyword, 39 delete: [106; 108),
36 insert_text: "match $0 {}", 40 insert: "match $0 {}",
37 insert_text_format: Snippet 41 kind: Keyword
38 }, 42 },
39 CompletionItem { 43 CompletionItem {
40 label: "return", 44 label: "return",
41 source_range: [106; 108), 45 source_range: [106; 108),
46 delete: [106; 108),
47 insert: "return",
42 kind: Keyword 48 kind: Keyword
43 }, 49 },
44 CompletionItem { 50 CompletionItem {
45 label: "while", 51 label: "while",
46 source_range: [106; 108), 52 source_range: [106; 108),
47 kind: Keyword, 53 delete: [106; 108),
48 insert_text: "while $0 {}", 54 insert: "while $0 {}",
49 insert_text_format: Snippet 55 kind: Keyword
50 } 56 }
51] 57]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__param_completion_last_param.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__param_completion_last_param.snap
index dba925f7c..cab77f5a2 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__param_completion_last_param.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__param_completion_last_param.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.606265507Z" 2created: "2019-02-18T09:22:23.949634602Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,6 +8,8 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "file_id: FileId", 9 label: "file_id: FileId",
10 source_range: [98; 102), 10 source_range: [98; 102),
11 delete: [98; 102),
12 insert: "file_id: FileId",
11 lookup: "file_id" 13 lookup: "file_id"
12 } 14 }
13] 15]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__param_completion_nth_param.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__param_completion_nth_param.snap
index c5873becb..8fbee160c 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__param_completion_nth_param.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__param_completion_nth_param.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.606265538Z" 2created: "2019-02-18T09:22:23.949634355Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,6 +8,8 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "file_id: FileId", 9 label: "file_id: FileId",
10 source_range: [98; 102), 10 source_range: [98; 102),
11 delete: [98; 102),
12 insert: "file_id: FileId",
11 lookup: "file_id" 13 lookup: "file_id"
12 } 14 }
13] 15]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__param_completion_trait_param.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__param_completion_trait_param.snap
index 5231db54c..76eeadb6d 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__param_completion_trait_param.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__param_completion_trait_param.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.628419014Z" 2created: "2019-02-18T09:22:23.974417169Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,6 +8,8 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "file_id: FileId", 9 label: "file_id: FileId",
10 source_range: [269; 273), 10 source_range: [269; 273),
11 delete: [269; 273),
12 insert: "file_id: FileId",
11 lookup: "file_id" 13 lookup: "file_id"
12 } 14 }
13] 15]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__postfix_completion_works_for_trivial_path_expression.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__postfix_completion_works_for_trivial_path_expression.snap
index bd22d546a..2b5435f0c 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__postfix_completion_works_for_trivial_path_expression.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__postfix_completion_works_for_trivial_path_expression.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.734401559Z" 2created: "2019-02-18T09:22:24.127119709Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,106 +8,50 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "dbg", 9 label: "dbg",
10 source_range: [76; 76), 10 source_range: [76; 76),
11 detail: "dbg!(expr)", 11 delete: [72; 76),
12 insert_text: "dbg!(bar)", 12 insert: "dbg!(bar)",
13 insert_text_format: Snippet, 13 detail: "dbg!(expr)"
14 text_edit: TextEdit {
15 atoms: [
16 AtomTextEdit {
17 delete: [72; 76),
18 insert: ""
19 }
20 ]
21 }
22 }, 14 },
23 CompletionItem { 15 CompletionItem {
24 label: "if", 16 label: "if",
25 source_range: [76; 76), 17 source_range: [76; 76),
26 detail: "if expr {}", 18 delete: [72; 76),
27 insert_text: "if bar {$0}", 19 insert: "if bar {$0}",
28 insert_text_format: Snippet, 20 detail: "if expr {}"
29 text_edit: TextEdit {
30 atoms: [
31 AtomTextEdit {
32 delete: [72; 76),
33 insert: ""
34 }
35 ]
36 }
37 }, 21 },
38 CompletionItem { 22 CompletionItem {
39 label: "match", 23 label: "match",
40 source_range: [76; 76), 24 source_range: [76; 76),
41 detail: "match expr {}", 25 delete: [72; 76),
42 insert_text: "match bar {\n${1:_} => {$0\\},\n}", 26 insert: "match bar {\n${1:_} => {$0\\},\n}",
43 insert_text_format: Snippet, 27 detail: "match expr {}"
44 text_edit: TextEdit {
45 atoms: [
46 AtomTextEdit {
47 delete: [72; 76),
48 insert: ""
49 }
50 ]
51 }
52 }, 28 },
53 CompletionItem { 29 CompletionItem {
54 label: "not", 30 label: "not",
55 source_range: [76; 76), 31 source_range: [76; 76),
56 detail: "!expr", 32 delete: [72; 76),
57 insert_text: "!bar", 33 insert: "!bar",
58 insert_text_format: Snippet, 34 detail: "!expr"
59 text_edit: TextEdit {
60 atoms: [
61 AtomTextEdit {
62 delete: [72; 76),
63 insert: ""
64 }
65 ]
66 }
67 }, 35 },
68 CompletionItem { 36 CompletionItem {
69 label: "ref", 37 label: "ref",
70 source_range: [76; 76), 38 source_range: [76; 76),
71 detail: "&expr", 39 delete: [72; 76),
72 insert_text: "&bar", 40 insert: "&bar",
73 insert_text_format: Snippet, 41 detail: "&expr"
74 text_edit: TextEdit {
75 atoms: [
76 AtomTextEdit {
77 delete: [72; 76),
78 insert: ""
79 }
80 ]
81 }
82 }, 42 },
83 CompletionItem { 43 CompletionItem {
84 label: "refm", 44 label: "refm",
85 source_range: [76; 76), 45 source_range: [76; 76),
86 detail: "&mut expr", 46 delete: [72; 76),
87 insert_text: "&mut bar", 47 insert: "&mut bar",
88 insert_text_format: Snippet, 48 detail: "&mut expr"
89 text_edit: TextEdit {
90 atoms: [
91 AtomTextEdit {
92 delete: [72; 76),
93 insert: ""
94 }
95 ]
96 }
97 }, 49 },
98 CompletionItem { 50 CompletionItem {
99 label: "while", 51 label: "while",
100 source_range: [76; 76), 52 source_range: [76; 76),
101 detail: "while expr {}", 53 delete: [72; 76),
102 insert_text: "while bar {\n$0\n}", 54 insert: "while bar {\n$0\n}",
103 insert_text_format: Snippet, 55 detail: "while expr {}"
104 text_edit: TextEdit {
105 atoms: [
106 AtomTextEdit {
107 delete: [72; 76),
108 insert: ""
109 }
110 ]
111 }
112 } 56 }
113] 57]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__return_type.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__return_type.snap
index 25c5007e4..0738cf466 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__return_type.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__return_type.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.780512486Z" 2created: "2019-02-18T09:22:24.182964414Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,14 +8,16 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "Foo", 9 label: "Foo",
10 source_range: [47; 47), 10 source_range: [47; 47),
11 delete: [47; 47),
12 insert: "Foo",
11 kind: Struct 13 kind: Struct
12 }, 14 },
13 CompletionItem { 15 CompletionItem {
14 label: "x", 16 label: "x",
15 source_range: [47; 47), 17 source_range: [47; 47),
18 delete: [47; 47),
19 insert: "x()$0",
16 kind: Function, 20 kind: Function,
17 detail: "fn x() ->", 21 detail: "fn x() ->"
18 insert_text: "x()$0",
19 insert_text_format: Snippet
20 } 22 }
21] 23]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__self_in_methods.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__self_in_methods.snap
index d390be2dc..baf12cae1 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__self_in_methods.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__self_in_methods.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.774705610Z" 2created: "2019-02-18T09:22:24.174038680Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,11 +8,15 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "Self", 9 label: "Self",
10 source_range: [25; 25), 10 source_range: [25; 25),
11 delete: [25; 25),
12 insert: "Self",
11 kind: TypeParam 13 kind: TypeParam
12 }, 14 },
13 CompletionItem { 15 CompletionItem {
14 label: "self", 16 label: "self",
15 source_range: [25; 25), 17 source_range: [25; 25),
18 delete: [25; 25),
19 insert: "self",
16 kind: Binding 20 kind: Binding
17 } 21 }
18] 22]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__snippets_in_expressions.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__snippets_in_expressions.snap
index 6ad919849..fce2d6479 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__snippets_in_expressions.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__snippets_in_expressions.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.799497268Z" 2created: "2019-02-18T09:22:24.191576723Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,15 +8,15 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "pd", 9 label: "pd",
10 source_range: [17; 17), 10 source_range: [17; 17),
11 kind: Snippet, 11 delete: [17; 17),
12 insert_text: "eprintln!(\"$0 = {:?}\", $0);", 12 insert: "eprintln!(\"$0 = {:?}\", $0);",
13 insert_text_format: Snippet 13 kind: Snippet
14 }, 14 },
15 CompletionItem { 15 CompletionItem {
16 label: "ppd", 16 label: "ppd",
17 source_range: [17; 17), 17 source_range: [17; 17),
18 kind: Snippet, 18 delete: [17; 17),
19 insert_text: "eprintln!(\"$0 = {:#?}\", $0);", 19 insert: "eprintln!(\"$0 = {:#?}\", $0);",
20 insert_text_format: Snippet 20 kind: Snippet
21 } 21 }
22] 22]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__snippets_in_items.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__snippets_in_items.snap
index 43367010b..d2b1a5f0e 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__snippets_in_items.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__snippets_in_items.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.800831987Z" 2created: "2019-02-18T09:22:24.187670733Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,16 +8,16 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "Test function", 9 label: "Test function",
10 source_range: [66; 66), 10 source_range: [66; 66),
11 delete: [66; 66),
12 insert: "#[test]\nfn ${1:feature}() {\n $0\n}",
11 kind: Snippet, 13 kind: Snippet,
12 lookup: "tfn", 14 lookup: "tfn"
13 insert_text: "#[test]\nfn ${1:feature}() {\n $0\n}",
14 insert_text_format: Snippet
15 }, 15 },
16 CompletionItem { 16 CompletionItem {
17 label: "pub(crate)", 17 label: "pub(crate)",
18 source_range: [66; 66), 18 source_range: [66; 66),
19 kind: Snippet, 19 delete: [66; 66),
20 insert_text: "pub(crate) $0", 20 insert: "pub(crate) $0",
21 insert_text_format: Snippet 21 kind: Snippet
22 } 22 }
23] 23]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__struct_associated_const.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__struct_associated_const.snap
index c78b06d3c..6ad4c5acc 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__struct_associated_const.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__struct_associated_const.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.704544613Z" 2created: "2019-02-18T09:22:24.093406123Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,6 +8,8 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "C", 9 label: "C",
10 source_range: [107; 107), 10 source_range: [107; 107),
11 delete: [107; 107),
12 insert: "C",
11 kind: Const, 13 kind: Const,
12 detail: "const C: i32 = 42;", 14 detail: "const C: i32 = 42;",
13 documentation: Documentation( 15 documentation: Documentation(
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__struct_associated_method.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__struct_associated_method.snap
index 67638b4d1..163b325c3 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__struct_associated_method.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__struct_associated_method.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.704544615Z" 2created: "2019-02-18T09:22:24.093082839Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,12 +8,12 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "m", 9 label: "m",
10 source_range: [100; 100), 10 source_range: [100; 100),
11 delete: [100; 100),
12 insert: "m()$0",
11 kind: Method, 13 kind: Method,
12 detail: "fn m()", 14 detail: "fn m()",
13 documentation: Documentation( 15 documentation: Documentation(
14 "An associated method" 16 "An associated method"
15 ), 17 )
16 insert_text: "m()$0",
17 insert_text_format: Snippet
18 } 18 }
19] 19]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__struct_associated_type.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__struct_associated_type.snap
index c5f5b9f10..583bda225 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__struct_associated_type.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__struct_associated_type.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.725668999Z" 2created: "2019-02-18T09:22:24.090876030Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,6 +8,8 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "T", 9 label: "T",
10 source_range: [101; 101), 10 source_range: [101; 101),
11 delete: [101; 101),
12 insert: "T",
11 kind: TypeAlias, 13 kind: TypeAlias,
12 detail: "type T = i32;", 14 detail: "type T = i32;",
13 documentation: Documentation( 15 documentation: Documentation(
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__struct_field_completion.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__struct_field_completion.snap
index ffad98f7d..58271b873 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__struct_field_completion.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__struct_field_completion.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.599230647Z" 2created: "2019-02-18T09:22:23.939645902Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,6 +8,8 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "the_field", 9 label: "the_field",
10 source_range: [85; 85), 10 source_range: [85; 85),
11 delete: [85; 85),
12 insert: "the_field",
11 kind: Field, 13 kind: Field,
12 detail: "u32" 14 detail: "u32"
13 } 15 }
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__struct_field_completion_autoderef.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__struct_field_completion_autoderef.snap
index 99aef933a..b38867b81 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__struct_field_completion_autoderef.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__struct_field_completion_autoderef.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.598966298Z" 2created: "2019-02-18T09:22:23.940872916Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,14 +8,16 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "foo", 9 label: "foo",
10 source_range: [126; 126), 10 source_range: [126; 126),
11 delete: [126; 126),
12 insert: "foo()$0",
11 kind: Method, 13 kind: Method,
12 detail: "fn foo(&self)", 14 detail: "fn foo(&self)"
13 insert_text: "foo()$0",
14 insert_text_format: Snippet
15 }, 15 },
16 CompletionItem { 16 CompletionItem {
17 label: "the_field", 17 label: "the_field",
18 source_range: [126; 126), 18 source_range: [126; 126),
19 delete: [126; 126),
20 insert: "the_field",
19 kind: Field, 21 kind: Field,
20 detail: "(u32, i32)" 22 detail: "(u32, i32)"
21 } 23 }
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__struct_field_completion_self.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__struct_field_completion_self.snap
index 52991b9fb..8e5cab43e 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__struct_field_completion_self.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__struct_field_completion_self.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.598965593Z" 2created: "2019-02-18T09:22:23.940872918Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,14 +8,16 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "foo", 9 label: "foo",
10 source_range: [187; 187), 10 source_range: [187; 187),
11 delete: [187; 187),
12 insert: "foo()$0",
11 kind: Method, 13 kind: Method,
12 detail: "fn foo(self)", 14 detail: "fn foo(self)"
13 insert_text: "foo()$0",
14 insert_text_format: Snippet
15 }, 15 },
16 CompletionItem { 16 CompletionItem {
17 label: "the_field", 17 label: "the_field",
18 source_range: [187; 187), 18 source_range: [187; 187),
19 delete: [187; 187),
20 insert: "the_field",
19 kind: Field, 21 kind: Field,
20 detail: "(u32,)", 22 detail: "(u32,)",
21 documentation: Documentation( 23 documentation: Documentation(
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__tuple_field_completion.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__tuple_field_completion.snap
index 5b6ed9d77..3f2780621 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__tuple_field_completion.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__tuple_field_completion.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.598973382Z" 2created: "2019-02-18T09:22:23.939710971Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,12 +8,16 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "0", 9 label: "0",
10 source_range: [75; 75), 10 source_range: [75; 75),
11 delete: [75; 75),
12 insert: "0",
11 kind: Field, 13 kind: Field,
12 detail: "i32" 14 detail: "i32"
13 }, 15 },
14 CompletionItem { 16 CompletionItem {
15 label: "1", 17 label: "1",
16 source_range: [75; 75), 18 source_range: [75; 75),
19 delete: [75; 75),
20 insert: "1",
17 kind: Field, 21 kind: Field,
18 detail: "f64" 22 detail: "f64"
19 } 23 }
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__use_item_starting_with_crate.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__use_item_starting_with_crate.snap
index 3c670ad5b..34e70c35d 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__use_item_starting_with_crate.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__use_item_starting_with_crate.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.726365989Z" 2created: "2019-02-18T09:22:24.098574884Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,11 +8,15 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "Spam", 9 label: "Spam",
10 source_range: [11; 13), 10 source_range: [11; 13),
11 delete: [11; 13),
12 insert: "Spam",
11 kind: Struct 13 kind: Struct
12 }, 14 },
13 CompletionItem { 15 CompletionItem {
14 label: "foo", 16 label: "foo",
15 source_range: [11; 13), 17 source_range: [11; 13),
18 delete: [11; 13),
19 insert: "foo",
16 kind: Module 20 kind: Module
17 } 21 }
18] 22]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__use_item_starting_with_self.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__use_item_starting_with_self.snap
index bf314de84..d15f1905b 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__use_item_starting_with_self.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__use_item_starting_with_self.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-02-18T07:29:59.731789946Z" 2created: "2019-02-18T09:22:24.102063333Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
@@ -8,6 +8,8 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "Bar", 9 label: "Bar",
10 source_range: [26; 26), 10 source_range: [26; 26),
11 delete: [26; 26),
12 insert: "Bar",
11 kind: Struct 13 kind: Struct
12 } 14 }
13] 15]
diff --git a/crates/ra_lsp_server/src/conv.rs b/crates/ra_lsp_server/src/conv.rs
index c3192a1e5..f0f67b663 100644
--- a/crates/ra_lsp_server/src/conv.rs
+++ b/crates/ra_lsp_server/src/conv.rs
@@ -79,11 +79,31 @@ impl ConvWith for CompletionItem {
79 type Ctx = LineIndex; 79 type Ctx = LineIndex;
80 type Output = ::lsp_types::CompletionItem; 80 type Output = ::lsp_types::CompletionItem;
81 81
82 fn conv_with(mut self, ctx: &LineIndex) -> ::lsp_types::CompletionItem { 82 fn conv_with(self, ctx: &LineIndex) -> ::lsp_types::CompletionItem {
83 let atom_text_edit = AtomTextEdit::replace(self.source_range(), self.insert_text()); 83 let mut additional_text_edits = Vec::new();
84 let text_edit = (&atom_text_edit).conv_with(ctx); 84 let mut text_edit = None;
85 let additional_text_edits = 85 // LSP does not allow arbitrary edits in completion, so we have to do a
86 if let Some(edit) = self.take_text_edit() { Some(edit.conv_with(ctx)) } else { None }; 86 // non-trivial mapping here.
87 for atom_edit in self.text_edit().as_atoms() {
88 if self.source_range().is_subrange(&atom_edit.delete) {
89 text_edit = Some(if atom_edit.delete == self.source_range() {
90 atom_edit.conv_with(ctx)
91 } else {
92 assert!(self.source_range().end() == atom_edit.delete.end());
93 let range1 =
94 TextRange::from_to(atom_edit.delete.start(), self.source_range().start());
95 let range2 = self.source_range();
96 let edit1 = AtomTextEdit::replace(range1, String::new());
97 let edit2 = AtomTextEdit::replace(range2, atom_edit.insert.clone());
98 additional_text_edits.push(edit1.conv_with(ctx));
99 edit2.conv_with(ctx)
100 })
101 } else {
102 assert!(self.source_range().intersection(&atom_edit.delete).is_none());
103 additional_text_edits.push(atom_edit.conv_with(ctx));
104 }
105 }
106 let text_edit = text_edit.unwrap();
87 107
88 let mut res = lsp_types::CompletionItem { 108 let mut res = lsp_types::CompletionItem {
89 label: self.label().to_string(), 109 label: self.label().to_string(),
@@ -91,7 +111,7 @@ impl ConvWith for CompletionItem {
91 filter_text: Some(self.lookup().to_string()), 111 filter_text: Some(self.lookup().to_string()),
92 kind: self.kind().map(|it| it.conv()), 112 kind: self.kind().map(|it| it.conv()),
93 text_edit: Some(text_edit), 113 text_edit: Some(text_edit),
94 additional_text_edits, 114 additional_text_edits: Some(additional_text_edits),
95 documentation: self.documentation().map(|it| it.conv()), 115 documentation: self.documentation().map(|it| it.conv()),
96 ..Default::default() 116 ..Default::default()
97 }; 117 };