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" // 调用已配置的代码片段,这里是代码片段里定义的值
                }
            }
        ]
    }
}
相关推荐
golang学习记2 小时前
Google Antigravity AI IDE 官方教程文档来了!
ide
Test-Sunny8 小时前
使用编辑器时,富文本编辑器与MD编辑器存在哪些差异
编辑器
QDKuz8 小时前
VScode切换远程分支,超简单方法
ide·vscode·编辑器
BD_Marathon8 小时前
【IDEA】常用快捷键【上】
java·ide·intellij-idea
BD_Marathon8 小时前
【IDEA】工程与模块的管理
java·ide·intellij-idea
( ˶˙⚇˙˶ )୨⚑︎9 小时前
借助GitHub进行团队协作小组作业
大数据·vscode·github
BD_Marathon9 小时前
【IDEA】常用插件——1
java·ide·intellij-idea
肖永威10 小时前
VSCode调试Python命令行输入参数程序argparse模块实践
vscode·python
8***293110 小时前
Go环境搭建(vscode调试)
开发语言·vscode·golang
不知所云,12 小时前
4. vscode c++ 环境及工程搭建 clangd + mingw
c++·ide·vscode·开发环境·clangd