Vscode: Create snippets from editor selection

Created on 16 May 2017  路  8Comments  路  Source: microsoft/vscode

In the edit mode, I think it would be better if user take right mouse button click to define a custom code snippet.

One of the situations would be like this:
The user can select multiple line of the code and click right mouse button, then popup a menu and select "convert to code snippet" or something else.

All in all, we want a simple and fast way to create custom code snippet

feature-request help wanted snippets

Most helpful comment

This'd make VS Code much more powerful for me, I don't currently use snippets mostly due to lack of this functionality 馃檹

I'll try the extensions recommended here, but I'd argue it'd be better if users were able to create their own easily without an extension.

All 8 comments

fyi @jrieken

I like, had similar ideas the other day

I was an iOS developer and now turned to be a web front end developer, so same idea came from Xcode using experience.

Agreed. Would make snippets even more approachable and friendly. I never have enough time to sit down and define a code snippet (even though it's only a few lines), but I can definitely see myself converting some code I've typed a million times in to a snippet by clicking my mouse a few times.

Another option is using this extension to create the snippet bodies. Allows you to go back later and add to existing snippets.

See command Lines AS JSON https://marketplace.visualstudio.com/items?itemName=dakara.transformer

This'd make VS Code much more powerful for me, I don't currently use snippets mostly due to lack of this functionality 馃檹

I'll try the extensions recommended here, but I'd argue it'd be better if users were able to create their own easily without an extension.

@jrieken How is the status here, are you guys still interested in a solution inside of vscode or are the listed extensions the way to go? :)

Was this page helpful?
0 / 5 - 0 ratings