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" // 调用已配置的代码片段,这里是代码片段里定义的值
                }
            }
        ]
    }
}
相关推荐
HUST1 天前
C 语言 第七讲:数组和函数实践:扫雷游戏
c语言·开发语言·数据结构·vscode·算法·游戏·c#
冰箱上的笑话1 天前
Neovim 中文输入深度优化指南
macos·编辑器·vim·lazyvim
yqj2341 天前
hbuilderx
编辑器
spencer_tseng1 天前
Eclipse HeapDump
java·ide·eclipse
yao000371 天前
LLVM是什么 之 我与AI的思想碰撞
编辑器·gnu·clang·gcc·llvm
星源~1 天前
VsCode-单片机开发环境配置指定编译器
ide·vscode·单片机·物联网·嵌入式
yangshuo12811 天前
心灵宝石MCP部署完全指南:AI IDE积分零损耗的实现方案
ide·人工智能·microsoft
TonyLee0171 天前
vscode运行Julia项目(linux远程服务器)
vscode·julia
纪伊路上盛名在1 天前
vscode的colab扩展目前的一些问题
ide·vscode·python·编辑器·colab·前后端
Java后端的Ai之路1 天前
【AI编程工具】-Trae IDE+AutoDL 运行本地项目完整实操
ide·ssh·ai编程·autodl·trae