diff options
author | Kan-Ru Chen <[email protected]> | 2019-06-23 02:41:43 +0100 |
---|---|---|
committer | Kan-Ru Chen <[email protected]> | 2019-06-23 14:18:25 +0100 |
commit | bf7a35294d92381ce85cbb6e8a300a270a4d6a81 (patch) | |
tree | 4502ff37bacbc6e8855e8126f6b9b5de3af4fb28 | |
parent | 7d79be32801036c39507fe96f87ed316e3934662 (diff) |
Add box postfix completion
-rw-r--r-- | crates/ra_ide_api/src/completion/complete_postfix.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide_api/src/completion/snapshots/completion_item__postfix_completion_works_for_trivial_path_expression.snap | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/crates/ra_ide_api/src/completion/complete_postfix.rs b/crates/ra_ide_api/src/completion/complete_postfix.rs index 278b1b797..e20a12e2a 100644 --- a/crates/ra_ide_api/src/completion/complete_postfix.rs +++ b/crates/ra_ide_api/src/completion/complete_postfix.rs | |||
@@ -51,6 +51,8 @@ pub(super) fn complete_postfix(acc: &mut Completions, ctx: &CompletionContext) { | |||
51 | ) | 51 | ) |
52 | .add_to(acc); | 52 | .add_to(acc); |
53 | postfix_snippet(ctx, "dbg", "dbg!(expr)", &format!("dbg!({})", receiver_text)).add_to(acc); | 53 | postfix_snippet(ctx, "dbg", "dbg!(expr)", &format!("dbg!({})", receiver_text)).add_to(acc); |
54 | postfix_snippet(ctx, "box", "Box::new(expr)", &format!("Box::new({})", receiver_text)) | ||
55 | .add_to(acc); | ||
54 | } | 56 | } |
55 | } | 57 | } |
56 | 58 | ||
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 fcb292596..c1a40b7b4 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,11 +1,18 @@ | |||
1 | --- | 1 | --- |
2 | created: "2019-05-23T22:23:35.118738523Z" | 2 | created: "2019-06-23T13:01:08.775536006Z" |
3 | creator: [email protected] | 3 | creator: [email protected] |
4 | source: crates/ra_ide_api/src/completion/completion_item.rs | 4 | source: crates/ra_ide_api/src/completion/completion_item.rs |
5 | expression: kind_completions | 5 | expression: kind_completions |
6 | --- | 6 | --- |
7 | [ | 7 | [ |
8 | CompletionItem { | 8 | CompletionItem { |
9 | label: "box", | ||
10 | source_range: [76; 76), | ||
11 | delete: [72; 76), | ||
12 | insert: "Box::new(bar)", | ||
13 | detail: "Box::new(expr)", | ||
14 | }, | ||
15 | CompletionItem { | ||
9 | label: "dbg", | 16 | label: "dbg", |
10 | source_range: [76; 76), | 17 | source_range: [76; 76), |
11 | delete: [72; 76), | 18 | delete: [72; 76), |