当前位置:网站首页>vscode配置用户代码片段(包括删除方法)
vscode配置用户代码片段(包括删除方法)
2022-07-24 13:07:00 【godlike-icy】
一.配置用户代码片段
1.打开vscode,左下角设置图标:

2.点击新建全局代码片段
3.起一个名字,可以随意,不过最好是能明确表达这个是全局snippets,所以我的叫global。
4.然后来到配置界面
{
// Place your 全局 snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. 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": {
// "scope": "javascript,typescript",
// "prefix": "log",
// "body": [
// "console.log('$1');",
// "$2"
// ],
// "description": "Log output to console"
// }
"箭头函数": {
//这个是快捷方式的名字,比如你输入rr再按tab就会显示出body中设置的内容
"prefix": "rr",
//这里设置代码片段,格式如下,中间的$用途表示光标会在创建出来移动到此处
// $1 $2 $3 表示顺序,按tab后会跳到相应位置
"body": [
"const $1 =($2) =>{ ",
"$3",
"}"
],
"description": "创建箭头函数的快捷方式"
},
"双花括号": {
"prefix": "sk",
"body": [
"{
{ $1 }} ",
],
"description": "创建双花括号的快捷方式"
}
}
5 . 你可以配置自己喜欢的代码片段进行高效开发,这个完全自由。
二.删除用户代码片段
需要手动删除,因为这个文件在你电脑上。(至于默认路径我就不贴了,因为mac和windows路径各不相同),但都有以下通用的快捷方法。
一般情况下,在vscode上方可以看到配置文件路径,如下图。
如果没有显示的,记得在vscode最上面找到查看。

把显示导航痕迹给勾选上,就能知道路径啦。
但是,有个快捷方法,可以让你不需要知道路径也能在资源管理器中找到它。
vscode打开需要删除的snippets文件,在文件名上右键。
mac选择在finder(访达中显示),windows选择在文件资源管理器中打开,就能快速定位到该文件,然后删除即可。
最后,有帮助就点个赞吧。
边栏推荐
- [C language] detailed knowledge of document operation
- Custom scroll bar
- Is there any potential safety hazard for Xiaobai to open an account with Guotai Junan?
- Proxy
- Where+or usage of SQL missing condition
- SSM医院住院管理系统
- Teach you how to use power Bi to realize four kinds of visual charts
- 自己实现is_default_constructible
- 开山之作造假!Science大曝Nature重磅论文学术不端,恐误导全球16年
- Cluster construction based on kubernetes v1.24.0 (III)
猜你喜欢

26. Reverse linked list II

Leetcode's 302 weekly rematch

Promise

27. Longest increasing subsequence

Wang Ping, co-founder of Denglin Technology: Innovation + self research "dual core" drive, gpu+ enabling AI takes root | quantum bit · viewpoint sharing review

2022.07.21

No routines, no traps, no advertisements | are you sure you don't need this free instant messaging software?
![[datasheet] interpretation of phy lan8720 network chip](/img/77/b99c926db2c99df32cecb188c1f1e1.png)
[datasheet] interpretation of phy lan8720 network chip

Step of product switching to domestic chips, stm32f4 switching to gd32

ESP32ADC
随机推荐
Voice recognition based on MATLAB
Introduction to the use of thread (2) thread
25. Middle order traversal of binary tree
元宇宙更多的功能和作用在于对于传统生活方式和生产方式的深度改造
class
Get the current month and year and the previous 11 months
基于Kubernetes v1.24.0的集群搭建(二)
使用Jenkins搭建CI服务器
36. Delete the penultimate node of the linked list
28. Rainwater connection
Step of product switching to domestic chips, stm32f4 switching to gd32
猿人学第七题
基于Kubernetes v1.24.0的集群搭建(一)
How to draw Bezier curve and spline curve?
SSM online campus album management platform
Raspberry pie self built NAS cloud disk -- raspberry pie built network storage disk
Relevant laws of animation movement (judge where to move according to parameters)
IUAP spring training data in 2022, Zhongtai training report
【C语言】详细的文件操作相关知识
24. Merge K ascending linked lists