aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-01-21 22:10:43 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-01-21 22:10:43 +0000
commit79720549beb3050692ace15ee97785da60972fd9 (patch)
tree9079424a6d88002415cdff9e779be4f65338c843 /crates/ra_ide_api
parent0d2cb60f93c5e73c0171e83fef36b696cc5dd4ff (diff)
parent0cfd80422a66dd35008dc7895c060ca279aaf970 (diff)
Merge #588
588: Fix .not postfix completion r=matklad a=flodiebold The postfix snippets are awesome! I don't think the `.not` one is supposed to always replace the receiver by literally `!not` :smile: Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/ra_ide_api')
-rw-r--r--crates/ra_ide_api/src/completion/complete_postfix.rs6
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion1.snap4
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion2.snap4
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion3.snap4
4 files changed, 9 insertions, 9 deletions
diff --git a/crates/ra_ide_api/src/completion/complete_postfix.rs b/crates/ra_ide_api/src/completion/complete_postfix.rs
index cf0252a00..b5c4d2ebd 100644
--- a/crates/ra_ide_api/src/completion/complete_postfix.rs
+++ b/crates/ra_ide_api/src/completion/complete_postfix.rs
@@ -33,7 +33,7 @@ fn postfix_snippet(ctx: &CompletionContext, label: &str, snippet: &str) -> Build
33pub(super) fn complete_postfix(acc: &mut Completions, ctx: &CompletionContext) { 33pub(super) fn complete_postfix(acc: &mut Completions, ctx: &CompletionContext) {
34 if let Some(dot_receiver) = ctx.dot_receiver { 34 if let Some(dot_receiver) = ctx.dot_receiver {
35 let receiver_text = dot_receiver.syntax().text().to_string(); 35 let receiver_text = dot_receiver.syntax().text().to_string();
36 postfix_snippet(ctx, "not", "!not").add_to(acc); 36 postfix_snippet(ctx, "not", &format!("!{}", receiver_text)).add_to(acc);
37 postfix_snippet(ctx, "if", &format!("if {} {{$0}}", receiver_text)).add_to(acc); 37 postfix_snippet(ctx, "if", &format!("if {} {{$0}}", receiver_text)).add_to(acc);
38 postfix_snippet( 38 postfix_snippet(
39 ctx, 39 ctx,
@@ -50,8 +50,8 @@ mod tests {
50 use crate::completion::completion_item::CompletionKind; 50 use crate::completion::completion_item::CompletionKind;
51 use crate::completion::completion_item::check_completion; 51 use crate::completion::completion_item::check_completion;
52 52
53 fn check_snippet_completion(code: &str, expected_completions: &str) { 53 fn check_snippet_completion(test_name: &str, code: &str) {
54 check_completion(code, expected_completions, CompletionKind::Postfix); 54 check_completion(test_name, code, CompletionKind::Postfix);
55 } 55 }
56 56
57 #[test] 57 #[test]
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 a0abd00cc..ed9b62586 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,4 +1,4 @@
1Created: 2019-01-21T05:12:32.815475+00:00 1Created: 2019-01-21T21:32:37.509646722+00:00
2Creator: [email protected] 2Creator: [email protected]
3Source: crates/ra_ide_api/src/completion/completion_item.rs 3Source: crates/ra_ide_api/src/completion/completion_item.rs
4 4
@@ -10,7 +10,7 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
10 detail: None, 10 detail: None,
11 lookup: None, 11 lookup: None,
12 insert_text: Some( 12 insert_text: Some(
13 "!not" 13 "!bar"
14 ), 14 ),
15 insert_text_format: Snippet, 15 insert_text_format: Snippet,
16 source_range: [76; 76), 16 source_range: [76; 76),
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 3b3ee8d43..cc566ac35 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,4 +1,4 @@
1Created: 2019-01-21T05:12:32.816092+00:00 1Created: 2019-01-21T21:32:37.510644822+00:00
2Creator: [email protected] 2Creator: [email protected]
3Source: crates/ra_ide_api/src/completion/completion_item.rs 3Source: crates/ra_ide_api/src/completion/completion_item.rs
4 4
@@ -10,7 +10,7 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
10 detail: None, 10 detail: None,
11 lookup: None, 11 lookup: None,
12 insert_text: Some( 12 insert_text: Some(
13 "!not" 13 "!bar"
14 ), 14 ),
15 insert_text_format: Snippet, 15 insert_text_format: Snippet,
16 source_range: [76; 77), 16 source_range: [76; 77),
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 31e8f008c..c9f9bddcf 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,4 +1,4 @@
1Created: 2019-01-21T05:19:05.341730+00:00 1Created: 2019-01-21T21:32:37.510629228+00:00
2Creator: [email protected] 2Creator: [email protected]
3Source: crates/ra_ide_api/src/completion/completion_item.rs 3Source: crates/ra_ide_api/src/completion/completion_item.rs
4 4
@@ -10,7 +10,7 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
10 detail: None, 10 detail: None,
11 lookup: None, 11 lookup: None,
12 insert_text: Some( 12 insert_text: Some(
13 "!not" 13 "!bar"
14 ), 14 ),
15 insert_text_format: Snippet, 15 insert_text_format: Snippet,
16 source_range: [76; 78), 16 source_range: [76; 78),