Sulog VS Code Extension
A super quick way to insert console.log statements in your code.
Features
- Insert console.log statements quickly with a keyboard shortcut
- Automatically includes selected text in the console.log statement
- Customizable keyboard shortcut
- Customizable prefix for console.log statements
- Customizable text color and background color for console output
Usage
- Select any text in your editor
- Press
cmd+shift+l (Mac) to insert a console.log statement with the selected text
- If no text is selected, a basic
console.log(); statement will be inserted
- The console.log statement is always inserted on the line below the cursor
Requirements
None
Extension Settings
This extension contributes the following settings:
sulog.consoleShortcut : Custom shortcut for inserting console.log statements (default: cmd+shift+l )
sulog.consolePrefix : Custom prefix for console.log statements (default: prefix>>> )
sulog.consoleTextColor : Custom text color for console.log statements (CSS color value, default: empty)
sulog.consoleBackgroundColor : Custom background color for console.log statements (CSS color value, default: empty)
Customization
You can customize various aspects of the extension by following these steps:
Keyboard Shortcut
- Open VS Code settings (Code > Preferences > Settings)
- Search for "Sulog Configuration"
- Change the "Console Shortcut" value to your desired keyboard shortcut
- Restart VS Code for the changes to take effect
Prefix
- Open VS Code settings (Code > Preferences > Settings)
- Search for "Sulog Configuration"
- Change the "Console Prefix" value to your desired prefix
Text Color
- Open VS Code settings (Code > Preferences > Settings)
- Search for "Sulog Configuration"
- Change the "Console Text Color" value to your desired CSS color value (e.g.,
red , #ff0000 , rgb(255, 0, 0) )
Background Color
- Open VS Code settings (Code > Preferences > Settings)
- Search for "Sulog Configuration"
- Change the "Console Background Color" value to your desired CSS color value (e.g.,
yellow , #ffff00 , rgb(255, 255, 0) )
Alternatively, you can edit the keybindings.json file directly:
- Open the Command Palette (
cmd+shift+p )
- Search for "Preferences: Open Keyboard Shortcuts (JSON)"
- Add or modify the keybinding for
sulog.insertConsole
Example keybindings.json entry:
[
{
"key": "ctrl+shift+l",
"command": "sulog.insertConsole",
"when": "editorTextFocus"
}
]
Known Issues
- Keyboard shortcut changes require a restart of VS Code to take effect
Release Notes
0.0.1
Initial release of Sulog
- Basic console.log insertion
- Customizable keyboard shortcut
0.0.2
Added new features:
- Customizable prefix for console.log statements
- Customizable text color for console output
- Customizable background color for console output
Following extension guidelines
Ensure that you've read through the extensions guidelines and follow the best practices for creating your extension.
Working with Markdown
You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts:
- Split the editor (
Cmd+\ on macOS or Ctrl+\ on Windows and Linux).
- Toggle preview (
Shift+Cmd+V on macOS or Shift+Ctrl+V on Windows and Linux).
- Press
Ctrl+Space (Windows, Linux, macOS) to see a list of Markdown snippets.
Enjoy!
| |