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 transform leaves conditional operator #53137

Open
jrieken opened this issue Jun 27, 2018 · 3 comments
Open

Snippet transform leaves conditional operator #53137

jrieken opened this issue Jun 27, 2018 · 3 comments
Assignees
Labels
feature-request Request for new features or functionality snippets
Milestone

Comments

@jrieken
Copy link
Member

jrieken commented Jun 27, 2018

	"fffff": {
		"prefix": "ffff",
		"body": [
			"- (${1:void})${2:methodName}{",
			"${1/void$|(.+)/(?1:\n\treturn nil;)/}",
			"}"
		]
	},
  • have the snippet above
  • type number for the first placeholder
  • press tab
  • 🐛 there ?1: in the editor...
@jrieken jrieken self-assigned this Jun 27, 2018
@jrieken jrieken added bug Issue identified by VS Code Team member as probable bug snippets labels Jun 27, 2018
@jrieken jrieken added this to the June 2018 milestone Jun 27, 2018
@jrieken jrieken added feature-request Request for new features or functionality and removed bug Issue identified by VS Code Team member as probable bug labels Jun 27, 2018
@jrieken
Copy link
Member Author

jrieken commented Jun 27, 2018

Would need for conditional insertions which is something we don't have, see :https://manual.macromates.com/en/regular_expressions#conditional_insertions.html

@jrieken jrieken removed this from the June 2018 milestone Jun 27, 2018
@tdhatcher
Copy link

@jrieken jrieken added this to the Backlog milestone Jan 13, 2020
@ArturoDent
Copy link

I'm confused, how do the linked textmate conditional insertions differ from the conditional replacements that vscode snippets already have:

            | '${' int ':+' if '}'
            | '${' int ':?' if ':' else '}'
            | '${' int ':-' else '}' | '${' int ':' else '}'

The original question can be achieved with:

	"${1/(void$)|(.+)/${1:+\n\treturn nil;}$2/}",  
                    // although it isnt clear if that last `$2` is desired, I'm guessing it is

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality snippets
Projects
None yet
Development

No branches or pull requests

3 participants