vscode 快速打印console.log

第一步

输入这些

javascript 复制代码
{
    // Print Selected Variabl 为自定义快捷键中需要使用的name,可以自行修改
	"Print Selected Variable": {
		"body": [
			"\nconsole.log(",
			"  '%c $CLIPBOARD: ',",
			"  'background-color: #3756d4; padding: 4px 8px; border-radius: 2px; font-size: 14px; color: #fff; font-weight: 700;',",
			"  $CLIPBOARD$1",
			")"
		],
		"description": "Print Selected Variable"
	}
}

第二步 设置快捷键

javascript 复制代码
{
    "key": "z", // 自定义快捷键
    "command": "runCommands", // 运行多个命令
    "args": {
        "commands": [
            {
                "command": "editor.action.clipboardCopyAction" // 复制选中文本
            },
            {
                "command": "cursorEnd" // 光标移到最后
            },
            {
                "command": "editor.action.insertSnippet", // 插入片段
                "args": {
                    "name": "Print Selected Variable" // 调用已配置的代码片段,这里是代码片段里定义的值
                }
            }
        ]
    }
}
相关推荐
xzjiang_3653 小时前
Jupyter 运行经验3:读入和显示一张图片
ide·python·jupyter
我命由我123453 小时前
Visual Studio 文件的编码格式不一致问题:错误 C2001 常量中有换行符
c语言·开发语言·c++·ide·学习·学习方法·visual studio
AC赳赳老秦4 小时前
2026 AI原生开发工具链趋势:DeepSeek与主流IDE深度联动实践指南
运维·ide·人工智能·架构·prometheus·ai-native·deepseek
姜太小白5 小时前
【VSCode/Trae】trae已安装的扩展如何导出
ide·vscode·编辑器
danyang_Q6 小时前
vscode python-u问题
开发语言·vscode·python
进击的横打18 小时前
【车载开发系列】Renesas Flash Programmer (RFP) 反向读取功能
车载系统·编辑器·rfp
ChenYY~20 小时前
手把手教你使用vscode开发stm32!
vscode·stm32·嵌入式·软件开发·学习经验
_codemonster1 天前
JavaWeb开发系列(九)idea配置jdbc
java·ide·intellij-idea
山峰哥1 天前
数据库工程中的SQL调优实践:从索引策略到查询优化的深度探索
服务器·数据库·sql·性能优化·编辑器
闪电橘子1 天前
Pycharm运行程序报错 Process finished with exit code -1066598273 (0xC06D007F)
ide·python·pycharm·cuda