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" // 调用已配置的代码片段,这里是代码片段里定义的值
                }
            }
        ]
    }
}
相关推荐
面壁的熊猫31 分钟前
cursor+cline+MCP(论文agent)
vscode·agent·cursor·mcp
bulucc2 小时前
vim 快捷操作
linux·编辑器·vim
Aspect of twilight4 小时前
vscode python debug方式
ide·vscode·python·debug
Aevget4 小时前
.NET跨平台开发工具Rider v2025.3发布——支持.NET 10
ide·.net·开发工具·rider·rider v2025.3
啃火龙果的兔子5 小时前
vscode中可以使用的免费的AI编程工具有哪些
ide·vscode·ai编程
littlezls6 小时前
在VSCode中运行Python脚本文件时如何传参
vscode·python
宋明炜7 小时前
VSCode + MSYS2 配置 C 语言开发环境(详细步骤)
c语言·ide·vscode
yscript7 小时前
GPU分配BUG: Duplicate GPU detected : rank 1 and rank 0 both on CUDA device d5000
linux·运维·服务器·vscode·bug
超超~~7 小时前
Notepad(文本编辑器)v3.6.30绿色官方版
编辑器·notepad++
shhpeng8 小时前
Visual Studio Code 下 go 开发环境搭建
ide·vscode·编辑器