vscode 标准库位置
I use Visual Studio Code as my text editor. When I write JavaScript, I follow JavaScript Standard Style.There's an easy way to integrate Standard in VS Code—with the vscode-standardjs plugin. I made a video for this some time ago if you're interested in setting it up.But, if you follow the instructions in the video (or on vscode-standardjs's readme file), you'll come to notice there's one small detail that needs to be ironed out.Try writing a function
the old way, and save it repeatedly. VS code will toggle between having and not having a space before the left-parenthesis of the function.
我使用Visual Studio Code作为文本编辑器。 在编写JavaScript时,我遵循的是JavaScript标准样式 。有一种简单的方法可以将vs 标准-js插件与VS Code集成。 如果您有兴趣设置视频 ,我前段时间制作了一个视频 。但是,如果您按照视频(或vscode-standardjs的自述文件)中的说明进行操作,您会发现其中有一个小细节需要解决的问题。尝试以旧方式编写function
,然后重复保存。 VS代码将在函数左括号前是否有空格之间切换。
You get the same problem when you write methods with the ES6 method shorthands:
使用ES6方法速记编写方法时,您会遇到相同的问题:
There's a quick way to fix this issue. What you need to do is set javascript.format.enable
to false
. This disables VS Code's default Javascript formatter (and lets vscode-standandjs does the formatting work).
有一种快速解决此问题的方法。 您需要将javascript.format.enable
设置为false
。 这将禁用VS Code的默认Javascript格式化程序(并让vscode-standandjs进行格式化工作)。
So the minimum configuration you need to get Standard and VS Code to work together is:
因此,使Standard和VS Code协同工作所需的最低配置为:
{// Prevents VS Code from formatting JavaScript with the default linter"javascript.format.enable": false,// Prevents VS Code linting JavaScript with the default linter"javascript.validate.enable": false,// Lints with Standard JS"standard.enable": true,// Format files with Standard whenever you save the file"standard.autoFixOnSave": true,// Files to validate with Standard JS"standard.validate": ["javascript","javascriptreact"]
}
This article was originally posted on my blog.Sign up for my newsletter if you want more articles to help you become a better frontend developer.
本文最初发布在我的博客上 。 如果您想获得更多文章来帮助您成为更好的前端开发人员,请注册我的时事通讯 。
翻译自: https://www.freecodecamp.org/news/https-zellwk-com-blog-standard-with-vscode/
vscode 标准库位置