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" // 调用已配置的代码片段,这里是代码片段里定义的值
                }
            }
        ]
    }
}
相关推荐
摇滚侠3 小时前
IDEA 生成 try catch 快捷键
java·ide·intellij-idea
Tiger Z4 小时前
Positron 教程1 --- 用户界面
ide·编程·positron
Cloud_Shy6184 小时前
Python 数据分析基础入门:《Excel Python:飞速搞定数据分析与处理》学习笔记系列(附录 B 高级 VS Code 功能)
vscode·python·jupyter·数据分析·excel
SWAGGY..7 小时前
Linux系统编程:(五)基础开发工具:vim编辑器的使用及其配置操作
linux·编辑器·vim
唐璜Taro9 小时前
VSCode接入小米mimo大模型
ide·vscode·编辑器
古怪今人10 小时前
Android Studio的安装及配置 创建项目编译、运行、调试、打包安装包
android·ide·android studio
modelmd10 小时前
vim入门使用手册
编辑器·vim
2501_9160088911 小时前
ChatGPT前端开发学习指南:Visual Studio Code与谷歌浏览器安装配置详解
ide·vscode·ios·小程序·uni-app·编辑器·iphone
TE-茶叶蛋11 小时前
JetBrains IDE(如 IntelliJ IDEA)的 Git 面板
ide·git·intellij-idea
视觉小萌新12 小时前
Ubuntu-Liunx下进行Vscode的C++编程——hello world_x64版本
ide·vscode·编辑器