aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-02-14 17:13:39 +0000
committerAleksey Kladov <[email protected]>2019-02-14 17:13:39 +0000
commit434f1520df2965240809e37ea144c61f564c1c39 (patch)
treefab889676a33b578f1377b882954fed25ff6f7d6 /crates
parentb85c189500a47f3c5f7690250611b06e08616c9a (diff)
add ref postfix template
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_ide_api/src/completion/complete_postfix.rs1
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__postfix_completion_works_for_trivial_path_expression.snap29
2 files changed, 27 insertions, 3 deletions
diff --git a/crates/ra_ide_api/src/completion/complete_postfix.rs b/crates/ra_ide_api/src/completion/complete_postfix.rs
index 10a3c8db7..b7dc50c34 100644
--- a/crates/ra_ide_api/src/completion/complete_postfix.rs
+++ b/crates/ra_ide_api/src/completion/complete_postfix.rs
@@ -30,6 +30,7 @@ pub(super) fn complete_postfix(acc: &mut Completions, ctx: &CompletionContext) {
30 if let Some(dot_receiver) = ctx.dot_receiver { 30 if let Some(dot_receiver) = ctx.dot_receiver {
31 let receiver_text = dot_receiver.syntax().text().to_string(); 31 let receiver_text = dot_receiver.syntax().text().to_string();
32 postfix_snippet(ctx, "not", &format!("!{}", receiver_text)).add_to(acc); 32 postfix_snippet(ctx, "not", &format!("!{}", receiver_text)).add_to(acc);
33 postfix_snippet(ctx, "ref", &format!("&{}", receiver_text)).add_to(acc);
33 postfix_snippet(ctx, "if", &format!("if {} {{$0}}", receiver_text)).add_to(acc); 34 postfix_snippet(ctx, "if", &format!("if {} {{$0}}", receiver_text)).add_to(acc);
34 postfix_snippet( 35 postfix_snippet(
35 ctx, 36 ctx,
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 bc886ef0b..3e16c8e79 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,8 +1,8 @@
1--- 1---
2created: "2019-02-03T11:38:42.897384636+00:00" 2created: "2019-02-14T17:12:57.412523988Z"
3creator: [email protected] 3creator: [email protected]
4expression: kind_completions
5source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions
6--- 6---
7[ 7[
8 CompletionItem { 8 CompletionItem {
@@ -99,6 +99,29 @@ source: crates/ra_ide_api/src/completion/completion_item.rs
99 }, 99 },
100 CompletionItem { 100 CompletionItem {
101 completion_kind: Postfix, 101 completion_kind: Postfix,
102 label: "ref",
103 kind: None,
104 detail: None,
105 documentation: None,
106 lookup: None,
107 insert_text: Some(
108 "&bar"
109 ),
110 insert_text_format: Snippet,
111 source_range: [76; 76),
112 text_edit: Some(
113 TextEdit {
114 atoms: [
115 AtomTextEdit {
116 delete: [72; 76),
117 insert: ""
118 }
119 ]
120 }
121 )
122 },
123 CompletionItem {
124 completion_kind: Postfix,
102 label: "while", 125 label: "while",
103 kind: None, 126 kind: None,
104 detail: None, 127 detail: None,