aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-01-23 07:45:08 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-01-23 07:45:08 +0000
commit1d7baef0e96d6c1db2d049f3770588f07b8d739f (patch)
treeebfe1de5f52c088f20ffd3d1c591514e844307e0
parent488326ffa74bea2773eed9c1849e9d3b9eac9b2d (diff)
parent13d2fd32ab5df598496c6abbf46591ff05cd3def (diff)
Merge #603
603: fix completion bugs r=gfreezy a=gfreezy The result is as below. before: ![image](https://user-images.githubusercontent.com/510012/51483467-0f641400-1dd4-11e9-9921-ef21d15cc343.png) after: ![image](https://user-images.githubusercontent.com/510012/51483433-fb201700-1dd3-11e9-9730-c2a5d3dd5f5a.png) Co-authored-by: gfreezy <[email protected]>
-rw-r--r--crates/ra_hir/src/code_model_impl/module.rs4
-rw-r--r--crates/ra_hir/src/nameres.rs9
-rw-r--r--crates/ra_hir/src/path.rs7
-rw-r--r--crates/ra_ide_api/src/completion/complete_snippet.rs13
-rw-r--r--crates/ra_ide_api/src/completion/completion_context.rs8
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_for.snap8
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_if_let.snap10
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_let.snap10
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__completes_break_and_continue_in_loops1.snap18
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__completes_break_and_continue_in_loops2.snap14
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__dont_add_semi_after_return_if_not_a_statement.snap14
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__dont_show_both_completions_for_shadowing.snap8
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion3.snap20
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function1.snap14
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function2.snap18
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function3.snap14
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_function4.snap14
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_use_stmt1.snap10
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__keywords_in_use_stmt3.snap8
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__last_return_in_block_has_semi1.snap14
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__last_return_in_block_has_semi2.snap14
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__module_items.snap10
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__module_items_in_nested_modules.snap8
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__return_type.snap8
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__self_in_methods.snap6
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__should_not_complete_snippets_in_path.snap5
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__should_not_complete_snippets_in_path2.snap5
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__snippets_in_expressions.snap8
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__snippets_in_items.snap8
-rw-r--r--crates/ra_syntax/src/ast.rs7
30 files changed, 179 insertions, 135 deletions
diff --git a/crates/ra_hir/src/code_model_impl/module.rs b/crates/ra_hir/src/code_model_impl/module.rs
index 73c212de8..d94079f11 100644
--- a/crates/ra_hir/src/code_model_impl/module.rs
+++ b/crates/ra_hir/src/code_model_impl/module.rs
@@ -143,6 +143,10 @@ impl Module {
143 return PerNs::none(); 143 return PerNs::none();
144 } 144 }
145 } 145 }
146 PathKind::Abs => {
147 // TODO: absolute use is not supported
148 return PerNs::none();
149 }
146 } 150 }
147 .def_id, 151 .def_id,
148 ); 152 );
diff --git a/crates/ra_hir/src/nameres.rs b/crates/ra_hir/src/nameres.rs
index 4874e82f3..72791ed49 100644
--- a/crates/ra_hir/src/nameres.rs
+++ b/crates/ra_hir/src/nameres.rs
@@ -15,7 +15,8 @@
15//! so that the results of name resolution can be preserved unless the module 15//! so that the results of name resolution can be preserved unless the module
16//! structure itself is modified. 16//! structure itself is modified.
17pub(crate) mod lower; 17pub(crate) mod lower;
18use lower::*; 18
19use crate::nameres::lower::*;
19 20
20use std::sync::Arc; 21use std::sync::Arc;
21 22
@@ -59,7 +60,7 @@ impl ModuleScope {
59pub struct Resolution { 60pub struct Resolution {
60 /// None for unresolved 61 /// None for unresolved
61 pub def_id: PerNs<DefId>, 62 pub def_id: PerNs<DefId>,
62 /// ident by whitch this is imported into local scope. 63 /// ident by which this is imported into local scope.
63 pub import: Option<ImportId>, 64 pub import: Option<ImportId>,
64} 65}
65 66
@@ -317,6 +318,10 @@ where
317 } 318 }
318 } 319 }
319 PathKind::Crate => module_id.crate_root(&self.module_tree), 320 PathKind::Crate => module_id.crate_root(&self.module_tree),
321 PathKind::Abs => {
322 // TODO: absolute use is not supported for now
323 return false;
324 }
320 }; 325 };
321 326
322 for (i, segment) in import.path.segments.iter().enumerate() { 327 for (i, segment) in import.path.segments.iter().enumerate() {
diff --git a/crates/ra_hir/src/path.rs b/crates/ra_hir/src/path.rs
index c3d14c689..e13d84c57 100644
--- a/crates/ra_hir/src/path.rs
+++ b/crates/ra_hir/src/path.rs
@@ -38,6 +38,8 @@ pub enum PathKind {
38 Self_, 38 Self_,
39 Super, 39 Super,
40 Crate, 40 Crate,
41 // Absolute path
42 Abs,
41} 43}
42 44
43impl Path { 45impl Path {
@@ -57,6 +59,11 @@ impl Path {
57 let mut segments = Vec::new(); 59 let mut segments = Vec::new();
58 loop { 60 loop {
59 let segment = path.segment()?; 61 let segment = path.segment()?;
62
63 if segment.has_colon_colon() {
64 kind = PathKind::Abs;
65 }
66
60 match segment.kind()? { 67 match segment.kind()? {
61 ast::PathSegmentKind::Name(name) => { 68 ast::PathSegmentKind::Name(name) => {
62 let args = segment 69 let args = segment
diff --git a/crates/ra_ide_api/src/completion/complete_snippet.rs b/crates/ra_ide_api/src/completion/complete_snippet.rs
index d3344b865..d1cea7375 100644
--- a/crates/ra_ide_api/src/completion/complete_snippet.rs
+++ b/crates/ra_ide_api/src/completion/complete_snippet.rs
@@ -10,6 +10,7 @@ pub(super) fn complete_expr_snippet(acc: &mut Completions, ctx: &CompletionConte
10 if !(ctx.is_trivial_path && ctx.function_syntax.is_some()) { 10 if !(ctx.is_trivial_path && ctx.function_syntax.is_some()) {
11 return; 11 return;
12 } 12 }
13
13 snippet(ctx, "pd", "eprintln!(\"$0 = {:?}\", $0);").add_to(acc); 14 snippet(ctx, "pd", "eprintln!(\"$0 = {:?}\", $0);").add_to(acc);
14 snippet(ctx, "ppd", "eprintln!(\"$0 = {:#?}\", $0);").add_to(acc); 15 snippet(ctx, "ppd", "eprintln!(\"$0 = {:#?}\", $0);").add_to(acc);
15} 16}
@@ -48,6 +49,18 @@ mod tests {
48 } 49 }
49 50
50 #[test] 51 #[test]
52 fn should_not_complete_snippets_in_path() {
53 check_snippet_completion(
54 "should_not_complete_snippets_in_path",
55 r"fn foo(x: i32) { ::foo<|> }",
56 );
57 check_snippet_completion(
58 "should_not_complete_snippets_in_path2",
59 r"fn foo(x: i32) { ::<|> }",
60 );
61 }
62
63 #[test]
51 fn completes_snippets_in_items() { 64 fn completes_snippets_in_items() {
52 check_snippet_completion( 65 check_snippet_completion(
53 "snippets_in_items", 66 "snippets_in_items",
diff --git a/crates/ra_ide_api/src/completion/completion_context.rs b/crates/ra_ide_api/src/completion/completion_context.rs
index b09c66c18..ca2069e2a 100644
--- a/crates/ra_ide_api/src/completion/completion_context.rs
+++ b/crates/ra_ide_api/src/completion/completion_context.rs
@@ -21,7 +21,7 @@ pub(crate) struct CompletionContext<'a> {
21 pub(super) function_syntax: Option<&'a ast::FnDef>, 21 pub(super) function_syntax: Option<&'a ast::FnDef>,
22 pub(super) use_item_syntax: Option<&'a ast::UseItem>, 22 pub(super) use_item_syntax: Option<&'a ast::UseItem>,
23 pub(super) is_param: bool, 23 pub(super) is_param: bool,
24 /// A single-indent path, like `foo`. 24 /// A single-indent path, like `foo`. `::foo` should not be considered a trivial path.
25 pub(super) is_trivial_path: bool, 25 pub(super) is_trivial_path: bool,
26 /// If not a trivial, path, the prefix (qualifier). 26 /// If not a trivial, path, the prefix (qualifier).
27 pub(super) path_prefix: Option<hir::Path>, 27 pub(super) path_prefix: Option<hir::Path>,
@@ -66,13 +66,11 @@ impl<'a> CompletionContext<'a> {
66 } 66 }
67 67
68 // The range of the identifier that is being completed. 68 // The range of the identifier that is being completed.
69 // This is purely advisory and can be used, for example, to highlight this range in the editor.
70 // Clients are expected to ignore this field.
71 pub(crate) fn source_range(&self) -> TextRange { 69 pub(crate) fn source_range(&self) -> TextRange {
72 match self.leaf.kind() { 70 match self.leaf.kind() {
73 // workaroud when completion is triggered by trigger characters. 71 // workaroud when completion is triggered by trigger characters.
74 DOT | COLONCOLON => TextRange::from_to(self.offset, self.offset), 72 IDENT => self.leaf.range(),
75 _ => self.leaf.range(), 73 _ => TextRange::offset_len(self.offset, 0.into()),
76 } 74 }
77 } 75 }
78 76
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 eb806ad62..329309c90 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,8 +1,8 @@
1--- 1---
2created: "2019-01-22T15:38:19.841148300+00:00" 2created: "2019-01-23T07:42:59.656273+00:00"
3creator: [email protected] 3creator: [email protected]
4expression: kind_completions 4expression: kind_completions
5source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs" 5source: crates/ra_ide_api/src/completion/completion_item.rs
6--- 6---
7[ 7[
8 CompletionItem { 8 CompletionItem {
@@ -16,7 +16,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
16 lookup: None, 16 lookup: None,
17 insert_text: None, 17 insert_text: None,
18 insert_text_format: PlainText, 18 insert_text_format: PlainText,
19 source_range: [62; 100), 19 source_range: [83; 83),
20 text_edit: None 20 text_edit: None
21 }, 21 },
22 CompletionItem { 22 CompletionItem {
@@ -34,7 +34,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
34 "quux()$0" 34 "quux()$0"
35 ), 35 ),
36 insert_text_format: Snippet, 36 insert_text_format: Snippet,
37 source_range: [62; 100), 37 source_range: [83; 83),
38 text_edit: None 38 text_edit: None
39 } 39 }
40] 40]
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 4bb28c7e8..dbbe06c7b 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,8 +1,8 @@
1--- 1---
2created: "2019-01-22T15:38:19.863089100+00:00" 2created: "2019-01-23T07:42:59.658419+00:00"
3creator: [email protected] 3creator: [email protected]
4expression: kind_completions 4expression: kind_completions
5source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs" 5source: crates/ra_ide_api/src/completion/completion_item.rs
6--- 6---
7[ 7[
8 CompletionItem { 8 CompletionItem {
@@ -16,7 +16,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
16 lookup: None, 16 lookup: None,
17 insert_text: None, 17 insert_text: None,
18 insert_text_format: PlainText, 18 insert_text_format: PlainText,
19 source_range: [213; 231), 19 source_range: [214; 214),
20 text_edit: None 20 text_edit: None
21 }, 21 },
22 CompletionItem { 22 CompletionItem {
@@ -30,7 +30,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
30 lookup: None, 30 lookup: None,
31 insert_text: None, 31 insert_text: None,
32 insert_text_format: PlainText, 32 insert_text_format: PlainText,
33 source_range: [213; 231), 33 source_range: [214; 214),
34 text_edit: None 34 text_edit: None
35 }, 35 },
36 CompletionItem { 36 CompletionItem {
@@ -48,7 +48,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
48 "quux()$0" 48 "quux()$0"
49 ), 49 ),
50 insert_text_format: Snippet, 50 insert_text_format: Snippet,
51 source_range: [213; 231), 51 source_range: [214; 214),
52 text_edit: None 52 text_edit: None
53 } 53 }
54] 54]
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 0579d00ec..b727bb70c 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,8 +1,8 @@
1--- 1---
2created: "2019-01-22T15:38:19.881041600+00:00" 2created: "2019-01-23T07:42:59.657713+00:00"
3creator: [email protected] 3creator: [email protected]
4expression: kind_completions 4expression: kind_completions
5source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs" 5source: crates/ra_ide_api/src/completion/completion_item.rs
6--- 6---
7[ 7[
8 CompletionItem { 8 CompletionItem {
@@ -16,7 +16,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
16 lookup: None, 16 lookup: None,
17 insert_text: None, 17 insert_text: None,
18 insert_text_format: PlainText, 18 insert_text_format: PlainText,
19 source_range: [78; 79), 19 source_range: [79; 79),
20 text_edit: None 20 text_edit: None
21 }, 21 },
22 CompletionItem { 22 CompletionItem {
@@ -30,7 +30,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
30 lookup: None, 30 lookup: None,
31 insert_text: None, 31 insert_text: None,
32 insert_text_format: PlainText, 32 insert_text_format: PlainText,
33 source_range: [78; 79), 33 source_range: [79; 79),
34 text_edit: None 34 text_edit: None
35 }, 35 },
36 CompletionItem { 36 CompletionItem {
@@ -48,7 +48,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
48 "quux($0)" 48 "quux($0)"
49 ), 49 ),
50 insert_text_format: Snippet, 50 insert_text_format: Snippet,
51 source_range: [78; 79), 51 source_range: [79; 79),
52 text_edit: None 52 text_edit: None
53 } 53 }
54] 54]
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 2e763fe1d..8dcb773d0 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,8 +1,8 @@
1--- 1---
2created: "2019-01-22T14:45:00.620177400+00:00" 2created: "2019-01-23T05:27:32.197434+00:00"
3creator: [email protected] 3creator: [email protected]
4expression: kind_completions 4expression: kind_completions
5source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs" 5source: crates/ra_ide_api/src/completion/completion_item.rs
6--- 6---
7[ 7[
8 CompletionItem { 8 CompletionItem {
@@ -18,7 +18,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
18 "if $0 {}" 18 "if $0 {}"
19 ), 19 ),
20 insert_text_format: Snippet, 20 insert_text_format: Snippet,
21 source_range: [54; 56), 21 source_range: [55; 55),
22 text_edit: None 22 text_edit: None
23 }, 23 },
24 CompletionItem { 24 CompletionItem {
@@ -34,7 +34,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
34 "match $0 {}" 34 "match $0 {}"
35 ), 35 ),
36 insert_text_format: Snippet, 36 insert_text_format: Snippet,
37 source_range: [54; 56), 37 source_range: [55; 55),
38 text_edit: None 38 text_edit: None
39 }, 39 },
40 CompletionItem { 40 CompletionItem {
@@ -50,7 +50,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
50 "while $0 {}" 50 "while $0 {}"
51 ), 51 ),
52 insert_text_format: Snippet, 52 insert_text_format: Snippet,
53 source_range: [54; 56), 53 source_range: [55; 55),
54 text_edit: None 54 text_edit: None
55 }, 55 },
56 CompletionItem { 56 CompletionItem {
@@ -66,7 +66,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
66 "loop {$0}" 66 "loop {$0}"
67 ), 67 ),
68 insert_text_format: Snippet, 68 insert_text_format: Snippet,
69 source_range: [54; 56), 69 source_range: [55; 55),
70 text_edit: None 70 text_edit: None
71 }, 71 },
72 CompletionItem { 72 CompletionItem {
@@ -82,7 +82,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
82 "continue;" 82 "continue;"
83 ), 83 ),
84 insert_text_format: Snippet, 84 insert_text_format: Snippet,
85 source_range: [54; 56), 85 source_range: [55; 55),
86 text_edit: None 86 text_edit: None
87 }, 87 },
88 CompletionItem { 88 CompletionItem {
@@ -98,7 +98,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
98 "break;" 98 "break;"
99 ), 99 ),
100 insert_text_format: Snippet, 100 insert_text_format: Snippet,
101 source_range: [54; 56), 101 source_range: [55; 55),
102 text_edit: None 102 text_edit: None
103 }, 103 },
104 CompletionItem { 104 CompletionItem {
@@ -114,7 +114,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
114 "return $0;" 114 "return $0;"
115 ), 115 ),
116 insert_text_format: Snippet, 116 insert_text_format: Snippet,
117 source_range: [54; 56), 117 source_range: [55; 55),
118 text_edit: None 118 text_edit: None
119 } 119 }
120] 120]
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 9dcdbf63f..1c64c6548 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,8 +1,8 @@
1--- 1---
2created: "2019-01-22T14:45:00.699965300+00:00" 2created: "2019-01-23T05:27:32.314513+00:00"
3creator: [email protected] 3creator: [email protected]
4expression: kind_completions 4expression: kind_completions
5source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs" 5source: crates/ra_ide_api/src/completion/completion_item.rs
6--- 6---
7[ 7[
8 CompletionItem { 8 CompletionItem {
@@ -18,7 +18,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
18 "if $0 {}" 18 "if $0 {}"
19 ), 19 ),
20 insert_text_format: Snippet, 20 insert_text_format: Snippet,
21 source_range: [59; 61), 21 source_range: [60; 60),
22 text_edit: None 22 text_edit: None
23 }, 23 },
24 CompletionItem { 24 CompletionItem {
@@ -34,7 +34,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
34 "match $0 {}" 34 "match $0 {}"
35 ), 35 ),
36 insert_text_format: Snippet, 36 insert_text_format: Snippet,
37 source_range: [59; 61), 37 source_range: [60; 60),
38 text_edit: None 38 text_edit: None
39 }, 39 },
40 CompletionItem { 40 CompletionItem {
@@ -50,7 +50,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
50 "while $0 {}" 50 "while $0 {}"
51 ), 51 ),
52 insert_text_format: Snippet, 52 insert_text_format: Snippet,
53 source_range: [59; 61), 53 source_range: [60; 60),
54 text_edit: None 54 text_edit: None
55 }, 55 },
56 CompletionItem { 56 CompletionItem {
@@ -66,7 +66,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
66 "loop {$0}" 66 "loop {$0}"
67 ), 67 ),
68 insert_text_format: Snippet, 68 insert_text_format: Snippet,
69 source_range: [59; 61), 69 source_range: [60; 60),
70 text_edit: None 70 text_edit: None
71 }, 71 },
72 CompletionItem { 72 CompletionItem {
@@ -82,7 +82,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
82 "return $0;" 82 "return $0;"
83 ), 83 ),
84 insert_text_format: Snippet, 84 insert_text_format: Snippet,
85 source_range: [59; 61), 85 source_range: [60; 60),
86 text_edit: None 86 text_edit: None
87 } 87 }
88] 88]
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 e3f00d0f1..8c9657b5c 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,8 +1,8 @@
1--- 1---
2created: "2019-01-22T14:45:00.642118600+00:00" 2created: "2019-01-23T05:27:32.197678+00:00"
3creator: [email protected] 3creator: [email protected]
4expression: kind_completions 4expression: kind_completions
5source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs" 5source: crates/ra_ide_api/src/completion/completion_item.rs
6--- 6---
7[ 7[
8 CompletionItem { 8 CompletionItem {
@@ -18,7 +18,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
18 "if $0 {}" 18 "if $0 {}"
19 ), 19 ),
20 insert_text_format: Snippet, 20 insert_text_format: Snippet,
21 source_range: [84; 102), 21 source_range: [85; 85),
22 text_edit: None 22 text_edit: None
23 }, 23 },
24 CompletionItem { 24 CompletionItem {
@@ -34,7 +34,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
34 "match $0 {}" 34 "match $0 {}"
35 ), 35 ),
36 insert_text_format: Snippet, 36 insert_text_format: Snippet,
37 source_range: [84; 102), 37 source_range: [85; 85),
38 text_edit: None 38 text_edit: None
39 }, 39 },
40 CompletionItem { 40 CompletionItem {
@@ -50,7 +50,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
50 "while $0 {}" 50 "while $0 {}"
51 ), 51 ),
52 insert_text_format: Snippet, 52 insert_text_format: Snippet,
53 source_range: [84; 102), 53 source_range: [85; 85),
54 text_edit: None 54 text_edit: None
55 }, 55 },
56 CompletionItem { 56 CompletionItem {
@@ -66,7 +66,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
66 "loop {$0}" 66 "loop {$0}"
67 ), 67 ),
68 insert_text_format: Snippet, 68 insert_text_format: Snippet,
69 source_range: [84; 102), 69 source_range: [85; 85),
70 text_edit: None 70 text_edit: None
71 }, 71 },
72 CompletionItem { 72 CompletionItem {
@@ -82,7 +82,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
82 "return $0" 82 "return $0"
83 ), 83 ),
84 insert_text_format: Snippet, 84 insert_text_format: Snippet,
85 source_range: [84; 102), 85 source_range: [85; 85),
86 text_edit: None 86 text_edit: None
87 } 87 }
88] 88]
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 3e88d8c8e..8f8a3a56c 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,8 +1,8 @@
1--- 1---
2created: "2019-01-22T15:38:19.914951100+00:00" 2created: "2019-01-23T07:42:59.658375+00:00"
3creator: [email protected] 3creator: [email protected]
4expression: kind_completions 4expression: kind_completions
5source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs" 5source: crates/ra_ide_api/src/completion/completion_item.rs
6--- 6---
7[ 7[
8 CompletionItem { 8 CompletionItem {
@@ -16,7 +16,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
16 lookup: None, 16 lookup: None,
17 insert_text: None, 17 insert_text: None,
18 insert_text_format: PlainText, 18 insert_text_format: PlainText,
19 source_range: [108; 146), 19 source_range: [129; 129),
20 text_edit: None 20 text_edit: None
21 }, 21 },
22 CompletionItem { 22 CompletionItem {
@@ -34,7 +34,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
34 "foo()$0" 34 "foo()$0"
35 ), 35 ),
36 insert_text_format: Snippet, 36 insert_text_format: Snippet,
37 source_range: [108; 146), 37 source_range: [129; 129),
38 text_edit: None 38 text_edit: None
39 } 39 }
40] 40]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion3.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion3.snap
index e8191596d..e0f4730e7 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion3.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion3.snap
@@ -1,8 +1,8 @@
1--- 1---
2created: "2019-01-22T14:45:00.830614900+00:00" 2created: "2019-01-23T05:27:32.222118+00:00"
3creator: [email protected] 3creator: [email protected]
4expression: kind_completions 4expression: kind_completions
5source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs" 5source: crates/ra_ide_api/src/completion/completion_item.rs
6--- 6---
7[ 7[
8 CompletionItem { 8 CompletionItem {
@@ -16,12 +16,12 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
16 "!bar" 16 "!bar"
17 ), 17 ),
18 insert_text_format: Snippet, 18 insert_text_format: Snippet,
19 source_range: [76; 78), 19 source_range: [78; 78),
20 text_edit: Some( 20 text_edit: Some(
21 TextEdit { 21 TextEdit {
22 atoms: [ 22 atoms: [
23 AtomTextEdit { 23 AtomTextEdit {
24 delete: [72; 76), 24 delete: [72; 78),
25 insert: "" 25 insert: ""
26 } 26 }
27 ] 27 ]
@@ -39,12 +39,12 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
39 "if bar {$0}" 39 "if bar {$0}"
40 ), 40 ),
41 insert_text_format: Snippet, 41 insert_text_format: Snippet,
42 source_range: [76; 78), 42 source_range: [78; 78),
43 text_edit: Some( 43 text_edit: Some(
44 TextEdit { 44 TextEdit {
45 atoms: [ 45 atoms: [
46 AtomTextEdit { 46 AtomTextEdit {
47 delete: [72; 76), 47 delete: [72; 78),
48 insert: "" 48 insert: ""
49 } 49 }
50 ] 50 ]
@@ -62,12 +62,12 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
62 "match bar {\n${1:_} => {$0\\},\n}" 62 "match bar {\n${1:_} => {$0\\},\n}"
63 ), 63 ),
64 insert_text_format: Snippet, 64 insert_text_format: Snippet,
65 source_range: [76; 78), 65 source_range: [78; 78),
66 text_edit: Some( 66 text_edit: Some(
67 TextEdit { 67 TextEdit {
68 atoms: [ 68 atoms: [
69 AtomTextEdit { 69 AtomTextEdit {
70 delete: [72; 76), 70 delete: [72; 78),
71 insert: "" 71 insert: ""
72 } 72 }
73 ] 73 ]
@@ -85,12 +85,12 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
85 "while bar {\n$0\n}" 85 "while bar {\n$0\n}"
86 ), 86 ),
87 insert_text_format: Snippet, 87 insert_text_format: Snippet,
88 source_range: [76; 78), 88 source_range: [78; 78),
89 text_edit: Some( 89 text_edit: Some(
90 TextEdit { 90 TextEdit {
91 atoms: [ 91 atoms: [
92 AtomTextEdit { 92 AtomTextEdit {
93 delete: [72; 76), 93 delete: [72; 78),
94 insert: "" 94 insert: ""
95 } 95 }
96 ] 96 ]
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 f1de82bcc..2b6182578 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,8 +1,8 @@
1--- 1---
2created: "2019-01-22T14:45:00.635137200+00:00" 2created: "2019-01-23T05:27:32.197298+00:00"
3creator: [email protected] 3creator: [email protected]
4expression: kind_completions 4expression: kind_completions
5source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs" 5source: crates/ra_ide_api/src/completion/completion_item.rs
6--- 6---
7[ 7[
8 CompletionItem { 8 CompletionItem {
@@ -18,7 +18,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
18 "if $0 {}" 18 "if $0 {}"
19 ), 19 ),
20 insert_text_format: Snippet, 20 insert_text_format: Snippet,
21 source_range: [24; 54), 21 source_range: [41; 41),
22 text_edit: None 22 text_edit: None
23 }, 23 },
24 CompletionItem { 24 CompletionItem {
@@ -34,7 +34,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
34 "match $0 {}" 34 "match $0 {}"
35 ), 35 ),
36 insert_text_format: Snippet, 36 insert_text_format: Snippet,
37 source_range: [24; 54), 37 source_range: [41; 41),
38 text_edit: None 38 text_edit: None
39 }, 39 },
40 CompletionItem { 40 CompletionItem {
@@ -50,7 +50,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
50 "while $0 {}" 50 "while $0 {}"
51 ), 51 ),
52 insert_text_format: Snippet, 52 insert_text_format: Snippet,
53 source_range: [24; 54), 53 source_range: [41; 41),
54 text_edit: None 54 text_edit: None
55 }, 55 },
56 CompletionItem { 56 CompletionItem {
@@ -66,7 +66,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
66 "loop {$0}" 66 "loop {$0}"
67 ), 67 ),
68 insert_text_format: Snippet, 68 insert_text_format: Snippet,
69 source_range: [24; 54), 69 source_range: [41; 41),
70 text_edit: None 70 text_edit: None
71 }, 71 },
72 CompletionItem { 72 CompletionItem {
@@ -82,7 +82,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
82 "return;" 82 "return;"
83 ), 83 ),
84 insert_text_format: Snippet, 84 insert_text_format: Snippet,
85 source_range: [24; 54), 85 source_range: [41; 41),
86 text_edit: None 86 text_edit: None
87 } 87 }
88] 88]
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 c309ff9bc..a56105f0c 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,8 +1,8 @@
1--- 1---
2created: "2019-01-22T14:45:00.626162800+00:00" 2created: "2019-01-23T05:27:32.197423+00:00"
3creator: [email protected] 3creator: [email protected]
4expression: kind_completions 4expression: kind_completions
5source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs" 5source: crates/ra_ide_api/src/completion/completion_item.rs
6--- 6---
7[ 7[
8 CompletionItem { 8 CompletionItem {
@@ -18,7 +18,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
18 "if $0 {}" 18 "if $0 {}"
19 ), 19 ),
20 insert_text_format: Snippet, 20 insert_text_format: Snippet,
21 source_range: [91; 105), 21 source_range: [92; 92),
22 text_edit: None 22 text_edit: None
23 }, 23 },
24 CompletionItem { 24 CompletionItem {
@@ -34,7 +34,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
34 "match $0 {}" 34 "match $0 {}"
35 ), 35 ),
36 insert_text_format: Snippet, 36 insert_text_format: Snippet,
37 source_range: [91; 105), 37 source_range: [92; 92),
38 text_edit: None 38 text_edit: None
39 }, 39 },
40 CompletionItem { 40 CompletionItem {
@@ -50,7 +50,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
50 "while $0 {}" 50 "while $0 {}"
51 ), 51 ),
52 insert_text_format: Snippet, 52 insert_text_format: Snippet,
53 source_range: [91; 105), 53 source_range: [92; 92),
54 text_edit: None 54 text_edit: None
55 }, 55 },
56 CompletionItem { 56 CompletionItem {
@@ -66,7 +66,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
66 "loop {$0}" 66 "loop {$0}"
67 ), 67 ),
68 insert_text_format: Snippet, 68 insert_text_format: Snippet,
69 source_range: [91; 105), 69 source_range: [92; 92),
70 text_edit: None 70 text_edit: None
71 }, 71 },
72 CompletionItem { 72 CompletionItem {
@@ -82,7 +82,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
82 "else {$0}" 82 "else {$0}"
83 ), 83 ),
84 insert_text_format: Snippet, 84 insert_text_format: Snippet,
85 source_range: [91; 105), 85 source_range: [92; 92),
86 text_edit: None 86 text_edit: None
87 }, 87 },
88 CompletionItem { 88 CompletionItem {
@@ -98,7 +98,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
98 "else if $0 {}" 98 "else if $0 {}"
99 ), 99 ),
100 insert_text_format: Snippet, 100 insert_text_format: Snippet,
101 source_range: [91; 105), 101 source_range: [92; 92),
102 text_edit: None 102 text_edit: None
103 }, 103 },
104 CompletionItem { 104 CompletionItem {
@@ -114,7 +114,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
114 "return;" 114 "return;"
115 ), 115 ),
116 insert_text_format: Snippet, 116 insert_text_format: Snippet,
117 source_range: [91; 105), 117 source_range: [92; 92),
118 text_edit: None 118 text_edit: None
119 } 119 }
120] 120]
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 950cc8045..84efab6f6 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,8 +1,8 @@
1--- 1---
2created: "2019-01-22T14:45:00.701959300+00:00" 2created: "2019-01-23T05:27:32.200056+00:00"
3creator: [email protected] 3creator: [email protected]
4expression: kind_completions 4expression: kind_completions
5source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs" 5source: crates/ra_ide_api/src/completion/completion_item.rs
6--- 6---
7[ 7[
8 CompletionItem { 8 CompletionItem {
@@ -18,7 +18,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
18 "if $0 {}" 18 "if $0 {}"
19 ), 19 ),
20 insert_text_format: Snippet, 20 insert_text_format: Snippet,
21 source_range: [31; 65), 21 source_range: [48; 48),
22 text_edit: None 22 text_edit: None
23 }, 23 },
24 CompletionItem { 24 CompletionItem {
@@ -34,7 +34,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
34 "match $0 {}" 34 "match $0 {}"
35 ), 35 ),
36 insert_text_format: Snippet, 36 insert_text_format: Snippet,
37 source_range: [31; 65), 37 source_range: [48; 48),
38 text_edit: None 38 text_edit: None
39 }, 39 },
40 CompletionItem { 40 CompletionItem {
@@ -50,7 +50,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
50 "while $0 {}" 50 "while $0 {}"
51 ), 51 ),
52 insert_text_format: Snippet, 52 insert_text_format: Snippet,
53 source_range: [31; 65), 53 source_range: [48; 48),
54 text_edit: None 54 text_edit: None
55 }, 55 },
56 CompletionItem { 56 CompletionItem {
@@ -66,7 +66,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
66 "loop {$0}" 66 "loop {$0}"
67 ), 67 ),
68 insert_text_format: Snippet, 68 insert_text_format: Snippet,
69 source_range: [31; 65), 69 source_range: [48; 48),
70 text_edit: None 70 text_edit: None
71 }, 71 },
72 CompletionItem { 72 CompletionItem {
@@ -82,7 +82,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
82 "return $0;" 82 "return $0;"
83 ), 83 ),
84 insert_text_format: Snippet, 84 insert_text_format: Snippet,
85 source_range: [31; 65), 85 source_range: [48; 48),
86 text_edit: None 86 text_edit: None
87 } 87 }
88] 88]
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 ae14d7e39..8b254ce99 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,8 +1,8 @@
1--- 1---
2created: "2019-01-22T14:45:00.788727100+00:00" 2created: "2019-01-23T05:27:32.314468+00:00"
3creator: [email protected] 3creator: [email protected]
4expression: kind_completions 4expression: kind_completions
5source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs" 5source: crates/ra_ide_api/src/completion/completion_item.rs
6--- 6---
7[ 7[
8 CompletionItem { 8 CompletionItem {
@@ -18,7 +18,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
18 "if $0 {}" 18 "if $0 {}"
19 ), 19 ),
20 insert_text_format: Snippet, 20 insert_text_format: Snippet,
21 source_range: [24; 58), 21 source_range: [41; 41),
22 text_edit: None 22 text_edit: None
23 }, 23 },
24 CompletionItem { 24 CompletionItem {
@@ -34,7 +34,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
34 "match $0 {}" 34 "match $0 {}"
35 ), 35 ),
36 insert_text_format: Snippet, 36 insert_text_format: Snippet,
37 source_range: [24; 58), 37 source_range: [41; 41),
38 text_edit: None 38 text_edit: None
39 }, 39 },
40 CompletionItem { 40 CompletionItem {
@@ -50,7 +50,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
50 "while $0 {}" 50 "while $0 {}"
51 ), 51 ),
52 insert_text_format: Snippet, 52 insert_text_format: Snippet,
53 source_range: [24; 58), 53 source_range: [41; 41),
54 text_edit: None 54 text_edit: None
55 }, 55 },
56 CompletionItem { 56 CompletionItem {
@@ -66,7 +66,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
66 "loop {$0}" 66 "loop {$0}"
67 ), 67 ),
68 insert_text_format: Snippet, 68 insert_text_format: Snippet,
69 source_range: [24; 58), 69 source_range: [41; 41),
70 text_edit: None 70 text_edit: None
71 }, 71 },
72 CompletionItem { 72 CompletionItem {
@@ -82,7 +82,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
82 "return;" 82 "return;"
83 ), 83 ),
84 insert_text_format: Snippet, 84 insert_text_format: Snippet,
85 source_range: [24; 58), 85 source_range: [41; 41),
86 text_edit: None 86 text_edit: None
87 } 87 }
88] 88]
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 2ec855bf6..9dd5b2254 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,8 +1,8 @@
1--- 1---
2created: "2019-01-22T14:45:00.626162800+00:00" 2created: "2019-01-23T05:27:32.196887+00:00"
3creator: [email protected] 3creator: [email protected]
4expression: kind_completions 4expression: kind_completions
5source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs" 5source: crates/ra_ide_api/src/completion/completion_item.rs
6--- 6---
7[ 7[
8 CompletionItem { 8 CompletionItem {
@@ -18,7 +18,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
18 "crate::" 18 "crate::"
19 ), 19 ),
20 insert_text_format: PlainText, 20 insert_text_format: PlainText,
21 source_range: [16; 30), 21 source_range: [17; 17),
22 text_edit: None 22 text_edit: None
23 }, 23 },
24 CompletionItem { 24 CompletionItem {
@@ -32,7 +32,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
32 lookup: None, 32 lookup: None,
33 insert_text: None, 33 insert_text: None,
34 insert_text_format: PlainText, 34 insert_text_format: PlainText,
35 source_range: [16; 30), 35 source_range: [17; 17),
36 text_edit: None 36 text_edit: None
37 }, 37 },
38 CompletionItem { 38 CompletionItem {
@@ -48,7 +48,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
48 "super::" 48 "super::"
49 ), 49 ),
50 insert_text_format: PlainText, 50 insert_text_format: PlainText,
51 source_range: [16; 30), 51 source_range: [17; 17),
52 text_edit: None 52 text_edit: None
53 } 53 }
54] 54]
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 952650ea3..965a0fbed 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,8 +1,8 @@
1--- 1---
2created: "2019-01-22T14:45:00.779752+00:00" 2created: "2019-01-23T05:27:32.303390+00:00"
3creator: [email protected] 3creator: [email protected]
4expression: kind_completions 4expression: kind_completions
5source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs" 5source: crates/ra_ide_api/src/completion/completion_item.rs
6--- 6---
7[ 7[
8 CompletionItem { 8 CompletionItem {
@@ -16,7 +16,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
16 lookup: None, 16 lookup: None,
17 insert_text: None, 17 insert_text: None,
18 insert_text_format: PlainText, 18 insert_text_format: PlainText,
19 source_range: [23; 24), 19 source_range: [24; 24),
20 text_edit: None 20 text_edit: None
21 }, 21 },
22 CompletionItem { 22 CompletionItem {
@@ -32,7 +32,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
32 "super::" 32 "super::"
33 ), 33 ),
34 insert_text_format: PlainText, 34 insert_text_format: PlainText,
35 source_range: [23; 24), 35 source_range: [24; 24),
36 text_edit: None 36 text_edit: None
37 } 37 }
38] 38]
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 1d8725d34..d36b555db 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,8 +1,8 @@
1--- 1---
2created: "2019-01-22T14:45:00.642118600+00:00" 2created: "2019-01-23T05:27:32.197624+00:00"
3creator: [email protected] 3creator: [email protected]
4expression: kind_completions 4expression: kind_completions
5source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs" 5source: crates/ra_ide_api/src/completion/completion_item.rs
6--- 6---
7[ 7[
8 CompletionItem { 8 CompletionItem {
@@ -18,7 +18,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
18 "if $0 {}" 18 "if $0 {}"
19 ), 19 ),
20 insert_text_format: Snippet, 20 insert_text_format: Snippet,
21 source_range: [62; 100), 21 source_range: [83; 83),
22 text_edit: None 22 text_edit: None
23 }, 23 },
24 CompletionItem { 24 CompletionItem {
@@ -34,7 +34,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
34 "match $0 {}" 34 "match $0 {}"
35 ), 35 ),
36 insert_text_format: Snippet, 36 insert_text_format: Snippet,
37 source_range: [62; 100), 37 source_range: [83; 83),
38 text_edit: None 38 text_edit: None
39 }, 39 },
40 CompletionItem { 40 CompletionItem {
@@ -50,7 +50,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
50 "while $0 {}" 50 "while $0 {}"
51 ), 51 ),
52 insert_text_format: Snippet, 52 insert_text_format: Snippet,
53 source_range: [62; 100), 53 source_range: [83; 83),
54 text_edit: None 54 text_edit: None
55 }, 55 },
56 CompletionItem { 56 CompletionItem {
@@ -66,7 +66,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
66 "loop {$0}" 66 "loop {$0}"
67 ), 67 ),
68 insert_text_format: Snippet, 68 insert_text_format: Snippet,
69 source_range: [62; 100), 69 source_range: [83; 83),
70 text_edit: None 70 text_edit: None
71 }, 71 },
72 CompletionItem { 72 CompletionItem {
@@ -82,7 +82,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
82 "return $0;" 82 "return $0;"
83 ), 83 ),
84 insert_text_format: Snippet, 84 insert_text_format: Snippet,
85 source_range: [62; 100), 85 source_range: [83; 83),
86 text_edit: None 86 text_edit: None
87 } 87 }
88] 88]
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 54175c1a3..d74483c0b 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,8 +1,8 @@
1--- 1---
2created: "2019-01-22T14:45:00.733874300+00:00" 2created: "2019-01-23T05:27:32.302452+00:00"
3creator: [email protected] 3creator: [email protected]
4expression: kind_completions 4expression: kind_completions
5source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs" 5source: crates/ra_ide_api/src/completion/completion_item.rs
6--- 6---
7[ 7[
8 CompletionItem { 8 CompletionItem {
@@ -18,7 +18,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
18 "if $0 {}" 18 "if $0 {}"
19 ), 19 ),
20 insert_text_format: Snippet, 20 insert_text_format: Snippet,
21 source_range: [62; 100), 21 source_range: [83; 83),
22 text_edit: None 22 text_edit: None
23 }, 23 },
24 CompletionItem { 24 CompletionItem {
@@ -34,7 +34,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
34 "match $0 {}" 34 "match $0 {}"
35 ), 35 ),
36 insert_text_format: Snippet, 36 insert_text_format: Snippet,
37 source_range: [62; 100), 37 source_range: [83; 83),
38 text_edit: None 38 text_edit: None
39 }, 39 },
40 CompletionItem { 40 CompletionItem {
@@ -50,7 +50,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
50 "while $0 {}" 50 "while $0 {}"
51 ), 51 ),
52 insert_text_format: Snippet, 52 insert_text_format: Snippet,
53 source_range: [62; 100), 53 source_range: [83; 83),
54 text_edit: None 54 text_edit: None
55 }, 55 },
56 CompletionItem { 56 CompletionItem {
@@ -66,7 +66,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
66 "loop {$0}" 66 "loop {$0}"
67 ), 67 ),
68 insert_text_format: Snippet, 68 insert_text_format: Snippet,
69 source_range: [62; 100), 69 source_range: [83; 83),
70 text_edit: None 70 text_edit: None
71 }, 71 },
72 CompletionItem { 72 CompletionItem {
@@ -82,7 +82,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
82 "return $0;" 82 "return $0;"
83 ), 83 ),
84 insert_text_format: Snippet, 84 insert_text_format: Snippet,
85 source_range: [62; 100), 85 source_range: [83; 83),
86 text_edit: None 86 text_edit: None
87 } 87 }
88] 88]
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 df9677ba3..a87880ab3 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,8 +1,8 @@
1--- 1---
2created: "2019-01-22T15:38:19.896999400+00:00" 2created: "2019-01-23T07:42:59.657718+00:00"
3creator: [email protected] 3creator: [email protected]
4expression: kind_completions 4expression: kind_completions
5source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs" 5source: crates/ra_ide_api/src/completion/completion_item.rs
6--- 6---
7[ 7[
8 CompletionItem { 8 CompletionItem {
@@ -20,7 +20,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
20 "quux()$0" 20 "quux()$0"
21 ), 21 ),
22 insert_text_format: Snippet, 22 insert_text_format: Snippet,
23 source_range: [72; 102), 23 source_range: [89; 89),
24 text_edit: None 24 text_edit: None
25 }, 25 },
26 CompletionItem { 26 CompletionItem {
@@ -34,7 +34,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
34 lookup: None, 34 lookup: None,
35 insert_text: None, 35 insert_text: None,
36 insert_text_format: PlainText, 36 insert_text_format: PlainText,
37 source_range: [72; 102), 37 source_range: [89; 89),
38 text_edit: None 38 text_edit: None
39 }, 39 },
40 CompletionItem { 40 CompletionItem {
@@ -48,7 +48,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
48 lookup: None, 48 lookup: None,
49 insert_text: None, 49 insert_text: None,
50 insert_text_format: PlainText, 50 insert_text_format: PlainText,
51 source_range: [72; 102), 51 source_range: [89; 89),
52 text_edit: None 52 text_edit: None
53 } 53 }
54] 54]
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 f4b38feb0..f95d10926 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,8 +1,8 @@
1--- 1---
2created: "2019-01-22T15:38:19.896002200+00:00" 2created: "2019-01-23T07:42:59.657837+00:00"
3creator: [email protected] 3creator: [email protected]
4expression: kind_completions 4expression: kind_completions
5source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs" 5source: crates/ra_ide_api/src/completion/completion_item.rs
6--- 6---
7[ 7[
8 CompletionItem { 8 CompletionItem {
@@ -20,7 +20,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
20 "quux()$0" 20 "quux()$0"
21 ), 21 ),
22 insert_text_format: Snippet, 22 insert_text_format: Snippet,
23 source_range: [100; 102), 23 source_range: [101; 101),
24 text_edit: None 24 text_edit: None
25 }, 25 },
26 CompletionItem { 26 CompletionItem {
@@ -34,7 +34,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
34 lookup: None, 34 lookup: None,
35 insert_text: None, 35 insert_text: None,
36 insert_text_format: PlainText, 36 insert_text_format: PlainText,
37 source_range: [100; 102), 37 source_range: [101; 101),
38 text_edit: None 38 text_edit: None
39 } 39 }
40] 40]
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 e6819f231..adc057d80 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,8 +1,8 @@
1--- 1---
2created: "2019-01-22T14:45:00.898433800+00:00" 2created: "2019-01-23T05:27:32.421411+00:00"
3creator: [email protected] 3creator: [email protected]
4expression: kind_completions 4expression: kind_completions
5source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs" 5source: crates/ra_ide_api/src/completion/completion_item.rs
6--- 6---
7[ 7[
8 CompletionItem { 8 CompletionItem {
@@ -16,7 +16,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
16 lookup: None, 16 lookup: None,
17 insert_text: None, 17 insert_text: None,
18 insert_text_format: PlainText, 18 insert_text_format: PlainText,
19 source_range: [46; 60), 19 source_range: [47; 47),
20 text_edit: None 20 text_edit: None
21 }, 21 },
22 CompletionItem { 22 CompletionItem {
@@ -34,7 +34,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
34 "x()$0" 34 "x()$0"
35 ), 35 ),
36 insert_text_format: Snippet, 36 insert_text_format: Snippet,
37 source_range: [46; 60), 37 source_range: [47; 47),
38 text_edit: None 38 text_edit: None
39 } 39 }
40] 40]
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 efda72adf..6a49e325c 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,8 +1,8 @@
1--- 1---
2created: "2019-01-22T14:45:00.894444600+00:00" 2created: "2019-01-23T05:27:32.422259+00:00"
3creator: [email protected] 3creator: [email protected]
4expression: kind_completions 4expression: kind_completions
5source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs" 5source: crates/ra_ide_api/src/completion/completion_item.rs
6--- 6---
7[ 7[
8 CompletionItem { 8 CompletionItem {
@@ -16,7 +16,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
16 lookup: None, 16 lookup: None,
17 insert_text: None, 17 insert_text: None,
18 insert_text_format: PlainText, 18 insert_text_format: PlainText,
19 source_range: [24; 26), 19 source_range: [25; 25),
20 text_edit: None 20 text_edit: None
21 } 21 }
22] 22]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__should_not_complete_snippets_in_path.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__should_not_complete_snippets_in_path.snap
new file mode 100644
index 000000000..cb3278edf
--- /dev/null
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__should_not_complete_snippets_in_path.snap
@@ -0,0 +1,5 @@
1Created: 2019-01-23T05:19:36.475253+00:00
2Creator: [email protected]
3Source: crates/ra_ide_api/src/completion/completion_item.rs
4
5[]
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__should_not_complete_snippets_in_path2.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__should_not_complete_snippets_in_path2.snap
new file mode 100644
index 000000000..62c8e3de9
--- /dev/null
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__should_not_complete_snippets_in_path2.snap
@@ -0,0 +1,5 @@
1Created: 2019-01-23T05:19:36.476869+00:00
2Creator: [email protected]
3Source: crates/ra_ide_api/src/completion/completion_item.rs
4
5[]
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 1d9aff5bb..580c90bdd 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,8 +1,8 @@
1--- 1---
2created: "2019-01-22T14:45:00.944312600+00:00" 2created: "2019-01-23T05:27:32.430450+00:00"
3creator: [email protected] 3creator: [email protected]
4expression: kind_completions 4expression: kind_completions
5source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs" 5source: crates/ra_ide_api/src/completion/completion_item.rs
6--- 6---
7[ 7[
8 CompletionItem { 8 CompletionItem {
@@ -18,7 +18,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
18 "eprintln!(\"$0 = {:?}\", $0);" 18 "eprintln!(\"$0 = {:?}\", $0);"
19 ), 19 ),
20 insert_text_format: Snippet, 20 insert_text_format: Snippet,
21 source_range: [16; 18), 21 source_range: [17; 17),
22 text_edit: None 22 text_edit: None
23 }, 23 },
24 CompletionItem { 24 CompletionItem {
@@ -34,7 +34,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
34 "eprintln!(\"$0 = {:#?}\", $0);" 34 "eprintln!(\"$0 = {:#?}\", $0);"
35 ), 35 ),
36 insert_text_format: Snippet, 36 insert_text_format: Snippet,
37 source_range: [16; 18), 37 source_range: [17; 17),
38 text_edit: None 38 text_edit: None
39 } 39 }
40] 40]
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 678335404..ec95e454c 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,8 +1,8 @@
1--- 1---
2created: "2019-01-22T14:45:00.944312600+00:00" 2created: "2019-01-23T05:27:32.435110+00:00"
3creator: [email protected] 3creator: [email protected]
4expression: kind_completions 4expression: kind_completions
5source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs" 5source: crates/ra_ide_api/src/completion/completion_item.rs
6--- 6---
7[ 7[
8 CompletionItem { 8 CompletionItem {
@@ -20,7 +20,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
20 "#[test]\nfn ${1:feature}() {\n $0\n}" 20 "#[test]\nfn ${1:feature}() {\n $0\n}"
21 ), 21 ),
22 insert_text_format: Snippet, 22 insert_text_format: Snippet,
23 source_range: [49; 79), 23 source_range: [66; 66),
24 text_edit: None 24 text_edit: None
25 }, 25 },
26 CompletionItem { 26 CompletionItem {
@@ -36,7 +36,7 @@ source: "crates\\ra_ide_api\\src\\completion\\completion_item.rs"
36 "pub(crate) $0" 36 "pub(crate) $0"
37 ), 37 ),
38 insert_text_format: Snippet, 38 insert_text_format: Snippet,
39 source_range: [49; 79), 39 source_range: [66; 66),
40 text_edit: None 40 text_edit: None
41 } 41 }
42] 42]
diff --git a/crates/ra_syntax/src/ast.rs b/crates/ra_syntax/src/ast.rs
index 5a5f56057..bcbd4c60c 100644
--- a/crates/ra_syntax/src/ast.rs
+++ b/crates/ra_syntax/src/ast.rs
@@ -334,6 +334,13 @@ impl PathSegment {
334 }; 334 };
335 Some(res) 335 Some(res)
336 } 336 }
337
338 pub fn has_colon_colon(&self) -> bool {
339 match self.syntax.first_child().map(|s| s.kind()) {
340 Some(COLONCOLON) => true,
341 _ => false,
342 }
343 }
337} 344}
338 345
339impl Path { 346impl Path {