Smart Console
快速生成与批量管理 console.log 调试语句的 VSCode 插件。
功能
clog 触发剪贴板补全:在 JS/TS/JSX/TSX/Vue 文件输入 clog,自动以剪贴板内容作为变量名生成 console.log;剪贴板非法时提供光标可编辑的 ${1:variable} 占位符。
- 选中变量插入
console.log:选中变量(或将光标置于变量上)按下快捷键,下一行插入对应的 console.log,保留缩进,支持多重选区。
- 批量删除
console.log:一键删除当前文件所有整行 console.log/warn/error/info/debug 调用。
- 批量切换
console.log 注释:一键注释 / 取消注释当前文件所有 console.xxx 行。
快捷键
| 命令 |
macOS |
Windows / Linux |
Smart Console: Insert console.log for Selection |
Cmd+Alt+L |
Ctrl+Alt+L |
Smart Console: Delete All console.log |
Cmd+Alt+D |
Ctrl+Alt+D |
Smart Console: Toggle Comment for All console.log |
Cmd+Alt+/ |
Ctrl+Alt+/ |
配置项
| 配置项 |
类型 |
默认值 |
说明 |
smartConsole.quoteStyle |
"backtick" \| "single" \| "double" |
"backtick" |
标签字符串使用的引号风格 |
smartConsole.separator |
string |
"=====" |
变量名与分隔符之间的字符 |
smartConsole.includeFileName |
boolean |
false |
标签中是否包含当前文件名 |
smartConsole.includeLineNumber |
boolean |
false |
标签中是否包含当前行号 |
smartConsole.semicolon |
boolean |
true |
生成语句末尾是否添加分号 |
smartConsole.logFunction |
string |
"console.log" |
输出语句使用的函数名 |
smartConsole.colorize |
boolean |
true |
是否给打印的标签添加颜色样式(基于 %c) |
smartConsole.labelStyle |
string |
"color: #4caf50; font-weight: bold;" |
colorize 启用时标签使用的 CSS 样式字符串 |
演示
动图占位(待补充 assets/demo.gif)
License
MIT
| |