- 编辑器 vscode (必装插件:ESLint、Prettier、Vetur、koroFileHeader、GitLens)
{
"workbench.iconTheme": "material-icon-theme", // 图标主题
// -------------------- 配置eslint --------------------
//autoFixedOnSave 设置已废弃,采用如下新的设置,新版(>1.41.0)配置
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"eslint.format.enable": true,
//autoFix默认开启,只需输入字符串数组即可
"eslint.validate": ["javascript", "vue", "html", "javascriptreact", "vue-html"],
// -------------------- 配置eslint --------------------
// 设置编辑器的默认格式化工具
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[css]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[less]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
// -------------------- vetur 配置 --------------------
// vue文件默认格式化工具:vetur
"[vue]": {
"editor.defaultFormatter": "octref.vetur"
},
// 这个按用户自身习惯选择
"vetur.format.defaultFormatter.html": "js-beautify-html",
// 让vue中的js按编辑器自带的ts格式进行格式化
// "vetur.format.defaultFormatter.js": "vscode-typescript",
// 让vue中的js按prettier进行格式化 用这个
"vetur.format.defaultFormatter.js": "prettier",
"vetur.validation.script": true,
"vetur.format.defaultFormatterOptions": {
"js": "prettier",
"js-beautify-html": {
"wrap_attributes": "aligned-multiple" //当超出折行长度时,将属性进行垂直对齐
},
"prettyhtml": {
"tabWidth": 2, // 会忽略vetur的tabSize配置
"printWidth": 140, //每行140字符
"singleQuote": true, //是否使用单引号
"semi": false, // 句尾是否加;
"wrapAttributes": false,
"sortAttributes": false
},
//vue中的js生效
"prettier": {
"semi": false, // 句尾是否加;
"singleQuote": true, //是否使用单引号
"trailingComma": "none" //禁止随时添加逗号
}
},
// -------------------- vetur 配置 ------------------------------
// -------------------- koro1FileHeader 配置 --------------------
// 头部注释
"fileheader.customMade": {
"Author": "AuthorName",
"Date": "Do not edit", // 文件创建时间(不变)
"LastEditors": "AuthorName", // 文件最后编辑者
"LastEditTime": "Do not edit", // 文件最后编辑时间
"Description": ""
// "FilePath": "only file name", // 只有文件名
// "custom_string_obkoro1_copyright": "Copyright (C) ${now_year} AuthorName. All rights reserved.",
// "custom_string_obkoro1_date": "Do not edit" // 不带Date前缀的时间
},
// 函数注释
"fileheader.cursorMode": {
"description": "",
//"custom_string_obkoro1": "",
"param": "params",
"return": ""
},
// 插件配置项
"fileheader.configObj": {
"createHeader": false, // 新建文件自动添加头部注释,默认打开
"autoAdd": false, // 保存自动添加头部注释,开启才能自动添加,默认开启
"openFunctionParamsCheck": true, //函数注释自动提取函数的参数,默认开启
"createFileTime": true, // 默认为此文件的创建时间,设为false更改为当前生成注释的时间
"dateFormat": "YYYY-MM-DD HH:mm:ss", // 默认时间格式,修改影响所有时间字段
// 自定义注释中的艾特和冒号:
"atSymbol": ["@", "@"], // 所有文件的头部注释和函数注释的默认值 @
"colon": [": ", ": "] // 所有文件的头部注释和函数注释的默认值 :
// 自定义特殊字段名,Date、LastEditTime、LastEditors、Description、FilePath
// "specialOptions": {
// "Date": "since",
// "LastEditTime": "lastTime",
// "LastEditors": "LastAuthor",
// "Description": "message",
// "FilePath": "文件相对于项目的路径"
// }
// 函数参数配置
// "functionParamsShape": "normal", // 正常
// "functionParamsShape": "no bracket", // 没有方括号
// "functionParamsShape": "no type", // 没有类型
// "functionParamsShape": [ "{", "}"], // 函数参数外形自定义,默认值 {}
// "functionTypeSymbol": "*", // 参数没有类型时的默认值 *
// 函数设置不添加参数和类型 {*}
// "functionParamsShape": "no type", // 没有类型
// "functionTypeSymbol": "" // 参数没有类型时的默认值 *
},
// -------------------- koro1FileHeader 配置 ---------------------------------
// -------------------- prettier 配置(以下配置主要针对.js) ---------------------
"prettier.useEditorConfig": false, // 不使用editorConfig配置文件设置才生效
"prettier.printWidth": 140, //每行140字符
"prettier.semi": false, // 句尾是否加;
"prettier.singleQuote": true, //是否使用单引号
"prettier.trailingComma": "none", //使用vscode建议开启
// -------------------- prettier 配置 -----------------------------------------
// -------------------- 个性化配置 -----------------------------------------
"editor.formatOnSave": true, //保存代码自动格式化,基准版必须打开,老项目不打开
"window.openFilesInNewWindow": "on", //新窗口打开文件
"window.openFoldersInNewWindow": "on", //新窗口打开文件夹
"git.autofetch": true,
"diffEditor.ignoreTrimWhitespace": false,
"files.associations": {
"/path to file/*.extension": "language"
"*.geojson": "json",
"*.cjson": "jsonc",
"*.wxss": "css",
"*.wxs": "javascript"
},
"editor.accessibilitySupport": "off",
"emmet.includeLanguages": {
"wxml": "html"
},
"minapp-vscode.disableAutoConfig": true,
"typescript.locale": "zh-CN",
"terminal.integrated.fontFamily": "monospace",
"git.path": "D:/Software/Git/bin/git.exe", //git路径
"explorer.confirmDelete": false,
"security.workspace.trust.untrustedFiles": "open",
"js/ts.implicitProjectConfig.checkJs": true,
"javascript.format.insertSpaceBeforeFunctionParenthesis": true
}