

Third: Then write any code snippet you want, following this simple template provided by VS Code, where:

Either a global one (for all projects or just one specific project) or one that is specific to a language. Second: You'll be presented with a list to choose the type of snippet you want to create. It may seem complicated to create your own code snippets, but it's pretty easy!įirst: Go to " User Snippets" in your VS Code " Preferences" But, honestly, the best code snippets will always be the ones you make yourself. Some extensions provide you with code snippets for different languages and frameworks.

In this case, you should know that code snippets are simply pieces of frequently used code that you can insert via a shorthand. You've probably used at one point or another code snippets made by someone else, but maybe you've never used one before. These are my favorite shortcuts, but I strongly recommend that you take a quick look at the shortcuts list provided by VS Code to find out if others could make your life easier:Ĭlick here to access VS Code Keyboard shortcuts for macOS.Ĭlick here to access VS Code Keyboard shortcuts for Windows. 😎 Sometimes I even use it to edit code on multiple lines! ⌘D (MacOS) | Ctrl+D (Windows): It is a must-know because, well first, it adds to your cursor selection the next match, but also it helps you avoid stupid errors for when you need to change that selection, and you miss that one match.⇧⌥↓ / ⇧⌥↑ (MacOS) | Shift+Alt + ↓ / ↑ (Windows): A bit similar to the last one in the sense that it copies a line or a selection AND THEN pastes it below or above where you positioned your cursor.

⌥↓ / ⌥↑ (MacOS) | Alt+ ↑ / ↓ (Windows): Moves a line or a selection up or down from where your selector is positioned. Shortcuts: Move or Duplicate a Line, Up or Down 🙄 But maybe, you didn't notice that in VS Code, you could cut/copy an ENTIRE line without selecting it? 🤓 If you don't already select the chunk of code you want to cut or copy, the editor will automatically cut/copy the line of code where you positioned your selector.
#Visual studio code shortcuts console.log how to
If you go through my previous articles, you'll quickly figure out that one of my common themes is how to increase your productivity while coding. These top tips and tricks will help you dramatically increase your productivity while coding in Visual Studio Code.
