Skip to content

Snippet transformations: If-type transforms cannot use backslashes #80394

@wongjn

Description

@wongjn

Issue Type: Bug

Steps to Reproduce:

  1. Create user snippet:
"Test": {
  "body": [
    "${CURRENT_YEAR/(.+)/${1:+\\\\}/}",
    "${CURRENT_YEAR/(.+)/${1:?\\\\:-}/}",
    "${CURRENT_YEAR/(.+)/${1:-\\\\}/}",
    "${CURRENT_YEAR/(.+)/${1:\\\\}/}",
  ]
}
  1. Insert snippet into the document.

Expected output:

\
\
2019
2019

Actual output:

${CURRENT_YEAR/(.+)/+\/}
${CURRENT_YEAR/(.+)/+\/}
${CURRENT_YEAR/(.+)/+\/}
${CURRENT_YEAR/(.+)/+\/}

This was working correctly in 1.37.x.
Works correctly if you replace \\\\ with anything else.

VS Code version: Code 1.38.0 (3db7e09, 2019-09-03T21:49:13.459Z)
OS version: Windows_NT x64 10.0.17763
Remote OS version: Linux x64 4.4.0-17763-Microsoft
Remote OS version: Linux x64 4.4.0-17763-Microsoft

System Info
Item Value
CPUs Intel(R) Core(TM) i5-7400 CPU @ 3.00GHz (4 x 3000)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: enabled
skia_deferred_display_list: disabled_off
skia_renderer: disabled_off
surface_synchronization: enabled_on
video_decode: enabled
viz_display_compositor: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 15.91GB (6.26GB free)
Process Argv
Screen Reader no
VM 0%
Item Value
Remote WSL
OS Linux x64 4.4.0-17763-Microsoft
CPUs Intel(R) Core(TM) i5-7400 CPU @ 3.00GHz (4 x 3000)
Memory (System) 15.91GB (6.26GB free)
VM 0%
Item Value
Remote WSL
OS Linux x64 4.4.0-17763-Microsoft
CPUs Intel(R) Core(TM) i5-7400 CPU @ 3.00GHz (4 x 3000)
Memory (System) 15.91GB (6.26GB free)
VM 0%

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugsnippetsverifiedVerification succeeded

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions