aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_api')
-rw-r--r--crates/ra_ide_api/src/completion/complete_postfix.rs14
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion1.snap27
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion2.snap27
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion3.snap27
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion4.snap123
5 files changed, 212 insertions, 6 deletions
diff --git a/crates/ra_ide_api/src/completion/complete_postfix.rs b/crates/ra_ide_api/src/completion/complete_postfix.rs
index b5c4d2ebd..af25452b8 100644
--- a/crates/ra_ide_api/src/completion/complete_postfix.rs
+++ b/crates/ra_ide_api/src/completion/complete_postfix.rs
@@ -42,6 +42,7 @@ pub(super) fn complete_postfix(acc: &mut Completions, ctx: &CompletionContext) {
42 ) 42 )
43 .add_to(acc); 43 .add_to(acc);
44 postfix_snippet(ctx, "while", &format!("while {} {{\n$0\n}}", receiver_text)).add_to(acc); 44 postfix_snippet(ctx, "while", &format!("while {} {{\n$0\n}}", receiver_text)).add_to(acc);
45 postfix_snippet(ctx, "dbg", &format!("dbg!({})", receiver_text)).add_to(acc);
45 } 46 }
46} 47}
47 48
@@ -92,4 +93,17 @@ mod tests {
92 "#, 93 "#,
93 ); 94 );
94 } 95 }
96
97 #[test]
98 fn test_filter_postfix_completion4() {
99 check_snippet_completion(
100 "filter_postfix_completion4",
101 r#"
102 fn main() {
103 let bar = "a";
104 bar.dbg<|>
105 }
106 "#,
107 );
108 }
95} 109}
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion1.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion1.snap
index 6b2287951..840ec4881 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion1.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion1.snap
@@ -1,12 +1,35 @@
1--- 1---
2created: "2019-01-27T19:56:59.944118550+00:00" 2created: "2019-02-02T15:08:34.016389802+00:00"
3creator: [email protected].2 3creator: [email protected].3
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 {
9 completion_kind: Postfix, 9 completion_kind: Postfix,
10 label: "dbg",
11 kind: None,
12 detail: None,
13 documentation: None,
14 lookup: None,
15 insert_text: Some(
16 "dbg!(bar)"
17 ),
18 insert_text_format: Snippet,
19 source_range: [76; 76),
20 text_edit: Some(
21 TextEdit {
22 atoms: [
23 AtomTextEdit {
24 delete: [72; 76),
25 insert: ""
26 }
27 ]
28 }
29 )
30 },
31 CompletionItem {
32 completion_kind: Postfix,
10 label: "if", 33 label: "if",
11 kind: None, 34 kind: None,
12 detail: None, 35 detail: None,
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion2.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion2.snap
index 6925fd102..b46366d88 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion2.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion2.snap
@@ -1,12 +1,35 @@
1--- 1---
2created: "2019-01-27T19:56:59.942831213+00:00" 2created: "2019-02-02T15:08:34.016388824+00:00"
3creator: [email protected].2 3creator: [email protected].3
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 {
9 completion_kind: Postfix, 9 completion_kind: Postfix,
10 label: "dbg",
11 kind: None,
12 detail: None,
13 documentation: None,
14 lookup: None,
15 insert_text: Some(
16 "dbg!(bar)"
17 ),
18 insert_text_format: Snippet,
19 source_range: [76; 77),
20 text_edit: Some(
21 TextEdit {
22 atoms: [
23 AtomTextEdit {
24 delete: [72; 76),
25 insert: ""
26 }
27 ]
28 }
29 )
30 },
31 CompletionItem {
32 completion_kind: Postfix,
10 label: "if", 33 label: "if",
11 kind: None, 34 kind: None,
12 detail: None, 35 detail: None,
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 22eaf2b4f..3f865cf93 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,12 +1,35 @@
1--- 1---
2created: "2019-01-27T19:56:59.944615925+00:00" 2created: "2019-02-02T15:08:34.060136941+00:00"
3creator: [email protected].2 3creator: [email protected].3
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 {
9 completion_kind: Postfix, 9 completion_kind: Postfix,
10 label: "dbg",
11 kind: None,
12 detail: None,
13 documentation: None,
14 lookup: None,
15 insert_text: Some(
16 "dbg!(bar)"
17 ),
18 insert_text_format: Snippet,
19 source_range: [78; 78),
20 text_edit: Some(
21 TextEdit {
22 atoms: [
23 AtomTextEdit {
24 delete: [72; 78),
25 insert: ""
26 }
27 ]
28 }
29 )
30 },
31 CompletionItem {
32 completion_kind: Postfix,
10 label: "if", 33 label: "if",
11 kind: None, 34 kind: None,
12 detail: None, 35 detail: None,
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion4.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion4.snap
new file mode 100644
index 000000000..da1033e7c
--- /dev/null
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion4.snap
@@ -0,0 +1,123 @@
1---
2created: "2019-02-02T15:08:34.069147268+00:00"
3creator: [email protected]
4expression: kind_completions
5source: crates/ra_ide_api/src/completion/completion_item.rs
6---
7[
8 CompletionItem {
9 completion_kind: Postfix,
10 label: "dbg",
11 kind: None,
12 detail: None,
13 documentation: None,
14 lookup: None,
15 insert_text: Some(
16 "dbg!(bar)"
17 ),
18 insert_text_format: Snippet,
19 source_range: [78; 78),
20 text_edit: Some(
21 TextEdit {
22 atoms: [
23 AtomTextEdit {
24 delete: [72; 78),
25 insert: ""
26 }
27 ]
28 }
29 )
30 },
31 CompletionItem {
32 completion_kind: Postfix,
33 label: "if",
34 kind: None,
35 detail: None,
36 documentation: None,
37 lookup: None,
38 insert_text: Some(
39 "if bar {$0}"
40 ),
41 insert_text_format: Snippet,
42 source_range: [78; 78),
43 text_edit: Some(
44 TextEdit {
45 atoms: [
46 AtomTextEdit {
47 delete: [72; 78),
48 insert: ""
49 }
50 ]
51 }
52 )
53 },
54 CompletionItem {
55 completion_kind: Postfix,
56 label: "match",
57 kind: None,
58 detail: None,
59 documentation: None,
60 lookup: None,
61 insert_text: Some(
62 "match bar {\n${1:_} => {$0\\},\n}"
63 ),
64 insert_text_format: Snippet,
65 source_range: [78; 78),
66 text_edit: Some(
67 TextEdit {
68 atoms: [
69 AtomTextEdit {
70 delete: [72; 78),
71 insert: ""
72 }
73 ]
74 }
75 )
76 },
77 CompletionItem {
78 completion_kind: Postfix,
79 label: "not",
80 kind: None,
81 detail: None,
82 documentation: None,
83 lookup: None,
84 insert_text: Some(
85 "!bar"
86 ),
87 insert_text_format: Snippet,
88 source_range: [78; 78),
89 text_edit: Some(
90 TextEdit {
91 atoms: [
92 AtomTextEdit {
93 delete: [72; 78),
94 insert: ""
95 }
96 ]
97 }
98 )
99 },
100 CompletionItem {
101 completion_kind: Postfix,
102 label: "while",
103 kind: None,
104 detail: None,
105 documentation: None,
106 lookup: None,
107 insert_text: Some(
108 "while bar {\n$0\n}"
109 ),
110 insert_text_format: Snippet,
111 source_range: [78; 78),
112 text_edit: Some(
113 TextEdit {
114 atoms: [
115 AtomTextEdit {
116 delete: [72; 78),
117 insert: ""
118 }
119 ]
120 }
121 )
122 }
123]