aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_ide_api/src/completion/complete_postfix.rs17
-rw-r--r--crates/ra_ide_api/src/completion/completion_item.rs103
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_for.snap22
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_if_let.snap30
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_let.snap30
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__completes_break_and_continue_in_loops1.snap86
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__completes_break_and_continue_in_loops2.snap62
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__completes_prelude.snap30
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__completes_use_paths_across_crates.snap10
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__deeply_nested_use_tree.snap10
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__dont_add_semi_after_return_if_not_a_statement.snap62
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__dont_render_function_parens_if_already_call.snap18
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__dont_render_function_parens_if_already_call_assoc_fn.snap10
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__dont_render_function_parens_in_use_item.snap10
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__dont_show_both_completions_for_shadowing.snap22
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__enum_variant.snap18
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__enum_variant_with_details.snap26
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__extern_prelude.snap10
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__generic_params.snap22
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__generic_params_in_struct.snap18
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__inserts_parens_for_function_calls1.snap26
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__inserts_parens_for_function_calls2.snap26
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__inserts_parens_for_function_calls3.snap14
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function1.snap62
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function2.snap86
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function3.snap62
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function4.snap62
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_use_stmt1.snap34
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_use_stmt2.snap22
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_use_stmt3.snap22
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__last_return_in_block_has_semi1.snap62
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__last_return_in_block_has_semi2.snap62
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__method_attr_filtering.snap14
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__method_completion.snap14
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__mod_with_docs.snap10
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__module_items.snap30
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__module_items_in_nested_modules.snap22
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__nested_use_tree.snap18
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__no_semi_after_break_continue_in_expr.snap74
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__param_completion_last_param.snap10
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__param_completion_nth_param.snap10
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__param_completion_trait_param.snap10
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__postfix_completion_works_for_trivial_path_expression.snap58
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__return_type.snap22
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__self_in_methods.snap18
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__snippets_in_expressions.snap26
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__snippets_in_items.snap26
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__struct_associated_const.snap10
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__struct_associated_method.snap14
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__struct_associated_type.snap10
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__struct_field_completion.snap10
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__struct_field_completion_autoderef.snap22
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__struct_field_completion_self.snap22
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__tuple_field_completion.snap18
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__use_item_starting_with_crate.snap18
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__use_item_starting_with_self.snap10
-rw-r--r--crates/ra_lsp_server/src/conv.rs32
57 files changed, 1300 insertions, 384 deletions
diff --git a/crates/ra_ide_api/src/completion/complete_postfix.rs b/crates/ra_ide_api/src/completion/complete_postfix.rs
index 4ba181720..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 .insert_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/completion_item.rs b/crates/ra_ide_api/src/completion/completion_item.rs
index 1cdcde211..9aa9768d1 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,47 @@ 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
39impl fmt::Debug for CompletionItem { 55impl fmt::Debug for CompletionItem {
40 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 56 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
41 let mut s = f.debug_struct("CompletionItem"); 57 let mut s = f.debug_struct("CompletionItem");
42 s.field("label", &self.label()).field("source_range", &self.source_range()); 58 s.field("label", &self.label())
59 .field("source_range", &self.source_range())
60 .field("text_edit", &self.text_edit);
43 if let Some(kind) = self.kind().as_ref() { 61 if let Some(kind) = self.kind().as_ref() {
44 s.field("kind", kind); 62 s.field("kind", kind);
45 } 63 }
@@ -52,13 +70,6 @@ impl fmt::Debug for CompletionItem {
52 if let Some(documentation) = self.documentation() { 70 if let Some(documentation) = self.documentation() {
53 s.field("documentation", &documentation); 71 s.field("documentation", &documentation);
54 } 72 }
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() 73 s.finish()
63 } 74 }
64} 75}
@@ -103,12 +114,12 @@ pub enum InsertTextFormat {
103impl CompletionItem { 114impl CompletionItem {
104 pub(crate) fn new( 115 pub(crate) fn new(
105 completion_kind: CompletionKind, 116 completion_kind: CompletionKind,
106 replace_range: TextRange, 117 source_range: TextRange,
107 label: impl Into<String>, 118 label: impl Into<String>,
108 ) -> Builder { 119 ) -> Builder {
109 let label = label.into(); 120 let label = label.into();
110 Builder { 121 Builder {
111 source_range: replace_range, 122 source_range,
112 completion_kind, 123 completion_kind,
113 label, 124 label,
114 insert_text: None, 125 insert_text: None,
@@ -124,6 +135,18 @@ impl CompletionItem {
124 pub fn label(&self) -> &str { 135 pub fn label(&self) -> &str {
125 &self.label 136 &self.label
126 } 137 }
138 pub fn source_range(&self) -> TextRange {
139 self.source_range
140 }
141
142 pub fn insert_text_format(&self) -> InsertTextFormat {
143 self.insert_text_format
144 }
145
146 pub fn text_edit(&self) -> &TextEdit {
147 &self.text_edit
148 }
149
127 /// Short one-line additional information, like a type 150 /// Short one-line additional information, like a type
128 pub fn detail(&self) -> Option<&str> { 151 pub fn detail(&self) -> Option<&str> {
129 self.detail.as_ref().map(|it| it.as_str()) 152 self.detail.as_ref().map(|it| it.as_str())
@@ -137,24 +160,9 @@ impl CompletionItem {
137 self.lookup.as_ref().map(|it| it.as_str()).unwrap_or_else(|| self.label()) 160 self.lookup.as_ref().map(|it| it.as_str()).unwrap_or_else(|| self.label())
138 } 161 }
139 162
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> { 163 pub fn kind(&self) -> Option<CompletionItemKind> {
150 self.kind 164 self.kind
151 } 165 }
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} 166}
159 167
160/// A helper to make `CompletionItem`s. 168/// A helper to make `CompletionItem`s.
@@ -178,17 +186,27 @@ impl Builder {
178 } 186 }
179 187
180 pub(crate) fn build(self) -> CompletionItem { 188 pub(crate) fn build(self) -> CompletionItem {
189 let label = self.label;
190 let text_edit = match self.text_edit {
191 Some(it) => it,
192 None => {
193 let mut builder = TextEditBuilder::default();
194 builder
195 .replace(self.source_range, self.insert_text.unwrap_or_else(|| label.clone()));
196 builder.finish()
197 }
198 };
199
181 CompletionItem { 200 CompletionItem {
182 source_range: self.source_range, 201 source_range: self.source_range,
183 label: self.label, 202 label,
203 insert_text_format: self.insert_text_format,
204 text_edit,
184 detail: self.detail, 205 detail: self.detail,
185 documentation: self.documentation, 206 documentation: self.documentation,
186 insert_text_format: self.insert_text_format,
187 lookup: self.lookup, 207 lookup: self.lookup,
188 kind: self.kind, 208 kind: self.kind,
189 completion_kind: self.completion_kind, 209 completion_kind: self.completion_kind,
190 text_edit: self.text_edit,
191 insert_text: self.insert_text,
192 } 210 }
193 } 211 }
194 pub(crate) fn lookup_by(mut self, lookup: impl Into<String>) -> Builder { 212 pub(crate) fn lookup_by(mut self, lookup: impl Into<String>) -> Builder {
@@ -207,11 +225,14 @@ impl Builder {
207 self.kind = Some(kind); 225 self.kind = Some(kind);
208 self 226 self
209 } 227 }
210 #[allow(unused)]
211 pub(crate) fn text_edit(mut self, edit: TextEdit) -> Builder { 228 pub(crate) fn text_edit(mut self, edit: TextEdit) -> Builder {
212 self.text_edit = Some(edit); 229 self.text_edit = Some(edit);
213 self 230 self
214 } 231 }
232 pub(crate) fn snippet_edit(mut self, edit: TextEdit) -> Builder {
233 self.insert_text_format = InsertTextFormat::Snippet;
234 self.text_edit(edit)
235 }
215 #[allow(unused)] 236 #[allow(unused)]
216 pub(crate) fn detail(self, detail: impl Into<String>) -> Builder { 237 pub(crate) fn detail(self, detail: impl Into<String>) -> Builder {
217 self.set_detail(Some(detail)) 238 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..e6e389fbd 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:10:52.089782502Z"
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,28 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "quux", 9 label: "quux",
10 source_range: [83; 83), 10 source_range: [83; 83),
11 text_edit: TextEdit {
12 atoms: [
13 AtomTextEdit {
14 delete: [83; 83),
15 insert: "quux()$0"
16 }
17 ]
18 },
11 kind: Function, 19 kind: Function,
12 detail: "fn quux()", 20 detail: "fn quux()"
13 insert_text: "quux()$0",
14 insert_text_format: Snippet
15 }, 21 },
16 CompletionItem { 22 CompletionItem {
17 label: "x", 23 label: "x",
18 source_range: [83; 83), 24 source_range: [83; 83),
25 text_edit: TextEdit {
26 atoms: [
27 AtomTextEdit {
28 delete: [83; 83),
29 insert: "x"
30 }
31 ]
32 },
19 kind: Binding 33 kind: Binding
20 } 34 }
21] 35]
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..badaed8fe 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:10:52.092577354Z"
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,41 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "a", 9 label: "a",
10 source_range: [214; 214), 10 source_range: [214; 214),
11 text_edit: TextEdit {
12 atoms: [
13 AtomTextEdit {
14 delete: [214; 214),
15 insert: "a"
16 }
17 ]
18 },
11 kind: Binding 19 kind: Binding
12 }, 20 },
13 CompletionItem { 21 CompletionItem {
14 label: "b", 22 label: "b",
15 source_range: [214; 214), 23 source_range: [214; 214),
24 text_edit: TextEdit {
25 atoms: [
26 AtomTextEdit {
27 delete: [214; 214),
28 insert: "b"
29 }
30 ]
31 },
16 kind: Binding 32 kind: Binding
17 }, 33 },
18 CompletionItem { 34 CompletionItem {
19 label: "quux", 35 label: "quux",
20 source_range: [214; 214), 36 source_range: [214; 214),
37 text_edit: TextEdit {
38 atoms: [
39 AtomTextEdit {
40 delete: [214; 214),
41 insert: "quux()$0"
42 }
43 ]
44 },
21 kind: Function, 45 kind: Function,
22 detail: "fn quux()", 46 detail: "fn quux()"
23 insert_text: "quux()$0",
24 insert_text_format: Snippet
25 } 47 }
26] 48]
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..1b4cbf91e 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:10:52.090000719Z"
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,41 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "quux", 9 label: "quux",
10 source_range: [79; 79), 10 source_range: [79; 79),
11 text_edit: TextEdit {
12 atoms: [
13 AtomTextEdit {
14 delete: [79; 79),
15 insert: "quux($0)"
16 }
17 ]
18 },
11 kind: Function, 19 kind: Function,
12 detail: "fn quux(x: i32)", 20 detail: "fn quux(x: i32)"
13 insert_text: "quux($0)",
14 insert_text_format: Snippet
15 }, 21 },
16 CompletionItem { 22 CompletionItem {
17 label: "x", 23 label: "x",
18 source_range: [79; 79), 24 source_range: [79; 79),
25 text_edit: TextEdit {
26 atoms: [
27 AtomTextEdit {
28 delete: [79; 79),
29 insert: "x"
30 }
31 ]
32 },
19 kind: Binding 33 kind: Binding
20 }, 34 },
21 CompletionItem { 35 CompletionItem {
22 label: "y", 36 label: "y",
23 source_range: [79; 79), 37 source_range: [79; 79),
38 text_edit: TextEdit {
39 atoms: [
40 AtomTextEdit {
41 delete: [79; 79),
42 insert: "y"
43 }
44 ]
45 },
24 kind: Binding 46 kind: Binding
25 } 47 }
26] 48]
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..74f6fcd77 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:10:51.974241301Z"
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,92 @@ 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 text_edit: TextEdit {
12 insert_text: "break;", 12 atoms: [
13 insert_text_format: Snippet 13 AtomTextEdit {
14 delete: [55; 55),
15 insert: "break;"
16 }
17 ]
18 },
19 kind: Keyword
14 }, 20 },
15 CompletionItem { 21 CompletionItem {
16 label: "continue", 22 label: "continue",
17 source_range: [55; 55), 23 source_range: [55; 55),
18 kind: Keyword, 24 text_edit: TextEdit {
19 insert_text: "continue;", 25 atoms: [
20 insert_text_format: Snippet 26 AtomTextEdit {
27 delete: [55; 55),
28 insert: "continue;"
29 }
30 ]
31 },
32 kind: Keyword
21 }, 33 },
22 CompletionItem { 34 CompletionItem {
23 label: "if", 35 label: "if",
24 source_range: [55; 55), 36 source_range: [55; 55),
25 kind: Keyword, 37 text_edit: TextEdit {
26 insert_text: "if $0 {}", 38 atoms: [
27 insert_text_format: Snippet 39 AtomTextEdit {
40 delete: [55; 55),
41 insert: "if $0 {}"
42 }
43 ]
44 },
45 kind: Keyword
28 }, 46 },
29 CompletionItem { 47 CompletionItem {
30 label: "loop", 48 label: "loop",
31 source_range: [55; 55), 49 source_range: [55; 55),
32 kind: Keyword, 50 text_edit: TextEdit {
33 insert_text: "loop {$0}", 51 atoms: [
34 insert_text_format: Snippet 52 AtomTextEdit {
53 delete: [55; 55),
54 insert: "loop {$0}"
55 }
56 ]
57 },
58 kind: Keyword
35 }, 59 },
36 CompletionItem { 60 CompletionItem {
37 label: "match", 61 label: "match",
38 source_range: [55; 55), 62 source_range: [55; 55),
39 kind: Keyword, 63 text_edit: TextEdit {
40 insert_text: "match $0 {}", 64 atoms: [
41 insert_text_format: Snippet 65 AtomTextEdit {
66 delete: [55; 55),
67 insert: "match $0 {}"
68 }
69 ]
70 },
71 kind: Keyword
42 }, 72 },
43 CompletionItem { 73 CompletionItem {
44 label: "return", 74 label: "return",
45 source_range: [55; 55), 75 source_range: [55; 55),
46 kind: Keyword, 76 text_edit: TextEdit {
47 insert_text: "return $0;", 77 atoms: [
48 insert_text_format: Snippet 78 AtomTextEdit {
79 delete: [55; 55),
80 insert: "return $0;"
81 }
82 ]
83 },
84 kind: Keyword
49 }, 85 },
50 CompletionItem { 86 CompletionItem {
51 label: "while", 87 label: "while",
52 source_range: [55; 55), 88 source_range: [55; 55),
53 kind: Keyword, 89 text_edit: TextEdit {
54 insert_text: "while $0 {}", 90 atoms: [
55 insert_text_format: Snippet 91 AtomTextEdit {
92 delete: [55; 55),
93 insert: "while $0 {}"
94 }
95 ]
96 },
97 kind: Keyword
56 } 98 }
57] 99]
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..225ca4c7f 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:10:52.011157905Z"
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,66 @@ 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 text_edit: TextEdit {
12 insert_text: "if $0 {}", 12 atoms: [
13 insert_text_format: Snippet 13 AtomTextEdit {
14 delete: [60; 60),
15 insert: "if $0 {}"
16 }
17 ]
18 },
19 kind: Keyword
14 }, 20 },
15 CompletionItem { 21 CompletionItem {
16 label: "loop", 22 label: "loop",
17 source_range: [60; 60), 23 source_range: [60; 60),
18 kind: Keyword, 24 text_edit: TextEdit {
19 insert_text: "loop {$0}", 25 atoms: [
20 insert_text_format: Snippet 26 AtomTextEdit {
27 delete: [60; 60),
28 insert: "loop {$0}"
29 }
30 ]
31 },
32 kind: Keyword
21 }, 33 },
22 CompletionItem { 34 CompletionItem {
23 label: "match", 35 label: "match",
24 source_range: [60; 60), 36 source_range: [60; 60),
25 kind: Keyword, 37 text_edit: TextEdit {
26 insert_text: "match $0 {}", 38 atoms: [
27 insert_text_format: Snippet 39 AtomTextEdit {
40 delete: [60; 60),
41 insert: "match $0 {}"
42 }
43 ]
44 },
45 kind: Keyword
28 }, 46 },
29 CompletionItem { 47 CompletionItem {
30 label: "return", 48 label: "return",
31 source_range: [60; 60), 49 source_range: [60; 60),
32 kind: Keyword, 50 text_edit: TextEdit {
33 insert_text: "return $0;", 51 atoms: [
34 insert_text_format: Snippet 52 AtomTextEdit {
53 delete: [60; 60),
54 insert: "return $0;"
55 }
56 ]
57 },
58 kind: Keyword
35 }, 59 },
36 CompletionItem { 60 CompletionItem {
37 label: "while", 61 label: "while",
38 source_range: [60; 60), 62 source_range: [60; 60),
39 kind: Keyword, 63 text_edit: TextEdit {
40 insert_text: "while $0 {}", 64 atoms: [
41 insert_text_format: Snippet 65 AtomTextEdit {
66 delete: [60; 60),
67 insert: "while $0 {}"
68 }
69 ]
70 },
71 kind: Keyword
42 } 72 }
43] 73]
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..58515b86f 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:10:52.125606390Z"
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,41 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "Option", 9 label: "Option",
10 source_range: [18; 18), 10 source_range: [18; 18),
11 text_edit: TextEdit {
12 atoms: [
13 AtomTextEdit {
14 delete: [18; 18),
15 insert: "Option"
16 }
17 ]
18 },
11 kind: Struct 19 kind: Struct
12 }, 20 },
13 CompletionItem { 21 CompletionItem {
14 label: "foo", 22 label: "foo",
15 source_range: [18; 18), 23 source_range: [18; 18),
24 text_edit: TextEdit {
25 atoms: [
26 AtomTextEdit {
27 delete: [18; 18),
28 insert: "foo()$0"
29 }
30 ]
31 },
16 kind: Function, 32 kind: Function,
17 detail: "fn foo()", 33 detail: "fn foo()"
18 insert_text: "foo()$0",
19 insert_text_format: Snippet
20 }, 34 },
21 CompletionItem { 35 CompletionItem {
22 label: "std", 36 label: "std",
23 source_range: [18; 18), 37 source_range: [18; 18),
38 text_edit: TextEdit {
39 atoms: [
40 AtomTextEdit {
41 delete: [18; 18),
42 insert: "std"
43 }
44 ]
45 },
24 kind: Module 46 kind: Module
25 } 47 }
26] 48]
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..3b6ff57c1 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:10:52.081693428Z"
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,14 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "bar", 9 label: "bar",
10 source_range: [9; 9), 10 source_range: [9; 9),
11 text_edit: TextEdit {
12 atoms: [
13 AtomTextEdit {
14 delete: [9; 9),
15 insert: "bar"
16 }
17 ]
18 },
11 kind: Module 19 kind: Module
12 } 20 }
13] 21]
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..1fb15ee0d 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:10:52.018717911Z"
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,14 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "Spam", 9 label: "Spam",
10 source_range: [23; 25), 10 source_range: [23; 25),
11 text_edit: TextEdit {
12 atoms: [
13 AtomTextEdit {
14 delete: [23; 25),
15 insert: "Spam"
16 }
17 ]
18 },
11 kind: Struct 19 kind: Struct
12 } 20 }
13] 21]
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..34e75ef80 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:10:51.979744970Z"
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,66 @@ 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 text_edit: TextEdit {
12 insert_text: "if $0 {}", 12 atoms: [
13 insert_text_format: Snippet 13 AtomTextEdit {
14 delete: [85; 85),
15 insert: "if $0 {}"
16 }
17 ]
18 },
19 kind: Keyword
14 }, 20 },
15 CompletionItem { 21 CompletionItem {
16 label: "loop", 22 label: "loop",
17 source_range: [85; 85), 23 source_range: [85; 85),
18 kind: Keyword, 24 text_edit: TextEdit {
19 insert_text: "loop {$0}", 25 atoms: [
20 insert_text_format: Snippet 26 AtomTextEdit {
27 delete: [85; 85),
28 insert: "loop {$0}"
29 }
30 ]
31 },
32 kind: Keyword
21 }, 33 },
22 CompletionItem { 34 CompletionItem {
23 label: "match", 35 label: "match",
24 source_range: [85; 85), 36 source_range: [85; 85),
25 kind: Keyword, 37 text_edit: TextEdit {
26 insert_text: "match $0 {}", 38 atoms: [
27 insert_text_format: Snippet 39 AtomTextEdit {
40 delete: [85; 85),
41 insert: "match $0 {}"
42 }
43 ]
44 },
45 kind: Keyword
28 }, 46 },
29 CompletionItem { 47 CompletionItem {
30 label: "return", 48 label: "return",
31 source_range: [85; 85), 49 source_range: [85; 85),
32 kind: Keyword, 50 text_edit: TextEdit {
33 insert_text: "return $0", 51 atoms: [
34 insert_text_format: Snippet 52 AtomTextEdit {
53 delete: [85; 85),
54 insert: "return $0"
55 }
56 ]
57 },
58 kind: Keyword
35 }, 59 },
36 CompletionItem { 60 CompletionItem {
37 label: "while", 61 label: "while",
38 source_range: [85; 85), 62 source_range: [85; 85),
39 kind: Keyword, 63 text_edit: TextEdit {
40 insert_text: "while $0 {}", 64 atoms: [
41 insert_text_format: Snippet 65 AtomTextEdit {
66 delete: [85; 85),
67 insert: "while $0 {}"
68 }
69 ]
70 },
71 kind: Keyword
42 } 72 }
43] 73]
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..89ae3d405 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:10:52.163807552Z"
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,28 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "frobnicate", 9 label: "frobnicate",
10 source_range: [35; 39), 10 source_range: [35; 39),
11 text_edit: TextEdit {
12 atoms: [
13 AtomTextEdit {
14 delete: [35; 39),
15 insert: "frobnicate"
16 }
17 ]
18 },
11 kind: Function, 19 kind: Function,
12 detail: "fn frobnicate()" 20 detail: "fn frobnicate()"
13 }, 21 },
14 CompletionItem { 22 CompletionItem {
15 label: "main", 23 label: "main",
16 source_range: [35; 39), 24 source_range: [35; 39),
25 text_edit: TextEdit {
26 atoms: [
27 AtomTextEdit {
28 delete: [35; 39),
29 insert: "main"
30 }
31 ]
32 },
17 kind: Function, 33 kind: Function,
18 detail: "fn main()" 34 detail: "fn main()"
19 } 35 }
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..ab4075c50 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:10:52.194798097Z"
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,14 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "new", 9 label: "new",
10 source_range: [67; 69), 10 source_range: [67; 69),
11 text_edit: TextEdit {
12 atoms: [
13 AtomTextEdit {
14 delete: [67; 69),
15 insert: "new"
16 }
17 ]
18 },
11 kind: Method, 19 kind: Method,
12 detail: "fn new() -> Foo" 20 detail: "fn new() -> Foo"
13 } 21 }
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..259f9fc62 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:10:52.156083575Z"
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,14 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "foo", 9 label: "foo",
10 source_range: [40; 41), 10 source_range: [40; 41),
11 text_edit: TextEdit {
12 atoms: [
13 AtomTextEdit {
14 delete: [40; 41),
15 insert: "foo"
16 }
17 ]
18 },
11 kind: Function, 19 kind: Function,
12 detail: "pub fn foo()" 20 detail: "pub fn foo()"
13 } 21 }
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..7af2f3eb9 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:10:52.134207539Z"
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,28 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "bar", 9 label: "bar",
10 source_range: [129; 129), 10 source_range: [129; 129),
11 text_edit: TextEdit {
12 atoms: [
13 AtomTextEdit {
14 delete: [129; 129),
15 insert: "bar"
16 }
17 ]
18 },
11 kind: Binding 19 kind: Binding
12 }, 20 },
13 CompletionItem { 21 CompletionItem {
14 label: "foo", 22 label: "foo",
15 source_range: [129; 129), 23 source_range: [129; 129),
24 text_edit: TextEdit {
25 atoms: [
26 AtomTextEdit {
27 delete: [129; 129),
28 insert: "foo()$0"
29 }
30 ]
31 },
16 kind: Function, 32 kind: Function,
17 detail: "fn foo() ->", 33 detail: "fn foo() ->"
18 insert_text: "foo()$0",
19 insert_text_format: Snippet
20 } 34 }
21] 35]
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..7f36a5ec5 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:10:52.033853029Z"
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,14 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "Bar", 9 label: "Bar",
10 source_range: [116; 116), 10 source_range: [116; 116),
11 text_edit: TextEdit {
12 atoms: [
13 AtomTextEdit {
14 delete: [116; 116),
15 insert: "Bar"
16 }
17 ]
18 },
11 kind: EnumVariant, 19 kind: EnumVariant,
12 detail: "(i32)", 20 detail: "(i32)",
13 documentation: Documentation( 21 documentation: Documentation(
@@ -17,6 +25,14 @@ expression: kind_completions
17 CompletionItem { 25 CompletionItem {
18 label: "Foo", 26 label: "Foo",
19 source_range: [116; 116), 27 source_range: [116; 116),
28 text_edit: TextEdit {
29 atoms: [
30 AtomTextEdit {
31 delete: [116; 116),
32 insert: "Foo"
33 }
34 ]
35 },
20 kind: EnumVariant, 36 kind: EnumVariant,
21 detail: "()", 37 detail: "()",
22 documentation: Documentation( 38 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..0d2390eb2 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:10:52.039179076Z"
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,14 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "Bar", 9 label: "Bar",
10 source_range: [180; 180), 10 source_range: [180; 180),
11 text_edit: TextEdit {
12 atoms: [
13 AtomTextEdit {
14 delete: [180; 180),
15 insert: "Bar"
16 }
17 ]
18 },
11 kind: EnumVariant, 19 kind: EnumVariant,
12 detail: "(i32, u32)", 20 detail: "(i32, u32)",
13 documentation: Documentation( 21 documentation: Documentation(
@@ -17,6 +25,14 @@ expression: kind_completions
17 CompletionItem { 25 CompletionItem {
18 label: "Foo", 26 label: "Foo",
19 source_range: [180; 180), 27 source_range: [180; 180),
28 text_edit: TextEdit {
29 atoms: [
30 AtomTextEdit {
31 delete: [180; 180),
32 insert: "Foo"
33 }
34 ]
35 },
20 kind: EnumVariant, 36 kind: EnumVariant,
21 detail: "()", 37 detail: "()",
22 documentation: Documentation( 38 documentation: Documentation(
@@ -26,6 +42,14 @@ expression: kind_completions
26 CompletionItem { 42 CompletionItem {
27 label: "S", 43 label: "S",
28 source_range: [180; 180), 44 source_range: [180; 180),
45 text_edit: TextEdit {
46 atoms: [
47 AtomTextEdit {
48 delete: [180; 180),
49 insert: "S"
50 }
51 ]
52 },
29 kind: EnumVariant, 53 kind: EnumVariant,
30 detail: "(S)" 54 detail: "(S)"
31 } 55 }
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..249b51311 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:10:52.097703010Z"
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,14 @@ 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 text_edit: TextEdit {
12 atoms: [
13 AtomTextEdit {
14 delete: [4; 4),
15 insert: "other_crate"
16 }
17 ]
18 },
11 kind: Module 19 kind: Module
12 } 20 }
13] 21]
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..d73860e72 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:10:52.113095718Z"
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,28 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "T", 9 label: "T",
10 source_range: [44; 44), 10 source_range: [44; 44),
11 text_edit: TextEdit {
12 atoms: [
13 AtomTextEdit {
14 delete: [44; 44),
15 insert: "T"
16 }
17 ]
18 },
11 kind: TypeParam 19 kind: TypeParam
12 }, 20 },
13 CompletionItem { 21 CompletionItem {
14 label: "quux", 22 label: "quux",
15 source_range: [44; 44), 23 source_range: [44; 44),
24 text_edit: TextEdit {
25 atoms: [
26 AtomTextEdit {
27 delete: [44; 44),
28 insert: "quux()$0"
29 }
30 ]
31 },
16 kind: Function, 32 kind: Function,
17 detail: "fn quux<T>()", 33 detail: "fn quux<T>()"
18 insert_text: "quux()$0",
19 insert_text_format: Snippet
20 } 34 }
21] 35]
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..b75350f0e 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:10:52.117910091Z"
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,27 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "T", 9 label: "T",
10 source_range: [46; 46), 10 source_range: [46; 46),
11 text_edit: TextEdit {
12 atoms: [
13 AtomTextEdit {
14 delete: [46; 46),
15 insert: "T"
16 }
17 ]
18 },
11 kind: TypeParam 19 kind: TypeParam
12 }, 20 },
13 CompletionItem { 21 CompletionItem {
14 label: "X", 22 label: "X",
15 source_range: [46; 46), 23 source_range: [46; 46),
24 text_edit: TextEdit {
25 atoms: [
26 AtomTextEdit {
27 delete: [46; 46),
28 insert: "X"
29 }
30 ]
31 },
16 kind: Struct 32 kind: Struct
17 } 33 }
18] 34]
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..9a42b6c12 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:10:52.160884429Z"
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,29 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "main", 9 label: "main",
10 source_range: [53; 56), 10 source_range: [53; 56),
11 text_edit: TextEdit {
12 atoms: [
13 AtomTextEdit {
14 delete: [53; 56),
15 insert: "main()$0"
16 }
17 ]
18 },
11 kind: Function, 19 kind: Function,
12 detail: "fn main()", 20 detail: "fn main()"
13 insert_text: "main()$0",
14 insert_text_format: Snippet
15 }, 21 },
16 CompletionItem { 22 CompletionItem {
17 label: "no_args", 23 label: "no_args",
18 source_range: [53; 56), 24 source_range: [53; 56),
25 text_edit: TextEdit {
26 atoms: [
27 AtomTextEdit {
28 delete: [53; 56),
29 insert: "no_args()$0"
30 }
31 ]
32 },
19 kind: Function, 33 kind: Function,
20 detail: "fn no_args()", 34 detail: "fn no_args()"
21 insert_text: "no_args()$0",
22 insert_text_format: Snippet
23 } 35 }
24] 36]
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..5397a0bbe 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:10:52.192876554Z"
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,29 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "main", 9 label: "main",
10 source_range: [72; 77), 10 source_range: [72; 77),
11 text_edit: TextEdit {
12 atoms: [
13 AtomTextEdit {
14 delete: [72; 77),
15 insert: "main()$0"
16 }
17 ]
18 },
11 kind: Function, 19 kind: Function,
12 detail: "fn main()", 20 detail: "fn main()"
13 insert_text: "main()$0",
14 insert_text_format: Snippet
15 }, 21 },
16 CompletionItem { 22 CompletionItem {
17 label: "with_args", 23 label: "with_args",
18 source_range: [72; 77), 24 source_range: [72; 77),
25 text_edit: TextEdit {
26 atoms: [
27 AtomTextEdit {
28 delete: [72; 77),
29 insert: "with_args($0)"
30 }
31 ]
32 },
19 kind: Function, 33 kind: Function,
20 detail: "fn with_args(x: i32, y: String)", 34 detail: "fn with_args(x: i32, y: String)"
21 insert_text: "with_args($0)",
22 insert_text_format: Snippet
23 } 35 }
24] 36]
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..97c128dcb 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:10:52.224275781Z"
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,15 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "foo", 9 label: "foo",
10 source_range: [139; 140), 10 source_range: [139; 140),
11 text_edit: TextEdit {
12 atoms: [
13 AtomTextEdit {
14 delete: [139; 140),
15 insert: "foo()$0"
16 }
17 ]
18 },
11 kind: Method, 19 kind: Method,
12 detail: "fn foo(&self)", 20 detail: "fn foo(&self)"
13 insert_text: "foo()$0",
14 insert_text_format: Snippet
15 } 21 }
16] 22]
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..18f1aa846 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:10:51.982940400Z"
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,66 @@ 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 text_edit: TextEdit {
12 insert_text: "if $0 {}", 12 atoms: [
13 insert_text_format: Snippet 13 AtomTextEdit {
14 delete: [41; 41),
15 insert: "if $0 {}"
16 }
17 ]
18 },
19 kind: Keyword
14 }, 20 },
15 CompletionItem { 21 CompletionItem {
16 label: "loop", 22 label: "loop",
17 source_range: [41; 41), 23 source_range: [41; 41),
18 kind: Keyword, 24 text_edit: TextEdit {
19 insert_text: "loop {$0}", 25 atoms: [
20 insert_text_format: Snippet 26 AtomTextEdit {
27 delete: [41; 41),
28 insert: "loop {$0}"
29 }
30 ]
31 },
32 kind: Keyword
21 }, 33 },
22 CompletionItem { 34 CompletionItem {
23 label: "match", 35 label: "match",
24 source_range: [41; 41), 36 source_range: [41; 41),
25 kind: Keyword, 37 text_edit: TextEdit {
26 insert_text: "match $0 {}", 38 atoms: [
27 insert_text_format: Snippet 39 AtomTextEdit {
40 delete: [41; 41),
41 insert: "match $0 {}"
42 }
43 ]
44 },
45 kind: Keyword
28 }, 46 },
29 CompletionItem { 47 CompletionItem {
30 label: "return", 48 label: "return",
31 source_range: [41; 41), 49 source_range: [41; 41),
32 kind: Keyword, 50 text_edit: TextEdit {
33 insert_text: "return;", 51 atoms: [
34 insert_text_format: Snippet 52 AtomTextEdit {
53 delete: [41; 41),
54 insert: "return;"
55 }
56 ]
57 },
58 kind: Keyword
35 }, 59 },
36 CompletionItem { 60 CompletionItem {
37 label: "while", 61 label: "while",
38 source_range: [41; 41), 62 source_range: [41; 41),
39 kind: Keyword, 63 text_edit: TextEdit {
40 insert_text: "while $0 {}", 64 atoms: [
41 insert_text_format: Snippet 65 AtomTextEdit {
66 delete: [41; 41),
67 insert: "while $0 {}"
68 }
69 ]
70 },
71 kind: Keyword
42 } 72 }
43] 73]
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..07e673852 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:10:51.986894362Z"
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,92 @@ 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 text_edit: TextEdit {
12 insert_text: "else {$0}", 12 atoms: [
13 insert_text_format: Snippet 13 AtomTextEdit {
14 delete: [92; 92),
15 insert: "else {$0}"
16 }
17 ]
18 },
19 kind: Keyword
14 }, 20 },
15 CompletionItem { 21 CompletionItem {
16 label: "else if", 22 label: "else if",
17 source_range: [92; 92), 23 source_range: [92; 92),
18 kind: Keyword, 24 text_edit: TextEdit {
19 insert_text: "else if $0 {}", 25 atoms: [
20 insert_text_format: Snippet 26 AtomTextEdit {
27 delete: [92; 92),
28 insert: "else if $0 {}"
29 }
30 ]
31 },
32 kind: Keyword
21 }, 33 },
22 CompletionItem { 34 CompletionItem {
23 label: "if", 35 label: "if",
24 source_range: [92; 92), 36 source_range: [92; 92),
25 kind: Keyword, 37 text_edit: TextEdit {
26 insert_text: "if $0 {}", 38 atoms: [
27 insert_text_format: Snippet 39 AtomTextEdit {
40 delete: [92; 92),
41 insert: "if $0 {}"
42 }
43 ]
44 },
45 kind: Keyword
28 }, 46 },
29 CompletionItem { 47 CompletionItem {
30 label: "loop", 48 label: "loop",
31 source_range: [92; 92), 49 source_range: [92; 92),
32 kind: Keyword, 50 text_edit: TextEdit {
33 insert_text: "loop {$0}", 51 atoms: [
34 insert_text_format: Snippet 52 AtomTextEdit {
53 delete: [92; 92),
54 insert: "loop {$0}"
55 }
56 ]
57 },
58 kind: Keyword
35 }, 59 },
36 CompletionItem { 60 CompletionItem {
37 label: "match", 61 label: "match",
38 source_range: [92; 92), 62 source_range: [92; 92),
39 kind: Keyword, 63 text_edit: TextEdit {
40 insert_text: "match $0 {}", 64 atoms: [
41 insert_text_format: Snippet 65 AtomTextEdit {
66 delete: [92; 92),
67 insert: "match $0 {}"
68 }
69 ]
70 },
71 kind: Keyword
42 }, 72 },
43 CompletionItem { 73 CompletionItem {
44 label: "return", 74 label: "return",
45 source_range: [92; 92), 75 source_range: [92; 92),
46 kind: Keyword, 76 text_edit: TextEdit {
47 insert_text: "return;", 77 atoms: [
48 insert_text_format: Snippet 78 AtomTextEdit {
79 delete: [92; 92),
80 insert: "return;"
81 }
82 ]
83 },
84 kind: Keyword
49 }, 85 },
50 CompletionItem { 86 CompletionItem {
51 label: "while", 87 label: "while",
52 source_range: [92; 92), 88 source_range: [92; 92),
53 kind: Keyword, 89 text_edit: TextEdit {
54 insert_text: "while $0 {}", 90 atoms: [
55 insert_text_format: Snippet 91 AtomTextEdit {
92 delete: [92; 92),
93 insert: "while $0 {}"
94 }
95 ]
96 },
97 kind: Keyword
56 } 98 }
57] 99]
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..a31881175 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:10:52.010821546Z"
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,66 @@ 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 text_edit: TextEdit {
12 insert_text: "if $0 {}", 12 atoms: [
13 insert_text_format: Snippet 13 AtomTextEdit {
14 delete: [48; 48),
15 insert: "if $0 {}"
16 }
17 ]
18 },
19 kind: Keyword
14 }, 20 },
15 CompletionItem { 21 CompletionItem {
16 label: "loop", 22 label: "loop",
17 source_range: [48; 48), 23 source_range: [48; 48),
18 kind: Keyword, 24 text_edit: TextEdit {
19 insert_text: "loop {$0}", 25 atoms: [
20 insert_text_format: Snippet 26 AtomTextEdit {
27 delete: [48; 48),
28 insert: "loop {$0}"
29 }
30 ]
31 },
32 kind: Keyword
21 }, 33 },
22 CompletionItem { 34 CompletionItem {
23 label: "match", 35 label: "match",
24 source_range: [48; 48), 36 source_range: [48; 48),
25 kind: Keyword, 37 text_edit: TextEdit {
26 insert_text: "match $0 {}", 38 atoms: [
27 insert_text_format: Snippet 39 AtomTextEdit {
40 delete: [48; 48),
41 insert: "match $0 {}"
42 }
43 ]
44 },
45 kind: Keyword
28 }, 46 },
29 CompletionItem { 47 CompletionItem {
30 label: "return", 48 label: "return",
31 source_range: [48; 48), 49 source_range: [48; 48),
32 kind: Keyword, 50 text_edit: TextEdit {
33 insert_text: "return $0;", 51 atoms: [
34 insert_text_format: Snippet 52 AtomTextEdit {
53 delete: [48; 48),
54 insert: "return $0;"
55 }
56 ]
57 },
58 kind: Keyword
35 }, 59 },
36 CompletionItem { 60 CompletionItem {
37 label: "while", 61 label: "while",
38 source_range: [48; 48), 62 source_range: [48; 48),
39 kind: Keyword, 63 text_edit: TextEdit {
40 insert_text: "while $0 {}", 64 atoms: [
41 insert_text_format: Snippet 65 AtomTextEdit {
66 delete: [48; 48),
67 insert: "while $0 {}"
68 }
69 ]
70 },
71 kind: Keyword
42 } 72 }
43] 73]
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..8e66260f6 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:10:52.039207401Z"
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,66 @@ 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 text_edit: TextEdit {
12 insert_text: "if $0 {}", 12 atoms: [
13 insert_text_format: Snippet 13 AtomTextEdit {
14 delete: [41; 41),
15 insert: "if $0 {}"
16 }
17 ]
18 },
19 kind: Keyword
14 }, 20 },
15 CompletionItem { 21 CompletionItem {
16 label: "loop", 22 label: "loop",
17 source_range: [41; 41), 23 source_range: [41; 41),
18 kind: Keyword, 24 text_edit: TextEdit {
19 insert_text: "loop {$0}", 25 atoms: [
20 insert_text_format: Snippet 26 AtomTextEdit {
27 delete: [41; 41),
28 insert: "loop {$0}"
29 }
30 ]
31 },
32 kind: Keyword
21 }, 33 },
22 CompletionItem { 34 CompletionItem {
23 label: "match", 35 label: "match",
24 source_range: [41; 41), 36 source_range: [41; 41),
25 kind: Keyword, 37 text_edit: TextEdit {
26 insert_text: "match $0 {}", 38 atoms: [
27 insert_text_format: Snippet 39 AtomTextEdit {
40 delete: [41; 41),
41 insert: "match $0 {}"
42 }
43 ]
44 },
45 kind: Keyword
28 }, 46 },
29 CompletionItem { 47 CompletionItem {
30 label: "return", 48 label: "return",
31 source_range: [41; 41), 49 source_range: [41; 41),
32 kind: Keyword, 50 text_edit: TextEdit {
33 insert_text: "return;", 51 atoms: [
34 insert_text_format: Snippet 52 AtomTextEdit {
53 delete: [41; 41),
54 insert: "return;"
55 }
56 ]
57 },
58 kind: Keyword
35 }, 59 },
36 CompletionItem { 60 CompletionItem {
37 label: "while", 61 label: "while",
38 source_range: [41; 41), 62 source_range: [41; 41),
39 kind: Keyword, 63 text_edit: TextEdit {
40 insert_text: "while $0 {}", 64 atoms: [
41 insert_text_format: Snippet 65 AtomTextEdit {
66 delete: [41; 41),
67 insert: "while $0 {}"
68 }
69 ]
70 },
71 kind: Keyword
42 } 72 }
43] 73]
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..facd37bd9 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:10:51.979744931Z"
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,40 @@ 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 text_edit: TextEdit {
12 insert_text: "crate::", 12 atoms: [
13 insert_text_format: PlainText 13 AtomTextEdit {
14 delete: [17; 17),
15 insert: "crate::"
16 }
17 ]
18 },
19 kind: Keyword
14 }, 20 },
15 CompletionItem { 21 CompletionItem {
16 label: "self", 22 label: "self",
17 source_range: [17; 17), 23 source_range: [17; 17),
24 text_edit: TextEdit {
25 atoms: [
26 AtomTextEdit {
27 delete: [17; 17),
28 insert: "self"
29 }
30 ]
31 },
18 kind: Keyword 32 kind: Keyword
19 }, 33 },
20 CompletionItem { 34 CompletionItem {
21 label: "super", 35 label: "super",
22 source_range: [17; 17), 36 source_range: [17; 17),
23 kind: Keyword, 37 text_edit: TextEdit {
24 insert_text: "super::", 38 atoms: [
25 insert_text_format: PlainText 39 AtomTextEdit {
40 delete: [17; 17),
41 insert: "super::"
42 }
43 ]
44 },
45 kind: Keyword
26 } 46 }
27] 47]
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..7a9792b0e 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:10:52.008665355Z"
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,27 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "self", 9 label: "self",
10 source_range: [20; 20), 10 source_range: [20; 20),
11 text_edit: TextEdit {
12 atoms: [
13 AtomTextEdit {
14 delete: [20; 20),
15 insert: "self"
16 }
17 ]
18 },
11 kind: Keyword 19 kind: Keyword
12 }, 20 },
13 CompletionItem { 21 CompletionItem {
14 label: "super", 22 label: "super",
15 source_range: [20; 20), 23 source_range: [20; 20),
16 kind: Keyword, 24 text_edit: TextEdit {
17 insert_text: "super::", 25 atoms: [
18 insert_text_format: PlainText 26 AtomTextEdit {
27 delete: [20; 20),
28 insert: "super::"
29 }
30 ]
31 },
32 kind: Keyword
19 } 33 }
20] 34]
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..9f0731aa1 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:10:52.032133616Z"
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,27 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "self", 9 label: "self",
10 source_range: [24; 24), 10 source_range: [24; 24),
11 text_edit: TextEdit {
12 atoms: [
13 AtomTextEdit {
14 delete: [24; 24),
15 insert: "self"
16 }
17 ]
18 },
11 kind: Keyword 19 kind: Keyword
12 }, 20 },
13 CompletionItem { 21 CompletionItem {
14 label: "super", 22 label: "super",
15 source_range: [24; 24), 23 source_range: [24; 24),
16 kind: Keyword, 24 text_edit: TextEdit {
17 insert_text: "super::", 25 atoms: [
18 insert_text_format: PlainText 26 AtomTextEdit {
27 delete: [24; 24),
28 insert: "super::"
29 }
30 ]
31 },
32 kind: Keyword
19 } 33 }
20] 34]
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..7d90ef4f3 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:10:51.985317165Z"
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,66 @@ 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 text_edit: TextEdit {
12 insert_text: "if $0 {}", 12 atoms: [
13 insert_text_format: Snippet 13 AtomTextEdit {
14 delete: [83; 83),
15 insert: "if $0 {}"
16 }
17 ]
18 },
19 kind: Keyword
14 }, 20 },
15 CompletionItem { 21 CompletionItem {
16 label: "loop", 22 label: "loop",
17 source_range: [83; 83), 23 source_range: [83; 83),
18 kind: Keyword, 24 text_edit: TextEdit {
19 insert_text: "loop {$0}", 25 atoms: [
20 insert_text_format: Snippet 26 AtomTextEdit {
27 delete: [83; 83),
28 insert: "loop {$0}"
29 }
30 ]
31 },
32 kind: Keyword
21 }, 33 },
22 CompletionItem { 34 CompletionItem {
23 label: "match", 35 label: "match",
24 source_range: [83; 83), 36 source_range: [83; 83),
25 kind: Keyword, 37 text_edit: TextEdit {
26 insert_text: "match $0 {}", 38 atoms: [
27 insert_text_format: Snippet 39 AtomTextEdit {
40 delete: [83; 83),
41 insert: "match $0 {}"
42 }
43 ]
44 },
45 kind: Keyword
28 }, 46 },
29 CompletionItem { 47 CompletionItem {
30 label: "return", 48 label: "return",
31 source_range: [83; 83), 49 source_range: [83; 83),
32 kind: Keyword, 50 text_edit: TextEdit {
33 insert_text: "return $0;", 51 atoms: [
34 insert_text_format: Snippet 52 AtomTextEdit {
53 delete: [83; 83),
54 insert: "return $0;"
55 }
56 ]
57 },
58 kind: Keyword
35 }, 59 },
36 CompletionItem { 60 CompletionItem {
37 label: "while", 61 label: "while",
38 source_range: [83; 83), 62 source_range: [83; 83),
39 kind: Keyword, 63 text_edit: TextEdit {
40 insert_text: "while $0 {}", 64 atoms: [
41 insert_text_format: Snippet 65 AtomTextEdit {
66 delete: [83; 83),
67 insert: "while $0 {}"
68 }
69 ]
70 },
71 kind: Keyword
42 } 72 }
43] 73]
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..94e3a2dcb 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:10:52.013549824Z"
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,66 @@ 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 text_edit: TextEdit {
12 insert_text: "if $0 {}", 12 atoms: [
13 insert_text_format: Snippet 13 AtomTextEdit {
14 delete: [83; 83),
15 insert: "if $0 {}"
16 }
17 ]
18 },
19 kind: Keyword
14 }, 20 },
15 CompletionItem { 21 CompletionItem {
16 label: "loop", 22 label: "loop",
17 source_range: [83; 83), 23 source_range: [83; 83),
18 kind: Keyword, 24 text_edit: TextEdit {
19 insert_text: "loop {$0}", 25 atoms: [
20 insert_text_format: Snippet 26 AtomTextEdit {
27 delete: [83; 83),
28 insert: "loop {$0}"
29 }
30 ]
31 },
32 kind: Keyword
21 }, 33 },
22 CompletionItem { 34 CompletionItem {
23 label: "match", 35 label: "match",
24 source_range: [83; 83), 36 source_range: [83; 83),
25 kind: Keyword, 37 text_edit: TextEdit {
26 insert_text: "match $0 {}", 38 atoms: [
27 insert_text_format: Snippet 39 AtomTextEdit {
40 delete: [83; 83),
41 insert: "match $0 {}"
42 }
43 ]
44 },
45 kind: Keyword
28 }, 46 },
29 CompletionItem { 47 CompletionItem {
30 label: "return", 48 label: "return",
31 source_range: [83; 83), 49 source_range: [83; 83),
32 kind: Keyword, 50 text_edit: TextEdit {
33 insert_text: "return $0;", 51 atoms: [
34 insert_text_format: Snippet 52 AtomTextEdit {
53 delete: [83; 83),
54 insert: "return $0;"
55 }
56 ]
57 },
58 kind: Keyword
35 }, 59 },
36 CompletionItem { 60 CompletionItem {
37 label: "while", 61 label: "while",
38 source_range: [83; 83), 62 source_range: [83; 83),
39 kind: Keyword, 63 text_edit: TextEdit {
40 insert_text: "while $0 {}", 64 atoms: [
41 insert_text_format: Snippet 65 AtomTextEdit {
66 delete: [83; 83),
67 insert: "while $0 {}"
68 }
69 ]
70 },
71 kind: Keyword
42 } 72 }
43] 73]
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..9e4062641 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:10:51.944926087Z"
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,15 @@ 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 text_edit: TextEdit {
12 atoms: [
13 AtomTextEdit {
14 delete: [249; 249),
15 insert: "the_method()$0"
16 }
17 ]
18 },
11 kind: Method, 19 kind: Method,
12 detail: "fn the_method(&self)", 20 detail: "fn the_method(&self)"
13 insert_text: "the_method()$0",
14 insert_text_format: Snippet
15 } 21 }
16] 22]
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..f8b142b71 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:10:51.944760801Z"
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,15 @@ 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 text_edit: TextEdit {
12 atoms: [
13 AtomTextEdit {
14 delete: [144; 144),
15 insert: "the_method()$0"
16 }
17 ]
18 },
11 kind: Method, 19 kind: Method,
12 detail: "fn the_method(&self)", 20 detail: "fn the_method(&self)"
13 insert_text: "the_method()$0",
14 insert_text_format: Snippet
15 } 21 }
16] 22]
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..670803b6f 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:10:52.036530210Z"
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,14 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "my", 9 label: "my",
10 source_range: [23; 25), 10 source_range: [23; 25),
11 text_edit: TextEdit {
12 atoms: [
13 AtomTextEdit {
14 delete: [23; 25),
15 insert: "my"
16 }
17 ]
18 },
11 kind: Module, 19 kind: Module,
12 documentation: Documentation( 20 documentation: Documentation(
13 "Some simple\ndocs describing `mod my`." 21 "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..d082a9c2f 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:10:52.120932427Z"
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,41 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "Baz", 9 label: "Baz",
10 source_range: [89; 89), 10 source_range: [89; 89),
11 text_edit: TextEdit {
12 atoms: [
13 AtomTextEdit {
14 delete: [89; 89),
15 insert: "Baz"
16 }
17 ]
18 },
11 kind: Enum 19 kind: Enum
12 }, 20 },
13 CompletionItem { 21 CompletionItem {
14 label: "Foo", 22 label: "Foo",
15 source_range: [89; 89), 23 source_range: [89; 89),
24 text_edit: TextEdit {
25 atoms: [
26 AtomTextEdit {
27 delete: [89; 89),
28 insert: "Foo"
29 }
30 ]
31 },
16 kind: Struct 32 kind: Struct
17 }, 33 },
18 CompletionItem { 34 CompletionItem {
19 label: "quux", 35 label: "quux",
20 source_range: [89; 89), 36 source_range: [89; 89),
37 text_edit: TextEdit {
38 atoms: [
39 AtomTextEdit {
40 delete: [89; 89),
41 insert: "quux()$0"
42 }
43 ]
44 },
21 kind: Function, 45 kind: Function,
22 detail: "fn quux()", 46 detail: "fn quux()"
23 insert_text: "quux()$0",
24 insert_text_format: Snippet
25 } 47 }
26] 48]
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..daa3026fa 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:10:52.120931050Z"
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,28 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "Bar", 9 label: "Bar",
10 source_range: [101; 101), 10 source_range: [101; 101),
11 text_edit: TextEdit {
12 atoms: [
13 AtomTextEdit {
14 delete: [101; 101),
15 insert: "Bar"
16 }
17 ]
18 },
11 kind: Struct 19 kind: Struct
12 }, 20 },
13 CompletionItem { 21 CompletionItem {
14 label: "quux", 22 label: "quux",
15 source_range: [101; 101), 23 source_range: [101; 101),
24 text_edit: TextEdit {
25 atoms: [
26 AtomTextEdit {
27 delete: [101; 101),
28 insert: "quux()$0"
29 }
30 ]
31 },
16 kind: Function, 32 kind: Function,
17 detail: "fn quux()", 33 detail: "fn quux()"
18 insert_text: "quux()$0",
19 insert_text_format: Snippet
20 } 34 }
21] 35]
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..0536d2cd5 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:10:52.039178133Z"
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,27 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "Spam", 9 label: "Spam",
10 source_range: [12; 14), 10 source_range: [12; 14),
11 text_edit: TextEdit {
12 atoms: [
13 AtomTextEdit {
14 delete: [12; 14),
15 insert: "Spam"
16 }
17 ]
18 },
11 kind: Struct 19 kind: Struct
12 }, 20 },
13 CompletionItem { 21 CompletionItem {
14 label: "foo", 22 label: "foo",
15 source_range: [12; 14), 23 source_range: [12; 14),
24 text_edit: TextEdit {
25 atoms: [
26 AtomTextEdit {
27 delete: [12; 14),
28 insert: "foo"
29 }
30 ]
31 },
16 kind: Module 32 kind: Module
17 } 33 }
18] 34]
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..42f736d74 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:10:51.988658363Z"
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,92 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "break", 9 label: "break",
10 source_range: [106; 108), 10 source_range: [106; 108),
11 text_edit: TextEdit {
12 atoms: [
13 AtomTextEdit {
14 delete: [106; 108),
15 insert: "break"
16 }
17 ]
18 },
11 kind: Keyword 19 kind: Keyword
12 }, 20 },
13 CompletionItem { 21 CompletionItem {
14 label: "continue", 22 label: "continue",
15 source_range: [106; 108), 23 source_range: [106; 108),
24 text_edit: TextEdit {
25 atoms: [
26 AtomTextEdit {
27 delete: [106; 108),
28 insert: "continue"
29 }
30 ]
31 },
16 kind: Keyword 32 kind: Keyword
17 }, 33 },
18 CompletionItem { 34 CompletionItem {
19 label: "if", 35 label: "if",
20 source_range: [106; 108), 36 source_range: [106; 108),
21 kind: Keyword, 37 text_edit: TextEdit {
22 insert_text: "if $0 {}", 38 atoms: [
23 insert_text_format: Snippet 39 AtomTextEdit {
40 delete: [106; 108),
41 insert: "if $0 {}"
42 }
43 ]
44 },
45 kind: Keyword
24 }, 46 },
25 CompletionItem { 47 CompletionItem {
26 label: "loop", 48 label: "loop",
27 source_range: [106; 108), 49 source_range: [106; 108),
28 kind: Keyword, 50 text_edit: TextEdit {
29 insert_text: "loop {$0}", 51 atoms: [
30 insert_text_format: Snippet 52 AtomTextEdit {
53 delete: [106; 108),
54 insert: "loop {$0}"
55 }
56 ]
57 },
58 kind: Keyword
31 }, 59 },
32 CompletionItem { 60 CompletionItem {
33 label: "match", 61 label: "match",
34 source_range: [106; 108), 62 source_range: [106; 108),
35 kind: Keyword, 63 text_edit: TextEdit {
36 insert_text: "match $0 {}", 64 atoms: [
37 insert_text_format: Snippet 65 AtomTextEdit {
66 delete: [106; 108),
67 insert: "match $0 {}"
68 }
69 ]
70 },
71 kind: Keyword
38 }, 72 },
39 CompletionItem { 73 CompletionItem {
40 label: "return", 74 label: "return",
41 source_range: [106; 108), 75 source_range: [106; 108),
76 text_edit: TextEdit {
77 atoms: [
78 AtomTextEdit {
79 delete: [106; 108),
80 insert: "return"
81 }
82 ]
83 },
42 kind: Keyword 84 kind: Keyword
43 }, 85 },
44 CompletionItem { 86 CompletionItem {
45 label: "while", 87 label: "while",
46 source_range: [106; 108), 88 source_range: [106; 108),
47 kind: Keyword, 89 text_edit: TextEdit {
48 insert_text: "while $0 {}", 90 atoms: [
49 insert_text_format: Snippet 91 AtomTextEdit {
92 delete: [106; 108),
93 insert: "while $0 {}"
94 }
95 ]
96 },
97 kind: Keyword
50 } 98 }
51] 99]
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..0c651f26e 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:10:51.951199574Z"
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,14 @@ 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 text_edit: TextEdit {
12 atoms: [
13 AtomTextEdit {
14 delete: [98; 102),
15 insert: "file_id: FileId"
16 }
17 ]
18 },
11 lookup: "file_id" 19 lookup: "file_id"
12 } 20 }
13] 21]
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..1064e28c5 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:10:51.951199556Z"
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,14 @@ 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 text_edit: TextEdit {
12 atoms: [
13 AtomTextEdit {
14 delete: [98; 102),
15 insert: "file_id: FileId"
16 }
17 ]
18 },
11 lookup: "file_id" 19 lookup: "file_id"
12 } 20 }
13] 21]
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..548c0c9ce 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:10:51.973234775Z"
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,14 @@ 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 text_edit: TextEdit {
12 atoms: [
13 AtomTextEdit {
14 delete: [269; 273),
15 insert: "file_id: FileId"
16 }
17 ]
18 },
11 lookup: "file_id" 19 lookup: "file_id"
12 } 20 }
13] 21]
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..fcca19b77 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:10:52.087222569Z"
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,92 @@ 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)",
12 insert_text: "dbg!(bar)",
13 insert_text_format: Snippet,
14 text_edit: TextEdit { 11 text_edit: TextEdit {
15 atoms: [ 12 atoms: [
16 AtomTextEdit { 13 AtomTextEdit {
17 delete: [72; 76), 14 delete: [72; 76),
18 insert: "" 15 insert: "dbg!(bar)"
19 } 16 }
20 ] 17 ]
21 } 18 },
19 detail: "dbg!(expr)"
22 }, 20 },
23 CompletionItem { 21 CompletionItem {
24 label: "if", 22 label: "if",
25 source_range: [76; 76), 23 source_range: [76; 76),
26 detail: "if expr {}",
27 insert_text: "if bar {$0}",
28 insert_text_format: Snippet,
29 text_edit: TextEdit { 24 text_edit: TextEdit {
30 atoms: [ 25 atoms: [
31 AtomTextEdit { 26 AtomTextEdit {
32 delete: [72; 76), 27 delete: [72; 76),
33 insert: "" 28 insert: "if bar {$0}"
34 } 29 }
35 ] 30 ]
36 } 31 },
32 detail: "if expr {}"
37 }, 33 },
38 CompletionItem { 34 CompletionItem {
39 label: "match", 35 label: "match",
40 source_range: [76; 76), 36 source_range: [76; 76),
41 detail: "match expr {}",
42 insert_text: "match bar {\n${1:_} => {$0\\},\n}",
43 insert_text_format: Snippet,
44 text_edit: TextEdit { 37 text_edit: TextEdit {
45 atoms: [ 38 atoms: [
46 AtomTextEdit { 39 AtomTextEdit {
47 delete: [72; 76), 40 delete: [72; 76),
48 insert: "" 41 insert: "match bar {\n${1:_} => {$0\\},\n}"
49 } 42 }
50 ] 43 ]
51 } 44 },
45 detail: "match expr {}"
52 }, 46 },
53 CompletionItem { 47 CompletionItem {
54 label: "not", 48 label: "not",
55 source_range: [76; 76), 49 source_range: [76; 76),
56 detail: "!expr",
57 insert_text: "!bar",
58 insert_text_format: Snippet,
59 text_edit: TextEdit { 50 text_edit: TextEdit {
60 atoms: [ 51 atoms: [
61 AtomTextEdit { 52 AtomTextEdit {
62 delete: [72; 76), 53 delete: [72; 76),
63 insert: "" 54 insert: "!bar"
64 } 55 }
65 ] 56 ]
66 } 57 },
58 detail: "!expr"
67 }, 59 },
68 CompletionItem { 60 CompletionItem {
69 label: "ref", 61 label: "ref",
70 source_range: [76; 76), 62 source_range: [76; 76),
71 detail: "&expr",
72 insert_text: "&bar",
73 insert_text_format: Snippet,
74 text_edit: TextEdit { 63 text_edit: TextEdit {
75 atoms: [ 64 atoms: [
76 AtomTextEdit { 65 AtomTextEdit {
77 delete: [72; 76), 66 delete: [72; 76),
78 insert: "" 67 insert: "&bar"
79 } 68 }
80 ] 69 ]
81 } 70 },
71 detail: "&expr"
82 }, 72 },
83 CompletionItem { 73 CompletionItem {
84 label: "refm", 74 label: "refm",
85 source_range: [76; 76), 75 source_range: [76; 76),
86 detail: "&mut expr",
87 insert_text: "&mut bar",
88 insert_text_format: Snippet,
89 text_edit: TextEdit { 76 text_edit: TextEdit {
90 atoms: [ 77 atoms: [
91 AtomTextEdit { 78 AtomTextEdit {
92 delete: [72; 76), 79 delete: [72; 76),
93 insert: "" 80 insert: "&mut bar"
94 } 81 }
95 ] 82 ]
96 } 83 },
84 detail: "&mut expr"
97 }, 85 },
98 CompletionItem { 86 CompletionItem {
99 label: "while", 87 label: "while",
100 source_range: [76; 76), 88 source_range: [76; 76),
101 detail: "while expr {}",
102 insert_text: "while bar {\n$0\n}",
103 insert_text_format: Snippet,
104 text_edit: TextEdit { 89 text_edit: TextEdit {
105 atoms: [ 90 atoms: [
106 AtomTextEdit { 91 AtomTextEdit {
107 delete: [72; 76), 92 delete: [72; 76),
108 insert: "" 93 insert: "while bar {\n$0\n}"
109 } 94 }
110 ] 95 ]
111 } 96 },
97 detail: "while expr {}"
112 } 98 }
113] 99]
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..954d1b4bc 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:10:52.125606324Z"
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,28 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "Foo", 9 label: "Foo",
10 source_range: [47; 47), 10 source_range: [47; 47),
11 text_edit: TextEdit {
12 atoms: [
13 AtomTextEdit {
14 delete: [47; 47),
15 insert: "Foo"
16 }
17 ]
18 },
11 kind: Struct 19 kind: Struct
12 }, 20 },
13 CompletionItem { 21 CompletionItem {
14 label: "x", 22 label: "x",
15 source_range: [47; 47), 23 source_range: [47; 47),
24 text_edit: TextEdit {
25 atoms: [
26 AtomTextEdit {
27 delete: [47; 47),
28 insert: "x()$0"
29 }
30 ]
31 },
16 kind: Function, 32 kind: Function,
17 detail: "fn x() ->", 33 detail: "fn x() ->"
18 insert_text: "x()$0",
19 insert_text_format: Snippet
20 } 34 }
21] 35]
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..3a88b7fbc 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:10:52.129525933Z"
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,27 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "Self", 9 label: "Self",
10 source_range: [25; 25), 10 source_range: [25; 25),
11 text_edit: TextEdit {
12 atoms: [
13 AtomTextEdit {
14 delete: [25; 25),
15 insert: "Self"
16 }
17 ]
18 },
11 kind: TypeParam 19 kind: TypeParam
12 }, 20 },
13 CompletionItem { 21 CompletionItem {
14 label: "self", 22 label: "self",
15 source_range: [25; 25), 23 source_range: [25; 25),
24 text_edit: TextEdit {
25 atoms: [
26 AtomTextEdit {
27 delete: [25; 25),
28 insert: "self"
29 }
30 ]
31 },
16 kind: Binding 32 kind: Binding
17 } 33 }
18] 34]
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..9bd6fe91d 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:10:52.156085697Z"
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,27 @@ 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 text_edit: TextEdit {
12 insert_text: "eprintln!(\"$0 = {:?}\", $0);", 12 atoms: [
13 insert_text_format: Snippet 13 AtomTextEdit {
14 delete: [17; 17),
15 insert: "eprintln!(\"$0 = {:?}\", $0);"
16 }
17 ]
18 },
19 kind: Snippet
14 }, 20 },
15 CompletionItem { 21 CompletionItem {
16 label: "ppd", 22 label: "ppd",
17 source_range: [17; 17), 23 source_range: [17; 17),
18 kind: Snippet, 24 text_edit: TextEdit {
19 insert_text: "eprintln!(\"$0 = {:#?}\", $0);", 25 atoms: [
20 insert_text_format: Snippet 26 AtomTextEdit {
27 delete: [17; 17),
28 insert: "eprintln!(\"$0 = {:#?}\", $0);"
29 }
30 ]
31 },
32 kind: Snippet
21 } 33 }
22] 34]
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..486b353ef 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:10:52.152402422Z"
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,28 @@ 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 text_edit: TextEdit {
12 atoms: [
13 AtomTextEdit {
14 delete: [66; 66),
15 insert: "#[test]\nfn ${1:feature}() {\n $0\n}"
16 }
17 ]
18 },
11 kind: Snippet, 19 kind: Snippet,
12 lookup: "tfn", 20 lookup: "tfn"
13 insert_text: "#[test]\nfn ${1:feature}() {\n $0\n}",
14 insert_text_format: Snippet
15 }, 21 },
16 CompletionItem { 22 CompletionItem {
17 label: "pub(crate)", 23 label: "pub(crate)",
18 source_range: [66; 66), 24 source_range: [66; 66),
19 kind: Snippet, 25 text_edit: TextEdit {
20 insert_text: "pub(crate) $0", 26 atoms: [
21 insert_text_format: Snippet 27 AtomTextEdit {
28 delete: [66; 66),
29 insert: "pub(crate) $0"
30 }
31 ]
32 },
33 kind: Snippet
22 } 34 }
23] 35]
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..b34f6f26f 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:10:52.050659483Z"
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,14 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "C", 9 label: "C",
10 source_range: [107; 107), 10 source_range: [107; 107),
11 text_edit: TextEdit {
12 atoms: [
13 AtomTextEdit {
14 delete: [107; 107),
15 insert: "C"
16 }
17 ]
18 },
11 kind: Const, 19 kind: Const,
12 detail: "const C: i32 = 42;", 20 detail: "const C: i32 = 42;",
13 documentation: Documentation( 21 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..f6c95074a 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:10:52.050659480Z"
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,18 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "m", 9 label: "m",
10 source_range: [100; 100), 10 source_range: [100; 100),
11 text_edit: TextEdit {
12 atoms: [
13 AtomTextEdit {
14 delete: [100; 100),
15 insert: "m()$0"
16 }
17 ]
18 },
11 kind: Method, 19 kind: Method,
12 detail: "fn m()", 20 detail: "fn m()",
13 documentation: Documentation( 21 documentation: Documentation(
14 "An associated method" 22 "An associated method"
15 ), 23 )
16 insert_text: "m()$0",
17 insert_text_format: Snippet
18 } 24 }
19] 25]
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..79168702c 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:10:52.066746177Z"
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,14 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "T", 9 label: "T",
10 source_range: [101; 101), 10 source_range: [101; 101),
11 text_edit: TextEdit {
12 atoms: [
13 AtomTextEdit {
14 delete: [101; 101),
15 insert: "T"
16 }
17 ]
18 },
11 kind: TypeAlias, 19 kind: TypeAlias,
12 detail: "type T = i32;", 20 detail: "type T = i32;",
13 documentation: Documentation( 21 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..f22bbd987 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:10:51.944776686Z"
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,14 @@ 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 text_edit: TextEdit {
12 atoms: [
13 AtomTextEdit {
14 delete: [85; 85),
15 insert: "the_field"
16 }
17 ]
18 },
11 kind: Field, 19 kind: Field,
12 detail: "u32" 20 detail: "u32"
13 } 21 }
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..8b53d5e95 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:10:51.944780241Z"
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,28 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "foo", 9 label: "foo",
10 source_range: [126; 126), 10 source_range: [126; 126),
11 text_edit: TextEdit {
12 atoms: [
13 AtomTextEdit {
14 delete: [126; 126),
15 insert: "foo()$0"
16 }
17 ]
18 },
11 kind: Method, 19 kind: Method,
12 detail: "fn foo(&self)", 20 detail: "fn foo(&self)"
13 insert_text: "foo()$0",
14 insert_text_format: Snippet
15 }, 21 },
16 CompletionItem { 22 CompletionItem {
17 label: "the_field", 23 label: "the_field",
18 source_range: [126; 126), 24 source_range: [126; 126),
25 text_edit: TextEdit {
26 atoms: [
27 AtomTextEdit {
28 delete: [126; 126),
29 insert: "the_field"
30 }
31 ]
32 },
19 kind: Field, 33 kind: Field,
20 detail: "(u32, i32)" 34 detail: "(u32, i32)"
21 } 35 }
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..f20e4dcab 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:10:51.944941588Z"
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,28 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "foo", 9 label: "foo",
10 source_range: [187; 187), 10 source_range: [187; 187),
11 text_edit: TextEdit {
12 atoms: [
13 AtomTextEdit {
14 delete: [187; 187),
15 insert: "foo()$0"
16 }
17 ]
18 },
11 kind: Method, 19 kind: Method,
12 detail: "fn foo(self)", 20 detail: "fn foo(self)"
13 insert_text: "foo()$0",
14 insert_text_format: Snippet
15 }, 21 },
16 CompletionItem { 22 CompletionItem {
17 label: "the_field", 23 label: "the_field",
18 source_range: [187; 187), 24 source_range: [187; 187),
25 text_edit: TextEdit {
26 atoms: [
27 AtomTextEdit {
28 delete: [187; 187),
29 insert: "the_field"
30 }
31 ]
32 },
19 kind: Field, 33 kind: Field,
20 detail: "(u32,)", 34 detail: "(u32,)",
21 documentation: Documentation( 35 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..b1ebac40b 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:10:51.944941196Z"
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,28 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "0", 9 label: "0",
10 source_range: [75; 75), 10 source_range: [75; 75),
11 text_edit: TextEdit {
12 atoms: [
13 AtomTextEdit {
14 delete: [75; 75),
15 insert: "0"
16 }
17 ]
18 },
11 kind: Field, 19 kind: Field,
12 detail: "i32" 20 detail: "i32"
13 }, 21 },
14 CompletionItem { 22 CompletionItem {
15 label: "1", 23 label: "1",
16 source_range: [75; 75), 24 source_range: [75; 75),
25 text_edit: TextEdit {
26 atoms: [
27 AtomTextEdit {
28 delete: [75; 75),
29 insert: "1"
30 }
31 ]
32 },
17 kind: Field, 33 kind: Field,
18 detail: "f64" 34 detail: "f64"
19 } 35 }
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..30a67db61 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:10:52.063155992Z"
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,27 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "Spam", 9 label: "Spam",
10 source_range: [11; 13), 10 source_range: [11; 13),
11 text_edit: TextEdit {
12 atoms: [
13 AtomTextEdit {
14 delete: [11; 13),
15 insert: "Spam"
16 }
17 ]
18 },
11 kind: Struct 19 kind: Struct
12 }, 20 },
13 CompletionItem { 21 CompletionItem {
14 label: "foo", 22 label: "foo",
15 source_range: [11; 13), 23 source_range: [11; 13),
24 text_edit: TextEdit {
25 atoms: [
26 AtomTextEdit {
27 delete: [11; 13),
28 insert: "foo"
29 }
30 ]
31 },
16 kind: Module 32 kind: Module
17 } 33 }
18] 34]
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..a8257ef12 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:10:52.075119580Z"
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,14 @@ expression: kind_completions
8 CompletionItem { 8 CompletionItem {
9 label: "Bar", 9 label: "Bar",
10 source_range: [26; 26), 10 source_range: [26; 26),
11 text_edit: TextEdit {
12 atoms: [
13 AtomTextEdit {
14 delete: [26; 26),
15 insert: "Bar"
16 }
17 ]
18 },
11 kind: Struct 19 kind: Struct
12 } 20 }
13] 21]
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 };