Published at
Updated at
Reading time

VS Code's January release notes included an excellent new editor feature that lets you wrap lines with everyday snippets such as if/else or loops.

You might know that I'm always on the hunt for editor workflows that help me save some keystrokes. Check the "JavaScript booster" extension if you're looking for VS Code commands to convert let to const, replace strings with template strings or convert arrow functions to anonymous functions. It's so good!

The new command โ€“ "Surround with snippet"

The functionality is quickly explained. Highlight the code lines you want to surround with a snippet, open the command palette and wrap away!

Here's it in action. ๐Ÿ‘‡

Example showing VS Code and a highlighted line that's wrapped in a if/else

Save some keystrokes, friends! ๐Ÿ‘‹

Was this post helpful?
Yes? Cool! You might want to check out Web Weekly for more web development articles. The last edition went out 4 days ago.
Stefan standing in the park in front of a green background

About Stefan Judis

Frontend nerd with over ten years of experience, freelance dev, "Today I Learned" blogger, conference speaker, and Open Source maintainer.

Related Topics

Related Articles