diff options
Diffstat (limited to 'crates/ra_ide_api/src')
-rw-r--r-- | crates/ra_ide_api/src/completion/complete_postfix.rs | 31 | ||||
-rw-r--r-- | crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion2.snap | 100 | ||||
-rw-r--r-- | crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion3.snap | 100 | ||||
-rw-r--r-- | crates/ra_ide_api/src/completion/snapshots/completion_item__postfix_completion_works_for_trivial_path_expression.snap (renamed from crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion1.snap) | 27 |
4 files changed, 28 insertions, 230 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..e3a739d6d 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 | ||
@@ -55,9 +56,9 @@ mod tests { | |||
55 | } | 56 | } |
56 | 57 | ||
57 | #[test] | 58 | #[test] |
58 | fn test_filter_postfix_completion1() { | 59 | fn postfix_completion_works_for_trivial_path_expression() { |
59 | check_snippet_completion( | 60 | check_snippet_completion( |
60 | "filter_postfix_completion1", | 61 | "postfix_completion_works_for_trivial_path_expression", |
61 | r#" | 62 | r#" |
62 | fn main() { | 63 | fn main() { |
63 | let bar = "a"; | 64 | let bar = "a"; |
@@ -66,30 +67,4 @@ mod tests { | |||
66 | "#, | 67 | "#, |
67 | ); | 68 | ); |
68 | } | 69 | } |
69 | |||
70 | #[test] | ||
71 | fn test_filter_postfix_completion2() { | ||
72 | check_snippet_completion( | ||
73 | "filter_postfix_completion2", | ||
74 | r#" | ||
75 | fn main() { | ||
76 | let bar = "a"; | ||
77 | bar.i<|> | ||
78 | } | ||
79 | "#, | ||
80 | ); | ||
81 | } | ||
82 | |||
83 | #[test] | ||
84 | fn test_filter_postfix_completion3() { | ||
85 | check_snippet_completion( | ||
86 | "filter_postfix_completion3", | ||
87 | r#" | ||
88 | fn main() { | ||
89 | let bar = "a"; | ||
90 | bar.if<|> | ||
91 | } | ||
92 | "#, | ||
93 | ); | ||
94 | } | ||
95 | } | 70 | } |
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 deleted file mode 100644 index 6925fd102..000000000 --- a/crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion2.snap +++ /dev/null | |||
@@ -1,100 +0,0 @@ | |||
1 | --- | ||
2 | created: "2019-01-27T19:56:59.942831213+00:00" | ||
3 | creator: [email protected] | ||
4 | expression: kind_completions | ||
5 | source: crates/ra_ide_api/src/completion/completion_item.rs | ||
6 | --- | ||
7 | [ | ||
8 | CompletionItem { | ||
9 | completion_kind: Postfix, | ||
10 | label: "if", | ||
11 | kind: None, | ||
12 | detail: None, | ||
13 | documentation: None, | ||
14 | lookup: None, | ||
15 | insert_text: Some( | ||
16 | "if bar {$0}" | ||
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, | ||
33 | label: "match", | ||
34 | kind: None, | ||
35 | detail: None, | ||
36 | documentation: None, | ||
37 | lookup: None, | ||
38 | insert_text: Some( | ||
39 | "match bar {\n${1:_} => {$0\\},\n}" | ||
40 | ), | ||
41 | insert_text_format: Snippet, | ||
42 | source_range: [76; 77), | ||
43 | text_edit: Some( | ||
44 | TextEdit { | ||
45 | atoms: [ | ||
46 | AtomTextEdit { | ||
47 | delete: [72; 76), | ||
48 | insert: "" | ||
49 | } | ||
50 | ] | ||
51 | } | ||
52 | ) | ||
53 | }, | ||
54 | CompletionItem { | ||
55 | completion_kind: Postfix, | ||
56 | label: "not", | ||
57 | kind: None, | ||
58 | detail: None, | ||
59 | documentation: None, | ||
60 | lookup: None, | ||
61 | insert_text: Some( | ||
62 | "!bar" | ||
63 | ), | ||
64 | insert_text_format: Snippet, | ||
65 | source_range: [76; 77), | ||
66 | text_edit: Some( | ||
67 | TextEdit { | ||
68 | atoms: [ | ||
69 | AtomTextEdit { | ||
70 | delete: [72; 76), | ||
71 | insert: "" | ||
72 | } | ||
73 | ] | ||
74 | } | ||
75 | ) | ||
76 | }, | ||
77 | CompletionItem { | ||
78 | completion_kind: Postfix, | ||
79 | label: "while", | ||
80 | kind: None, | ||
81 | detail: None, | ||
82 | documentation: None, | ||
83 | lookup: None, | ||
84 | insert_text: Some( | ||
85 | "while bar {\n$0\n}" | ||
86 | ), | ||
87 | insert_text_format: Snippet, | ||
88 | source_range: [76; 77), | ||
89 | text_edit: Some( | ||
90 | TextEdit { | ||
91 | atoms: [ | ||
92 | AtomTextEdit { | ||
93 | delete: [72; 76), | ||
94 | insert: "" | ||
95 | } | ||
96 | ] | ||
97 | } | ||
98 | ) | ||
99 | } | ||
100 | ] | ||
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 deleted file mode 100644 index 22eaf2b4f..000000000 --- a/crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion3.snap +++ /dev/null | |||
@@ -1,100 +0,0 @@ | |||
1 | --- | ||
2 | created: "2019-01-27T19:56:59.944615925+00:00" | ||
3 | creator: [email protected] | ||
4 | expression: kind_completions | ||
5 | source: crates/ra_ide_api/src/completion/completion_item.rs | ||
6 | --- | ||
7 | [ | ||
8 | CompletionItem { | ||
9 | completion_kind: Postfix, | ||
10 | label: "if", | ||
11 | kind: None, | ||
12 | detail: None, | ||
13 | documentation: None, | ||
14 | lookup: None, | ||
15 | insert_text: Some( | ||
16 | "if bar {$0}" | ||
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: "match", | ||
34 | kind: None, | ||
35 | detail: None, | ||
36 | documentation: None, | ||
37 | lookup: None, | ||
38 | insert_text: Some( | ||
39 | "match bar {\n${1:_} => {$0\\},\n}" | ||
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: "not", | ||
57 | kind: None, | ||
58 | detail: None, | ||
59 | documentation: None, | ||
60 | lookup: None, | ||
61 | insert_text: Some( | ||
62 | "!bar" | ||
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: "while", | ||
80 | kind: None, | ||
81 | detail: None, | ||
82 | documentation: None, | ||
83 | lookup: None, | ||
84 | insert_text: Some( | ||
85 | "while bar {\n$0\n}" | ||
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 | ] | ||
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__postfix_completion_works_for_trivial_path_expression.snap index 6b2287951..bc886ef0b 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__postfix_completion_works_for_trivial_path_expression.snap | |||
@@ -1,12 +1,35 @@ | |||
1 | --- | 1 | --- |
2 | created: "2019-01-27T19:56:59.944118550+00:00" | 2 | created: "2019-02-03T11:38:42.897384636+00:00" |
3 | creator: [email protected].2 | 3 | creator: [email protected].3 |
4 | expression: kind_completions | 4 | expression: kind_completions |
5 | source: crates/ra_ide_api/src/completion/completion_item.rs | 5 | source: 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, |