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" // 调用已配置的代码片段,这里是代码片段里定义的值
                }
            }
        ]
    }
}
相关推荐
阿桂有点桂29 分钟前
C#使用VS软件打包msi安装包
windows·vscode·c#
baidu_172012534 小时前
在Visual Studio中安装通义灵码
ide·visual studio
foxsen_xia6 小时前
Go安装、配置和vsCode配置Go
开发语言·vscode·golang
黎相思8 小时前
环境搭建
ide
晨同学03278 小时前
【亲测可行】windows安装visual studio & opencv4.10.0
ide·windows·visual studio
PWRJOY8 小时前
Android Studio中安卓模拟器打不开,报错The emulator process for AVD has terminated
android·ide·android studio
金融小师妹8 小时前
基于LSTM趋势预测的白银价格突破58美元阈值,年度累计涨幅超100%的强化学习驱动分析
大数据·人工智能·编辑器·1024程序员节
UVM_ERROR12 小时前
硅农VSCode 插件推荐
vscode·centos·ssh
BD_Marathon13 小时前
【IDEA】IDEA的详细设置
java·ide·intellij-idea
x***440113 小时前
vscode配置django环境并创建django项目(全图文操作)
vscode·django·sqlite