Surrounds the selected text with a statement of your choice. Make sure you only select the text you want to surround from start to end and not the other way around
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
More surrounding expression will be available in the next versions
Requirements
You need to always select your code from start to end. so that your cursor is at the end of the code you want to surround.
Undo (ctrl+Z or cmd+z) will remove the whole operation.
Extension Settings
For example:
To surround a block with if/else :
surround your code
(Windows => ctrl+shit+i) or (mac => cmd+shift+i)
To surround a block with try/catch :
surround your code
(Windows => ctrl+shit+t) or (mac => cmd+shift+t)
To surround a block with JSON.parse(code) :
surround your code
(Windows => ctrl+shit+p) or (mac => cmd+shift+p)
To surround a block with JSON.stringify(code) :
surround your code
(Windows => ctrl+shit+j) or (mac => cmd+shift+j)
Known Issues
Selecting a block from end to start will reject the operation and display a message.
Also I did not test this extension on Mac or Linux. So sorry in advance if there are bugs there.
Release Notes
Now able to surround an html blocl with a given tag. To do so :
Select a block from start to end
Press Shift + Alt + W
type your tag
Enter, and Voila
0.0.4
Rearragnged some code. Unit tests are still missing