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 標準庫位置