Generate debug print statements instantly for multiple programming languages in Visual Studio Code.
Place your cursor on a variable (or select one), press a shortcut, and AutoPrint inserts a language-specific debug print statement automatically.
Features
- Works with cursor or selected text
- Automatically detects current language
- Preserves indentation
- Supports multiple languages
- Right-click context menu support
- Fast debug logging workflow
- Automatic
fmtimport handling for Go - AUTOPRINT tagging for generated logs
- Removes all AutoPrint-generated logs automatically
Supported Languages
| Language | Generated Output |
|---|---|
| Python | print(f"x = {x}") |
| JavaScript | console.log('x =', x); |
| TypeScript | console.log('x =', x); |
| React (JS/TS) | console.log('x =', x); |
| Java | System.out.println("x = " + x); |
| C | printf("x = %d\n", x); |
| C++ | std::cout << "x = " << x << std::endl; |
| C# | Console.WriteLine($"x = {x}"); |
| Go | fmt.Printf("x = %v\n", x) |
| Rust | println!("x = {:?}", x); |
| PHP | echo 'x = ' . var_export($x, true) . "\n"; |
| Ruby | puts "x = #{x.inspect}" |
| Swift | print("x =", x) |
| Kotlin | println("x = $x") |
Usage
Method 1 — Cursor Mode
Place cursor on a variable:
totalPrice = 499
Press:
Ctrl + Alt + Z
Generated:
# AUTOPRINT
print(f"totalPrice = {totalPrice}")
Method 2 — Selection Mode
Select:
userName;
Press shortcut.
Generated:
// AUTOPRINT
console.log("userName =", userName);
Keyboard Shortcuts
| Action | Windows / Linux | macOS |
|---|---|---|
| Generate Logs | Ctrl + Alt + Z |
Cmd + Alt + Z |
You can customize shortcuts in VS Code Keyboard Shortcuts.
Context Menu
Right click inside the editor and choose:
Generate Print Statement
or
Remove AutoPrint Statements
Go Support
AutoPrint automatically adds:
import "fmt"
if it does not already exist in the file.
Installation
From Marketplace
Search for:
AutoPrint
inside the VS Code Extensions marketplace.
From VSIX
- Open VS Code
- Go to Extensions
- Click
... - Select:
Install from VSIX
- Choose the generated
.vsixfile
Development
Setup
Clone repository and install dependencies:
npm install
Compile
npm run compile
Watch Mode
npm run watch
Run Extension
Press:
F5
This opens the Extension Development Host.
Packaging
Install VSCE:
npm install -g @vscode/vsce
Generate VSIX:
vsce package
Known Limitations
- C format specifiers are not inferred automatically yet
- Multi-cursor support is not implemented yet
- AST-aware logging is not implemented yet
Planned Features
- Smart object logging
- Multi-variable support
- AST-aware print generation
- Configurable templates
- More language support
- Smarter C printf generation
- Snippet-based insertion
Contributing
Pull requests and feature suggestions are welcome.
License
MIT License