Richard

February 9, 2023

TIL #1 - VS Code insert log statement

Sharing a Visual Studio Code command I use often.

It console.log() the highlighted word you select when you press Shift + Command + L. It saves some time when you are trying to console log a variable, expression, statement or something else.

It would do something like this:
const date = new Date('1995-12-17T03:24:00'); // highlight date and use shortcut
console.log("date: ", date); // Sun Dec 17 1995 03:24:00 GMT...

Copy and paste the following command into your VS Code:
{
  "key": "shift+cmd+l",
  "command": "extension.insertLogStatement",
  "when": "editorTextFocus"
}

About Richard

Life long learner.
⚔️ ⚽ 🏃 📚 📷