在前端開(kāi)發(fā)中,有一個(gè)非常好用的工具,Visual Studio Code,簡(jiǎn)稱VS code。都不用我安利VS code,大家就會(huì)乖乖的去用,無(wú)數(shù)個(gè)大言不慚的攻城獅,都被VS code比德芙還絲滑的強(qiáng)大功能所折服。
現(xiàn)在使用Vscode編碼的人越來(lái)越多,憑借著免費(fèi),開(kāi)源,輕量,跨平臺(tái)的特點(diǎn)收貨了一大批忠實(shí)粉絲 最近因項(xiàng)目需要開(kāi)始使用Vscode,因此做了一番研究,現(xiàn)在把個(gè)人的一些小經(jīng)驗(yàn)分享給大家,首先我們來(lái)看看setings.json配置
{
"window.zoomLevel": 1,
"vetur.format.defaultFormatter.html": "js-beautify-html",
"editor.quickSuggestions": {
"strings": true
},
"fileheader.customMade": { //此為頭部注釋
"Description": "",
"Autor": "wangDuJuan",
"Date": "Do not edit"
// "LastEditors": "liujun",
// "LastEditTime": "Do not edit"
},
"fileheader.cursorMode": { //此為函數(shù)注釋
"description": "",
"param": "",
"return": "",
"author": "wangDuJuan"
},
// 保存時(shí)自動(dòng)格式化
"eslint.autoFixOnSave": true,
// 用來(lái)配置作用的文件類型
"eslint.validate": [
"javascript",
"javascriptreact",
{
"language": "html",
"autoFix": true
},
{
"language": "vue",
"autoFix": true
}
],
"beautify.config": {
"indent_size": 4, //縮進(jìn)大小,默認(rèn)4
"indent_char": " ", //縮進(jìn)字符,默認(rèn)" "
"css": {
"indent_size": 2
},
"eol": "n", //end of line,行結(jié)尾字符"n"
"indent_level": 0, //初始縮進(jìn)級(jí)別
"indent_with_tabs": false, //使用tab縮進(jìn),將會(huì)覆蓋“indent_size”和“indent_char”設(shè)置,默認(rèn)false
"preserve_newlines": true, //保留空行,默認(rèn)“true”
"max_preserve_newlines": 10, //一次最多保留多少行的空行,默認(rèn)10
"jslint_happy": false, //開(kāi)啟jslint-stricter的嚴(yán)格模式(強(qiáng)制開(kāi)啟“space_after_anon_function”選項(xiàng)),默認(rèn)false
"space_after_anon_function": false, //在匿名函數(shù)前自動(dòng)加一個(gè)空格,比如function (){},默認(rèn)false
"brace_style": "collapse,preserve-inline", //括號(hào)風(fēng)格,"collapse-preserve-inline", "collapse", "expand", "end-expand", or "none" ,默認(rèn)“collapse”
"keep_array_indentation": false, //保持?jǐn)?shù)組縮進(jìn),默認(rèn)false
"keep_function_indentation": false, //保持函數(shù)縮進(jìn),默認(rèn)false
"space_before_conditional": true, //在條件語(yǔ)句之前保留一個(gè)空格,默認(rèn)true
"break_chained_methods": false, //中斷多行間的鏈?zhǔn)椒椒ㄕ{(diào)用,默認(rèn)true
"eval_code": false,
"unescape_strings": false, //解碼用xNN編碼的可打印字符,默認(rèn)false
"wrap_line_length": 0, //Wrap lines at next opportunity after N characters. (Set zero to ignore wrapping),默認(rèn)0,下次在n個(gè)字符后換行
"wrap_attributes": "auto", //將html屬性標(biāo)簽放在新行“auto”,“force”,默認(rèn)auto
"wrap_attributes_indent_size": 4, //html屬性標(biāo)簽新行縮進(jìn)字符數(shù),默認(rèn)為"indent_size"4
"end_with_newline": false //在文件結(jié)尾保證有換行,默認(rèn)false
},
"beautify.language": {
"js": {
"type": [
"javascript",
"json",
"typescript"
],
"filename": [
".jshintrc",
".jsbeautify"
]
},
"css": [
"css",
"scss",
"sass"
],
"html": [
"htm",
"html",
"vue"
]
},
"[scss]": {
},
"[typescript]": {
},
"workbench.iconTheme": "vscode-icons",
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"[vue]": {
"editor.defaultFormatter": "HookyQR.beautify"
}
}