Use Shift+Alt+L to quickly insert console.log statements in Cursor / VS Code. Inspired by vscode-js-console-utils.
- No selection: Inserts a blank
console.log();at the cursor, with the cursor inside the parentheses so you can type a variable or expression directly. - With selection: Based on the selected text, inserts a labeled log at the end of the line containing the last selection, in the format:
console.log('variableName: ', variableName);
- Multiple selections: Supports multiple selections; inserts multiple
console.loglines in document order, one per selection.
Search for Cursor JS Console Utils and install.
- In the project root, run:
npm run pkg - In VS Code / Cursor: press Ctrl+Shift+P → type Install from vsix → select the generated
.vsixfile.
- Command Palette:
Ctrl+Shift+P(Windows/Linux) orCmd+Shift+P(macOS), then type and select "Insert console.log for selection". - Keyboard shortcut:
Shift+Alt+L.
| Action | Result |
|---|---|
| Cursor on a line, no selection, run command | Inserts console.log(); at that position |
Select variable userName, run command |
Inserts console.log('userName: ', userName); at the end of that line |
Multi-select a, b, c (three selections), run command |
Inserts three lines after the line of the last selection: console.log('<var>: ', <var>); |
- Language-agnostic: The extension does not check file type; it inserts
console.login any file. If you use it in non-JavaScript/TypeScript files, ensure it fits your project (e.g. remove or replace with the appropriate print/log for that language). - Insert position: With selection(s), all log lines are inserted at the end of the line containing the last selection (after a newline), not after each selection.
- Shortcut conflicts:
Shift+Alt+Lmay conflict with other extensions or system shortcuts. You can search for Insert console.log for selection in Keyboard Shortcuts and change it.
- VS Code version ≥ 1.75.0 (or a compatible Cursor version).
If this extension helps you, consider leaving a rating or review on the Cursor / VS Code marketplace — it helps others discover it:).
MIT License. See LICENSE for details.
