aboutsummaryrefslogtreecommitdiff
path: root/crates/completion
diff options
context:
space:
mode:
authorLukas Wirth <[email protected]>2020-12-21 14:10:27 +0000
committerLukas Wirth <[email protected]>2020-12-21 14:10:27 +0000
commit2cd2947bf8cb7abfb06ceb00804447def899d37d (patch)
treedf77edcd7823004b08a0d1e43d9ad2446c847522 /crates/completion
parent33ecad4407e1345cd662f535c2ae7a04e4bee52b (diff)
Insert snippet positions after fields names in record patterns
Diffstat (limited to 'crates/completion')
-rw-r--r--crates/completion/src/completions/pattern.rs10
-rw-r--r--crates/completion/src/render/pattern.rs2
2 files changed, 6 insertions, 6 deletions
diff --git a/crates/completion/src/completions/pattern.rs b/crates/completion/src/completions/pattern.rs
index 23a00803c..ba9921a44 100644
--- a/crates/completion/src/completions/pattern.rs
+++ b/crates/completion/src/completions/pattern.rs
@@ -156,7 +156,7 @@ fn foo() {
156} 156}
157"#, 157"#,
158 expect![[r#" 158 expect![[r#"
159 bn Bar Bar { ${1:f} }$0 159 bn Bar Bar { f$1 }$0
160 "#]], 160 "#]],
161 ); 161 );
162 } 162 }
@@ -171,7 +171,7 @@ struct Baz;
171fn outer(<|>) {} 171fn outer(<|>) {}
172"#, 172"#,
173 expect![[r#" 173 expect![[r#"
174 bn Foo Foo { ${1:bar}, ${2:baz} }: Foo$0 174 bn Foo Foo { bar$1, baz$2 }: Foo$0
175 bn Bar Bar($1, $2): Bar$0 175 bn Bar Bar($1, $2): Bar$0
176 "#]], 176 "#]],
177 ) 177 )
@@ -189,7 +189,7 @@ fn outer() {
189} 189}
190"#, 190"#,
191 expect![[r#" 191 expect![[r#"
192 bn Foo Foo { ${1:bar}, ${2:baz} }$0 192 bn Foo Foo { bar$1, baz$2 }$0
193 bn Bar Bar($1, $2)$0 193 bn Bar Bar($1, $2)$0
194 "#]], 194 "#]],
195 ) 195 )
@@ -209,7 +209,7 @@ fn outer() {
209} 209}
210"#, 210"#,
211 expect![[r#" 211 expect![[r#"
212 bn Foo Foo { ${1:bar}, ${2:baz} }$0 212 bn Foo Foo { bar$1, baz$2 }$0
213 bn Bar Bar($1, $2)$0 213 bn Bar Bar($1, $2)$0
214 "#]], 214 "#]],
215 ) 215 )
@@ -233,7 +233,7 @@ fn outer() {
233} 233}
234"#, 234"#,
235 expect![[r#" 235 expect![[r#"
236 bn Foo Foo { ${1:bar}, .. }$0 236 bn Foo Foo { bar$1, .. }$0
237 bn Bar Bar($1, ..)$0 237 bn Bar Bar($1, ..)$0
238 "#]], 238 "#]],
239 ) 239 )
diff --git a/crates/completion/src/render/pattern.rs b/crates/completion/src/render/pattern.rs
index 2d1600105..073d50a11 100644
--- a/crates/completion/src/render/pattern.rs
+++ b/crates/completion/src/render/pattern.rs
@@ -121,7 +121,7 @@ fn render_record_as_pat(
121 "{name} {{ {}{} }}", 121 "{name} {{ {}{} }}",
122 fields 122 fields
123 .enumerate() 123 .enumerate()
124 .map(|(idx, field)| format!("${{{}:{}}}", idx + 1, field.name(db))) 124 .map(|(idx, field)| format!("{}${}", field.name(db), idx + 1))
125 .format(", "), 125 .format(", "),
126 if fields_omitted { ", .." } else { "" }, 126 if fields_omitted { ", .." } else { "" },
127 name = name 127 name = name