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" // 调用已配置的代码片段,这里是代码片段里定义的值
                }
            }
        ]
    }
}
相关推荐
超级大福宝1 天前
VS Code Remote-SSH 因 RemoteForward 端口冲突导致连接失败的排查与解决
运维·服务器·windows·vscode·ssh
MandalaO_O2 天前
IDEA 开发(快捷键 + 调试 + 序列化)
java·ide·intellij-idea
golang学习记2 天前
VSCode AI完成任务的仪式感:撒礼花
ide·vscode·编辑器
菜_小_白3 天前
codex
linux·vscode·ai
1024奇点3 天前
【仓颉语言入门 · 第26课】
开发语言·ide·开源
cuijiecheng20183 天前
Codex VS Code 插件新版卡住、界面异常:通过降级插件版本解决
vscode
golang学习记4 天前
VSCode AI新特性:HydraFusion来了:系统会自己组队干活
ide·人工智能·vscode
文祐4 天前
下载Visual Studio 2017 Build Tools version 15.9
ide·visual studio
golang学习记4 天前
Jetbrains 正式官宣:全新AI IDE正式发布!
ide·人工智能·intellij-idea·air
mklpo1474 天前
在win7 sp1 系统上安装最新版 的 Visual Studio Code。2026-10-04
ide·vscode·编辑器