Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Snippet cannot escape closing bracket inside conditional insertion variable replacement #78883

Closed
adamvictorclever opened this issue Aug 11, 2019 · 1 comment
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug snippets verified Verification succeeded
Milestone

Comments

@adamvictorclever
Copy link

adamvictorclever commented Aug 11, 2019

Issue Type: Bug

I'm essentially trying to conditionally include a line in a snippet if the TM_DIRECTORY variable matches something. A simplified version of what I'm trying to do looks like this: ${TM_DIRECTORY/(.+)/${1:+import { hello } from world}/}, where if TM_DIRECTORY matches a pattern (in this case anything) it inserts the line import { hello } from world.

However, I cannot seem to escape the closing bracket of hello }. I've tried using various numbers of backslashes in front of it, and none seem to work. I've put the various results I'm seeing below:

${TM_DIRECTORY/(.+)/${1:+import { hello \} from world}/} results in import { hello from world
${TM_DIRECTORY/(.+)/${1:+import { hello \\} from world}/} results in import { hello \ from world}
${TM_DIRECTORY/(.+)/${1:+import { hello \\\} from world}/} results in import { hello \ from world
${TM_DIRECTORY/(.+)/${1:+import { hello \\\\} from world}/} results in import { hello \\ from world}

This feels like a bug to me, but I'd appreciate any guidance!

VS Code version: Code 1.37.0 (036a6b1, 2019-08-08T01:22:37.660Z)
OS version: Darwin x64 18.2.0

System Info
Item Value
CPUs Intel(R) Core(TM) i5-7267U CPU @ 3.10GHz (4 x 3100)
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: enabled
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) 2, 3, 3
Memory (System) 8.00GB (0.02GB free)
Process Argv -psn_0_569483
Screen Reader no
VM 0%
@jrieken jrieken added bug Issue identified by VS Code Team member as probable bug snippets labels Aug 12, 2019
@jrieken jrieken added this to the August 2019 milestone Aug 12, 2019
@jrieken
Copy link
Member

jrieken commented Aug 12, 2019

Good find - the } after hello isn't checked for being escaped by the \

@mjbvz mjbvz added the verified Verification succeeded label Aug 28, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Sep 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug snippets verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

3 participants