@@ -1001,8 +1001,10 @@ fn merge_text_and_snippet_edits(
1001
1001
let mut new_text = current_indel. insert ;
1002
1002
1003
1003
// find which snippet bits need to be escaped
1004
- let escape_places =
1005
- new_text. rmatch_indices ( [ '\\' , '$' ] ) . map ( |( insert, _) | insert) . collect_vec ( ) ;
1004
+ let escape_places = new_text
1005
+ . rmatch_indices ( [ '\\' , '$' , '{' , '}' ] )
1006
+ . map ( |( insert, _) | insert)
1007
+ . collect_vec ( ) ;
1006
1008
let mut escape_places = escape_places. into_iter ( ) . peekable ( ) ;
1007
1009
let mut escape_prior_bits = |new_text : & mut String , up_to : usize | {
1008
1010
for before in escape_places. peeking_take_while ( |insert| * insert >= up_to) {
@@ -2173,7 +2175,7 @@ fn bar(_: usize) {}
2173
2175
character: 0,
2174
2176
},
2175
2177
},
2176
- new_text: "\\$${1:ab{ }\\$c\\\\d}ef",
2178
+ new_text: "\\$${1:ab\\{\\ }\\$c\\\\d}ef",
2177
2179
insert_text_format: Some(
2178
2180
Snippet,
2179
2181
),
@@ -2242,41 +2244,41 @@ struct ProcMacro {
2242
2244
edit,
2243
2245
snippets,
2244
2246
expect ! [ [ r#"
2245
- [
2246
- SnippetTextEdit {
2247
- range: Range {
2248
- start: Position {
2249
- line: 1,
2250
- character: 4,
2251
- },
2252
- end: Position {
2253
- line: 1,
2254
- character: 13,
2255
- },
2256
- },
2257
- new_text: "let",
2258
- insert_text_format: None,
2259
- annotation_id: None,
2260
- },
2261
- SnippetTextEdit {
2262
- range: Range {
2263
- start: Position {
2264
- line: 1,
2265
- character: 14,
2266
- },
2267
- end: Position {
2268
- line: 3,
2269
- character: 5,
2270
- },
2271
- },
2272
- new_text: "$0disabled = false;\n ProcMacro {\n disabled,\n }",
2273
- insert_text_format: Some(
2274
- Snippet,
2275
- ),
2276
- annotation_id: None,
2277
- },
2278
- ]
2279
- "# ] ] ,
2247
+ [
2248
+ SnippetTextEdit {
2249
+ range: Range {
2250
+ start: Position {
2251
+ line: 1,
2252
+ character: 4,
2253
+ },
2254
+ end: Position {
2255
+ line: 1,
2256
+ character: 13,
2257
+ },
2258
+ },
2259
+ new_text: "let",
2260
+ insert_text_format: None,
2261
+ annotation_id: None,
2262
+ },
2263
+ SnippetTextEdit {
2264
+ range: Range {
2265
+ start: Position {
2266
+ line: 1,
2267
+ character: 14,
2268
+ },
2269
+ end: Position {
2270
+ line: 3,
2271
+ character: 5,
2272
+ },
2273
+ },
2274
+ new_text: "$0disabled = false;\n ProcMacro \\ {\n disabled,\n \\ }",
2275
+ insert_text_format: Some(
2276
+ Snippet,
2277
+ ),
2278
+ annotation_id: None,
2279
+ },
2280
+ ]
2281
+ "#] ] ,
2280
2282
) ;
2281
2283
}
2282
2284
@@ -2306,41 +2308,41 @@ struct P {
2306
2308
edit,
2307
2309
snippets,
2308
2310
expect ! [ [ r#"
2309
- [
2310
- SnippetTextEdit {
2311
- range: Range {
2312
- start: Position {
2313
- line: 1,
2314
- character: 4,
2315
- },
2316
- end: Position {
2317
- line: 1,
2318
- character: 5,
2319
- },
2320
- },
2321
- new_text: "let",
2322
- insert_text_format: None,
2323
- annotation_id: None,
2324
- },
2325
- SnippetTextEdit {
2326
- range: Range {
2327
- start: Position {
2328
- line: 1,
2329
- character: 6,
2330
- },
2331
- end: Position {
2332
- line: 3,
2333
- character: 5,
2334
- },
2335
- },
2336
- new_text: "$0disabled = false;\n ProcMacro {\n disabled,\n }",
2337
- insert_text_format: Some(
2338
- Snippet,
2339
- ),
2340
- annotation_id: None,
2341
- },
2342
- ]
2343
- "# ] ] ,
2311
+ [
2312
+ SnippetTextEdit {
2313
+ range: Range {
2314
+ start: Position {
2315
+ line: 1,
2316
+ character: 4,
2317
+ },
2318
+ end: Position {
2319
+ line: 1,
2320
+ character: 5,
2321
+ },
2322
+ },
2323
+ new_text: "let",
2324
+ insert_text_format: None,
2325
+ annotation_id: None,
2326
+ },
2327
+ SnippetTextEdit {
2328
+ range: Range {
2329
+ start: Position {
2330
+ line: 1,
2331
+ character: 6,
2332
+ },
2333
+ end: Position {
2334
+ line: 3,
2335
+ character: 5,
2336
+ },
2337
+ },
2338
+ new_text: "$0disabled = false;\n ProcMacro \\ {\n disabled,\n \\ }",
2339
+ insert_text_format: Some(
2340
+ Snippet,
2341
+ ),
2342
+ annotation_id: None,
2343
+ },
2344
+ ]
2345
+ "#] ] ,
2344
2346
) ;
2345
2347
}
2346
2348
@@ -2398,7 +2400,7 @@ struct ProcMacro {
2398
2400
character: 5,
2399
2401
},
2400
2402
},
2401
- new_text: "${0:disabled} = false;\n ProcMacro {\n disabled,\n }",
2403
+ new_text: "${0:disabled} = false;\n ProcMacro \\ {\n disabled,\n \\ }",
2402
2404
insert_text_format: Some(
2403
2405
Snippet,
2404
2406
),
@@ -2463,7 +2465,7 @@ struct P {
2463
2465
character: 5,
2464
2466
},
2465
2467
},
2466
- new_text: "${0:disabled} = false;\n ProcMacro {\n disabled,\n }",
2468
+ new_text: "${0:disabled} = false;\n ProcMacro \\ {\n disabled,\n \\ }",
2467
2469
insert_text_format: Some(
2468
2470
Snippet,
2469
2471
),
0 commit comments