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风格即可。(记得保存哟)

相关推荐
weixin_423533991 天前
【Windows11离线安装anaconda、python、vscode】
开发语言·vscode·python
爱分享的阿Q1 天前
STM32现代化AI开发环境搭建:从Keil到VSCode+AI的范式转移
人工智能·vscode·stm32
追风20191 天前
PowerShell 7 解决 Codex 中文乱码:完整经验总结(VsCode 背景)
ide·vscode·编辑器
Curtain_Gin1 天前
windows vim 配置
linux·编辑器·vim
帅小柏1 天前
VSCode Remote SSH 一直转圈连不上服务器?踩坑全记录
服务器·vscode
H Journey1 天前
VSCode下CMake使用
vscode·cmake
9分钟带帽1 天前
vscode中配置Qt6和CMake的开发环境
c++·vscode·cmake
qq_427506081 天前
vscode使用claude code的简单经验分享(一)
ide·vscode·ai
宁静致远20211 天前
Mermaid VSCode插件制作流程图保存方法
ide·vscode·流程图
编程大师哥1 天前
VSCode中如何搭建JAVA+MAVEN
java·vscode·maven