aboutsummaryrefslogtreecommitdiff
path: root/crates/completion/src/patterns.rs
diff options
context:
space:
mode:
authorKevaundray Wedderburn <[email protected]>2021-01-06 20:15:48 +0000
committerKevaundray Wedderburn <[email protected]>2021-01-07 12:09:23 +0000
commit72b9a4fbd3c12f3250b9157a1d44230e04ec8b22 (patch)
treec138363e3592c690d841aeedb9ac97d6b2ff4396 /crates/completion/src/patterns.rs
parent171c3c08fe245938fb25321394233de5fe2abc7c (diff)
Change <|> to $0 - Rebase
Diffstat (limited to 'crates/completion/src/patterns.rs')
-rw-r--r--crates/completion/src/patterns.rs46
1 files changed, 23 insertions, 23 deletions
diff --git a/crates/completion/src/patterns.rs b/crates/completion/src/patterns.rs
index b0f35f9bf..f148b9402 100644
--- a/crates/completion/src/patterns.rs
+++ b/crates/completion/src/patterns.rs
@@ -20,7 +20,7 @@ pub(crate) fn has_trait_parent(element: SyntaxElement) -> bool {
20} 20}
21#[test] 21#[test]
22fn test_has_trait_parent() { 22fn test_has_trait_parent() {
23 check_pattern_is_applicable(r"trait A { f<|> }", has_trait_parent); 23 check_pattern_is_applicable(r"trait A { f$0 }", has_trait_parent);
24} 24}
25 25
26pub(crate) fn has_impl_parent(element: SyntaxElement) -> bool { 26pub(crate) fn has_impl_parent(element: SyntaxElement) -> bool {
@@ -32,7 +32,7 @@ pub(crate) fn has_impl_parent(element: SyntaxElement) -> bool {
32} 32}
33#[test] 33#[test]
34fn test_has_impl_parent() { 34fn test_has_impl_parent() {
35 check_pattern_is_applicable(r"impl A { f<|> }", has_impl_parent); 35 check_pattern_is_applicable(r"impl A { f$0 }", has_impl_parent);
36} 36}
37 37
38pub(crate) fn inside_impl_trait_block(element: SyntaxElement) -> bool { 38pub(crate) fn inside_impl_trait_block(element: SyntaxElement) -> bool {
@@ -47,10 +47,10 @@ pub(crate) fn inside_impl_trait_block(element: SyntaxElement) -> bool {
47} 47}
48#[test] 48#[test]
49fn test_inside_impl_trait_block() { 49fn test_inside_impl_trait_block() {
50 check_pattern_is_applicable(r"impl Foo for Bar { f<|> }", inside_impl_trait_block); 50 check_pattern_is_applicable(r"impl Foo for Bar { f$0 }", inside_impl_trait_block);
51 check_pattern_is_applicable(r"impl Foo for Bar { fn f<|> }", inside_impl_trait_block); 51 check_pattern_is_applicable(r"impl Foo for Bar { fn f$0 }", inside_impl_trait_block);
52 check_pattern_is_not_applicable(r"impl A { f<|> }", inside_impl_trait_block); 52 check_pattern_is_not_applicable(r"impl A { f$0 }", inside_impl_trait_block);
53 check_pattern_is_not_applicable(r"impl A { fn f<|> }", inside_impl_trait_block); 53 check_pattern_is_not_applicable(r"impl A { fn f$0 }", inside_impl_trait_block);
54} 54}
55 55
56pub(crate) fn has_field_list_parent(element: SyntaxElement) -> bool { 56pub(crate) fn has_field_list_parent(element: SyntaxElement) -> bool {
@@ -58,8 +58,8 @@ pub(crate) fn has_field_list_parent(element: SyntaxElement) -> bool {
58} 58}
59#[test] 59#[test]
60fn test_has_field_list_parent() { 60fn test_has_field_list_parent() {
61 check_pattern_is_applicable(r"struct Foo { f<|> }", has_field_list_parent); 61 check_pattern_is_applicable(r"struct Foo { f$0 }", has_field_list_parent);
62 check_pattern_is_applicable(r"struct Foo { f<|> pub f: i32}", has_field_list_parent); 62 check_pattern_is_applicable(r"struct Foo { f$0 pub f: i32}", has_field_list_parent);
63} 63}
64 64
65pub(crate) fn has_block_expr_parent(element: SyntaxElement) -> bool { 65pub(crate) fn has_block_expr_parent(element: SyntaxElement) -> bool {
@@ -67,7 +67,7 @@ pub(crate) fn has_block_expr_parent(element: SyntaxElement) -> bool {
67} 67}
68#[test] 68#[test]
69fn test_has_block_expr_parent() { 69fn test_has_block_expr_parent() {
70 check_pattern_is_applicable(r"fn my_fn() { let a = 2; f<|> }", has_block_expr_parent); 70 check_pattern_is_applicable(r"fn my_fn() { let a = 2; f$0 }", has_block_expr_parent);
71} 71}
72 72
73pub(crate) fn has_bind_pat_parent(element: SyntaxElement) -> bool { 73pub(crate) fn has_bind_pat_parent(element: SyntaxElement) -> bool {
@@ -75,8 +75,8 @@ pub(crate) fn has_bind_pat_parent(element: SyntaxElement) -> bool {
75} 75}
76#[test] 76#[test]
77fn test_has_bind_pat_parent() { 77fn test_has_bind_pat_parent() {
78 check_pattern_is_applicable(r"fn my_fn(m<|>) {}", has_bind_pat_parent); 78 check_pattern_is_applicable(r"fn my_fn(m$0) {}", has_bind_pat_parent);
79 check_pattern_is_applicable(r"fn my_fn() { let m<|> }", has_bind_pat_parent); 79 check_pattern_is_applicable(r"fn my_fn() { let m$0 }", has_bind_pat_parent);
80} 80}
81 81
82pub(crate) fn has_ref_parent(element: SyntaxElement) -> bool { 82pub(crate) fn has_ref_parent(element: SyntaxElement) -> bool {
@@ -86,8 +86,8 @@ pub(crate) fn has_ref_parent(element: SyntaxElement) -> bool {
86} 86}
87#[test] 87#[test]
88fn test_has_ref_parent() { 88fn test_has_ref_parent() {
89 check_pattern_is_applicable(r"fn my_fn(&m<|>) {}", has_ref_parent); 89 check_pattern_is_applicable(r"fn my_fn(&m$0) {}", has_ref_parent);
90 check_pattern_is_applicable(r"fn my() { let &m<|> }", has_ref_parent); 90 check_pattern_is_applicable(r"fn my() { let &m$0 }", has_ref_parent);
91} 91}
92 92
93pub(crate) fn has_item_list_or_source_file_parent(element: SyntaxElement) -> bool { 93pub(crate) fn has_item_list_or_source_file_parent(element: SyntaxElement) -> bool {
@@ -99,8 +99,8 @@ pub(crate) fn has_item_list_or_source_file_parent(element: SyntaxElement) -> boo
99} 99}
100#[test] 100#[test]
101fn test_has_item_list_or_source_file_parent() { 101fn test_has_item_list_or_source_file_parent() {
102 check_pattern_is_applicable(r"i<|>", has_item_list_or_source_file_parent); 102 check_pattern_is_applicable(r"i$0", has_item_list_or_source_file_parent);
103 check_pattern_is_applicable(r"mod foo { f<|> }", has_item_list_or_source_file_parent); 103 check_pattern_is_applicable(r"mod foo { f$0 }", has_item_list_or_source_file_parent);
104} 104}
105 105
106pub(crate) fn is_match_arm(element: SyntaxElement) -> bool { 106pub(crate) fn is_match_arm(element: SyntaxElement) -> bool {
@@ -112,7 +112,7 @@ pub(crate) fn is_match_arm(element: SyntaxElement) -> bool {
112} 112}
113#[test] 113#[test]
114fn test_is_match_arm() { 114fn test_is_match_arm() {
115 check_pattern_is_applicable(r"fn my_fn() { match () { () => m<|> } }", is_match_arm); 115 check_pattern_is_applicable(r"fn my_fn() { match () { () => m$0 } }", is_match_arm);
116} 116}
117 117
118pub(crate) fn unsafe_is_prev(element: SyntaxElement) -> bool { 118pub(crate) fn unsafe_is_prev(element: SyntaxElement) -> bool {
@@ -124,7 +124,7 @@ pub(crate) fn unsafe_is_prev(element: SyntaxElement) -> bool {
124} 124}
125#[test] 125#[test]
126fn test_unsafe_is_prev() { 126fn test_unsafe_is_prev() {
127 check_pattern_is_applicable(r"unsafe i<|>", unsafe_is_prev); 127 check_pattern_is_applicable(r"unsafe i$0", unsafe_is_prev);
128} 128}
129 129
130pub(crate) fn if_is_prev(element: SyntaxElement) -> bool { 130pub(crate) fn if_is_prev(element: SyntaxElement) -> bool {
@@ -144,11 +144,11 @@ pub(crate) fn fn_is_prev(element: SyntaxElement) -> bool {
144} 144}
145#[test] 145#[test]
146fn test_fn_is_prev() { 146fn test_fn_is_prev() {
147 check_pattern_is_applicable(r"fn l<|>", fn_is_prev); 147 check_pattern_is_applicable(r"fn l$0", fn_is_prev);
148} 148}
149 149
150/// Check if the token previous to the previous one is `for`. 150/// Check if the token previous to the previous one is `for`.
151/// For example, `for _ i<|>` => true. 151/// For example, `for _ i$0` => true.
152pub(crate) fn for_is_prev2(element: SyntaxElement) -> bool { 152pub(crate) fn for_is_prev2(element: SyntaxElement) -> bool {
153 element 153 element
154 .into_token() 154 .into_token()
@@ -159,12 +159,12 @@ pub(crate) fn for_is_prev2(element: SyntaxElement) -> bool {
159} 159}
160#[test] 160#[test]
161fn test_for_is_prev2() { 161fn test_for_is_prev2() {
162 check_pattern_is_applicable(r"for i i<|>", for_is_prev2); 162 check_pattern_is_applicable(r"for i i$0", for_is_prev2);
163} 163}
164 164
165#[test] 165#[test]
166fn test_if_is_prev() { 166fn test_if_is_prev() {
167 check_pattern_is_applicable(r"if l<|>", if_is_prev); 167 check_pattern_is_applicable(r"if l$0", if_is_prev);
168} 168}
169 169
170pub(crate) fn has_trait_as_prev_sibling(element: SyntaxElement) -> bool { 170pub(crate) fn has_trait_as_prev_sibling(element: SyntaxElement) -> bool {
@@ -172,7 +172,7 @@ pub(crate) fn has_trait_as_prev_sibling(element: SyntaxElement) -> bool {
172} 172}
173#[test] 173#[test]
174fn test_has_trait_as_prev_sibling() { 174fn test_has_trait_as_prev_sibling() {
175 check_pattern_is_applicable(r"trait A w<|> {}", has_trait_as_prev_sibling); 175 check_pattern_is_applicable(r"trait A w$0 {}", has_trait_as_prev_sibling);
176} 176}
177 177
178pub(crate) fn has_impl_as_prev_sibling(element: SyntaxElement) -> bool { 178pub(crate) fn has_impl_as_prev_sibling(element: SyntaxElement) -> bool {
@@ -180,7 +180,7 @@ pub(crate) fn has_impl_as_prev_sibling(element: SyntaxElement) -> bool {
180} 180}
181#[test] 181#[test]
182fn test_has_impl_as_prev_sibling() { 182fn test_has_impl_as_prev_sibling() {
183 check_pattern_is_applicable(r"impl A w<|> {}", has_impl_as_prev_sibling); 183 check_pattern_is_applicable(r"impl A w$0 {}", has_impl_as_prev_sibling);
184} 184}
185 185
186pub(crate) fn is_in_loop_body(element: SyntaxElement) -> bool { 186pub(crate) fn is_in_loop_body(element: SyntaxElement) -> bool {