Quickly insert console.log() for selected code in VS Code.
Select a variable or expression, hit the shortcut — a console.log() with a label appears on the next line, properly indented.
Install from Open VSX Registry:
ext install blasdfaa.js-consoler- Select text in the editor
- Press
Cmd+Shift+L(Mac) /Ctrl+Shift+L(Windows/Linux)
const user = getUser()
// Select `user`, press the shortcut, and get:
console.log('user', user)Without selection, an empty console.log() is inserted.
| Key | Description | Default |
|---|---|---|
js-consoler.logTemplate |
Log statement template. See placeholders below. | console.log('{selected}', {selected}) |
js-consoler.enableCodeActions |
Show "Log variable" quick actions (lightbulb) in the editor. | true |
js-consoler.enableHighlight |
Highlight console.* statements in the editor. |
false |
| Placeholder | Description |
|---|---|
{selected} |
Selected text or variable name |
{line} |
Line number where the log is inserted (1-based) |
Default: Cmd+Shift+L / Ctrl+Shift+L. Rebind via Preferences: Open Keyboard Shortcuts and search for Insert Console Log.