This tip explores the Surround With feature. It is a special form of code snippets, one that knows how to expand a code snippet around an existing block of code with destroying it in the process.
- [Teacher] In this video I'll look at…the Surround With feature.…It's really a special form of code snippets,…one that knows how to expand a code snippet…around an existing block of code…without destroying it in the process.…I'll start by looking at how you use a code snippet.…I'll use the try snippet.…So you type in "T-R-Y" and then you get this Intellisense…in the autocomplete window.…I also can read that I can press the Tab twice…to insert the try snippet.…So let's do that, press the Tab key twice.…
And that stubs in the body of the snippet,…which is a try block and a catch block.…But now I have to take my code and cut it and paste it.…So let's use the surround with…so I don't have to do that extra step.…Put my code back in here.…Then I'll select it…and then right-click and choose Surround With.…Also note the keystroke "Control+K", "Control+S".…I'll use that later.…
So I choose Surround With.…This autocomplete list gives me a short list of snippets…that are surround-with-aware.…In other words, they know how to take the snippet…
Skill Level Intermediate
New This Week
Use the GitHub Extension1m 39s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.