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" // 调用已配置的代码片段,这里是代码片段里定义的值
                }
            }
        ]
    }
}
相关推荐
Master_清欢14 小时前
jupyter新增行数
ide·python·jupyter
wzfj1234515 小时前
vscode通过remote-ssh快速浏览远程pc的文件
vscode
ayaya_mana18 小时前
VS Code 远程开发:SSH连接与远程资源管理器的配置
linux·ide·windows·vscode·远程资源管理
spencer_tseng18 小时前
eclipse ALT+SHIFT+A
java·ide·eclipse
stevenzqzq19 小时前
Android Studio 断点调试核心技巧总结
android·ide·android studio
吞掉星星的鲸鱼19 小时前
VScode安装codex
ide·vscode·编辑器
claider19 小时前
Vim User Manual 阅读笔记 User_03.txt move around
笔记·编辑器·vim
范什么特西20 小时前
下载idea旧版本
java·ide·intellij-idea
啊湘20 小时前
VSCODE英文界面切换为中文(适用CURSOR等使用)
ide·vscode·编辑器·bug·cursor
jarreyer21 小时前
markdown转jupyter notebook记录
ide·python·jupyter