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 transforms don't work with choice placeholders #57052

Closed
a01fe opened this issue Aug 22, 2018 · 6 comments
Closed

Snippet transforms don't work with choice placeholders #57052

a01fe opened this issue Aug 22, 2018 · 6 comments
Assignees
Labels
*as-designed Described behavior is as designed *out-of-scope Posted issue is not in scope of VS Code snippets

Comments

@a01fe
Copy link

a01fe commented Aug 22, 2018

Issue Type: Bug

Snippet placeholder transforms do not work when the placeholder has choices instead of a default value.

Reproduce with this snippet:

"test": {
	"prefix": "test",
	"body": [
		"placeholder thing ${1:this}",
		"choice thing ${2|this,that,other|}",
		"transform placeholder ${1/(this)|(that)|(other)/${1:+1}${2:+2}${3:+3}/}",
		"transform placeholder ${2/(this)|(that)|(other)/${1:+1}${2:+2}${3:+3}/}",
		"$0"
	],
	"description": "test test test"
}

Expanding the snippet with that entered for both placeholders results in:

placeholder thing that
choice thing that
transform placeholder 2
transform placeholder that

VS Code version: Code - Insiders 1.27.0-insider (e0a6826, 2018-08-22T05:12:41.569Z)
OS version: Darwin x64 16.7.0

System Info
Item Value
CPUs Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz (8 x 4200)
GPU Status 2d_canvas: enabled
checker_imaging: disabled_off
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: enabled
rasterization: enabled
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
Load (avg) 2, 2, 1
Memory (System) 64.00GB (42.73GB free)
Process Argv /Applications/Visual Studio Code - Insiders.app/Contents/MacOS/Electron
Screen Reader no
VM 43%
Extensions (18)
Extension Author (truncated) Version
xml Dot 2.3.2
EditorConfig Edi 0.12.4
asciidoctor-vscode joa 0.15.0
vscode-emacs-friendly lfs 0.8.2
mssql ms- 1.4.0
python ms- 2018.7.1
azure-account ms- 0.4.3
PowerShell ms- 1.8.3
gradle-language nac 0.2.3
vscode-docker Pet 0.1.0
remote-vscode raf 1.1.0
java red 0.29.0
code-spell-checker str 1.6.10
vscode-java-debug vsc 0.11.0
vscode-java-pack vsc 0.3.0
vscode-java-test vsc 0.8.0
vscode-maven vsc 0.10.0
plsql-language xyz 1.4.2
@vscodebot
Copy link

vscodebot bot commented Aug 22, 2018

@jrieken jrieken added snippets *as-designed Described behavior is as designed labels Aug 23, 2018
@jrieken
Copy link
Member

jrieken commented Aug 23, 2018

Yeah, that's the design and I don't think that Textmate snippets support that.

@a01fe
Copy link
Author

a01fe commented Aug 23, 2018

Ahh, ok. If there's a design reason for disallowing placeholders with choice values to be used with transforms, then perhaps the documentation should reflect that?

@jrieken
Copy link
Member

jrieken commented Aug 24, 2018

We have this document (and a grammar definition): https://code.visualstudio.com/docs/editor/userdefinedsnippets#_grammar

@jrieken jrieken added the *out-of-scope Posted issue is not in scope of VS Code label Sep 7, 2018
@vscodebot
Copy link

vscodebot bot commented Sep 7, 2018

This issue is being closed to keep the number of issues in our inbox on a manageable level, we are closing issues that are not going to be addressed in the foreseeable future: We look at the number of votes the issue has received and the number of duplicate issues filed. If you disagree and feel that this issue is crucial: We are happy to listen and to reconsider.

If you wonder what we are up to, please see our roadmap and issue reporting guidelines.

Thanks for your understanding and happy coding!

@ChuckJonas
Copy link

Come-on... At the very least the documentation needs to be updated to reflect this limitation. Wasted a lot of time trying to figure this out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
*as-designed Described behavior is as designed *out-of-scope Posted issue is not in scope of VS Code snippets
Projects
None yet
Development

No branches or pull requests

3 participants