What is the shortcut in Visual Studio Code for console.log
⚡TLDR
In Visual Studio Code, the in-built shortcut for the console.log statement is log followed by pressing the Tab key. This converts your input to:
Insert your content within the parentheses. Speed up your coding process by personalizing shortcuts in keybindings.json, or creating custom User Snippets.
Utilizing snippets for your own debugging
Personalized console.log() Shortcuts:
- Navigate via File>Preferences>User Snippets.
- Create a New Global Snippets fileor choose an existing language.
- Customize the snippet 'prefix'toclg, then set'body'for the desired console.log structure.
Just type clg and press Tab, and it'll activate your new snippet.
Extensions can be your best friend:
There are a couple of community-created extensions providing additional value for logging:
- JavaScript (ES6) code snippets: Opens a whole new world of abbreviations for faster JS coding.
- Turbo Console Log: Speedrunner? This extension will automate the console.log process.
Feeding snippets with a custom dish
"Go beyond the Snippet":
User Snippets grant you the freedom to declare multiple languages with scope property:
To have your finger on snippet suggestions, prioritize them:
- Find your way to File>Preferences>Settings.
- Seek out the Editor: Snippet Suggestions.
- Set this option to topto have your customized snippets on the front line.
Linked
Was this article helpful?
