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" // 调用已配置的代码片段,这里是代码片段里定义的值
                }
            }
        ]
    }
}
相关推荐
oooost19 小时前
Jupyter Notebook 常用快捷键速查
ide·python·jupyter
承渊政道1 天前
Linux系统学习【线程概念与控制核心知识详解】
linux·运维·vscode·学习·ubuntu·线程创建 终止 等待
yqj2341 天前
ESP32-S3中小智项目优化内容
ide·macos·xcode
阿斌.com1 天前
Visual Studio 2026安装全攻略
ide·visual studio
我要神龙摆尾2 天前
IDEA 阅读插件
java·ide·intellij-idea·idea-plugs·plugs
梦幻通灵2 天前
IDEA 实用快捷键【持续更新】
java·ide·intellij-idea
星辰徐哥2 天前
鸿蒙平台 KDevelop 集成开发环境适配实战:基于 Electron 壳方案的跨平台多语言代码编辑器开发
electron·编辑器·harmonyos
风华同学3 天前
vscode远程连接
ide·vscode·编辑器
sunoo-2293 天前
【嵌入式 ARM 学习第十二天】SPI 裸机驱动 + I2C 触摸屏驱动 + 三大串行协议深度对比
arm开发·笔记·vscode·学习·imx6ull
kiss strong3 天前
idea显示前进后退按钮
java·ide·intellij-idea