turbo-print-var:基于 VS Code 的调试日志生成扩展

快速打印变量成日志

Branch1Tags3

Turbo Print Var

Turbo Print Var

Visual Studio Marketplace Version VS Code Installs Open VSX Downloads

English | 中文


🚀 Main Features

Turbo Print Var is a powerful VS Code extension that automates debug log insertion for 20+ programming languages. It intelligently generates context-aware log statements with file names, line numbers, and variable information.

✨ Key Highlights

  • 🌍 Multi-Language Support: JavaScript/TypeScript, Python, Java, C/C++, Go, Rust, PHP, Ruby, Swift, Kotlin, Scala, and more
  • 🎯 Smart Variable Detection: Automatically detects variables at cursor position or selection
  • 📍 Context-Aware: Includes file name and line number in log output
  • ⚡ Multi-Cursor Support: Process multiple variables simultaneously
  • 🎨 Customizable Format: Configure log prefix, delimiter, quotes, and more
  • 🔧 Powerful Commands: Insert, update, comment, uncomment, and delete logs

📖 Usage

1. Insert Log Statement

  1. Select a variable or place cursor on it
  2. Press Ctrl+Alt+L (Windows/Linux) or Cmd+Alt+L (Mac)
  3. Log statement will be inserted on the next line

Example Output:

const user = { name: 'John' };
console.log('🚀 ~ file: app.js:2 ~ user:', user);

2. Update Line Numbers

  • Press Ctrl+Alt+U (Windows/Linux) or Cmd+Alt+U (Mac)
  • Updates line numbers in all log statements

3. Comment/Uncomment Logs

  • Comment: Alt+Shift+C
  • Uncomment: Alt+Shift+U

4. Delete All Logs

  • Press Alt+Shift+D to remove all generated log statements

⚙️ Configuration

Customize the extension in VS Code settings (Ctrl+, or Cmd+,):

Setting Description Default
turbo-print-var.prefix Prefix symbol for log messages 🚀
turbo-print-var.suffix Suffix after variable name :
turbo-print-var.separator Delimiter between log elements ~
turbo-print-var.quote Quote style: ", ', or ` "
turbo-print-var.includeFileInfo Include file name and line number true
turbo-print-var.addSemicolon Add semicolon at end (auto-detect if unset) auto
turbo-print-var.emptyLineBefore Insert empty line before log false
turbo-print-var.emptyLineAfter Insert empty line after log false
turbo-print-var.logFunction Custom log function per language {}

Example custom log function:

{
  "turbo-print-var.logFunction": {
    "php": "var_dump",
    "python": "print"
  }
}

🌐 Supported Languages

  • C
  • C++
  • C#
  • CoffeeScript
  • Dart
  • Go
  • Groovy
  • Java
  • JavaScript
  • Kotlin
  • Lua
  • Perl
  • PHP
  • Python
  • R
  • Ruby
  • Rust
  • Scala
  • Shell Script
  • Swift
  • TypeScript

📝 License

MIT

Introduction

快速打印变量成日志

Customize your domain