VsCode快速打出console.log()方法设置

一、背景

作为一名前端开发,console.log是一个使用频率极高的调试功能,接下来让我们看看如何快速的打出console.log()。

二、VsCode设置

1、找到文件 > 首选项 > 配置代码片段;
2、输入javascript.json,并点击提示;

先在弹出的输入框内填入javascript.json,选择提示进而跳转相应页面。

如果是用React框架,就选择javascriptreact.json进行配置,博主这里以javascriptreact.json举例,其他类似:

XML 复制代码
{
	// Place your snippets for javascriptreact here. Each snippet is defined under a snippet name and has a prefix, body and 
	// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
	// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the 
	// same ids are connected.
	// Example:
	"Print to console": {
		"prefix": "log",//这里配置快速打印console.log的字母,例如:输入log,实现手动console.log效果
		"body": [
			"console.log('$1');",
			"$2"
		],
		"description": "Log output to console"
	}
}
3.修改prefix为你喜欢的打出console.log()风格,我自己设置的是log;

如果你的Print to console被注释了,直接解除注释,修改prefix中的值为你喜欢的console.log风格即可。(记得保存哟)

相关推荐
阿关@7 小时前
Vscode中Python无法将pip/pytest”项识别为 cmdlet、函数、脚本文件或可运行程序的名称
vscode·python·pip
nnsix8 小时前
Unity XR 编辑器VR设备模拟功能
unity·编辑器·xr
前端小臻8 小时前
分享一个vscode的todo插件(todo Tree 包含使用
ide·vscode·编辑器
失眠的树亚8 小时前
vscode连接阿里云ECS服务器
服务器·vscode·阿里云
[J] 一坚8 小时前
实用shell脚本学习分享一
linux·运维·编辑器
YoungHong19928 小时前
把Google Antigravity(或任何基于VS Code开源构建的编辑器)的插件市场切换为微软官方市场
microsoft·编辑器
联系QQ 180809518 小时前
基于Modbus的电机控制上位机程序——用Qt打造高效控制界面
vscode
韩曙亮9 小时前
【VSCode】设置中文、多标签设置 ( 设置显示语言 | 批量打开标签 | 标签栏切换 )
ide·vscode·编辑器·开发工具
Teln_小凯9 小时前
解决VSCode 安装PlatformIO后,第一次创建项目很慢的问题
ide·vscode·编辑器