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

相关推荐
Sunny_GMF1 小时前
Markdown 导出 HTML 实战:2.6MB 编辑器快照如何瘦身 71%(DOM 净化 + CSSOM 运行时裁剪)
编辑器·html·ai编程·harmonyos
灯澜忆梦2 小时前
【Linux】#7 | vi/vim 编辑器
linux·编辑器·vim
程序员龙一2 小时前
VsCode+ClaudeCode+Deepseek的配置
vscode·claude·deepseek·vibecoding
广东帝工3 小时前
智慧航道核心价值对航运业发展的具体影响
编辑器
广东帝工4 小时前
智慧航道从“经验调度“到“智能协同“
编辑器
cgblpx1 天前
vscode的安装
ide·vscode·编辑器
golang学习记2 天前
Zed 新特性:AI 还在跑,电脑可以不睡了
人工智能·vscode·电脑·zed
zpjing~.~2 天前
Vim 高效批量替换实战:从 /dev/ 替换为 /dev-ai/
人工智能·编辑器·vim
瑶山2 天前
Windows + WSL2 Ubuntu + VS Code配置C++开发环境
开发语言·c++·windows·vscode·wsl
苏辰澈2 天前
C++独属于自己的变身:多态
c语言·开发语言·c++·visualstudio·编辑器