[英]How to edit Visual Studio Code auto-complete in JavaScript?
I was coding on JavaScript when my instructor, Andrew J. Mead (I actually learn JS from Udemy) were telling about try and catch .我在 JavaScript 上编码时,我的导师Andrew J. Mead (我实际上是从 Udemy 学习 JS)正在讲述try 和 catch 。 I type slowly so I often use auto-complete given by VS Code.我打字很慢,所以我经常使用 VS Code 提供的自动完成功能。 Anyway, I wrote try and in auto-complete it gave me trycatch .无论如何,我写了try并在自动完成中给了我trycatch 。 I clicked on it and it gave me this我点击它,它给了我这个
try {
} catch (error) {
}
I want the error to be e like catch(e) , not catch(error) .我希望错误是e像catch(e) ,而不是catch(error) 。 Is there any way that I can edit VS Code's auto-complete?有什么方法可以编辑 VS Code 的自动完成功能吗?
Screenshots given给出的截图
Thanks recently for the support感谢最近的支持
You can create custom snippet for VS Code您可以为 VS Code 创建自定义代码段
For do this, you need:为此,您需要:
{... "My Try-Catch block": { "prefix": "trycatch", "body": [ "try {", "\t$0", "} catch (e) {", "\t", "}", ], "description": "Paste try-catch with e" } }
Your snippet will be up than standard in autocomplete您的代码段将超过自动完成的标准
Or you can edit default snippets located at:或者您可以编辑位于以下位置的默认片段:
%localappdata%\Programs\Microsoft VS Code\resources\app\extensions\javascript\snippets
In javascript.code-snippets
file在javascript.code-snippets
文件中
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.