文章目录
- 1. 全局配置
- 2. 格式化单引
1. 全局配置
ctrl+shirt+p
搜索settings.json替换为下面内容即可
{"vetur.ignoreProjectWarning": true,//配置Vetur插件,忽略提示// 在方法括号之间插入空格"javascript.format.insertSpaceBeforeFunctionParenthesis": true,"editor.tabSize": 2,//指定一个tab等于多少个空格,例如此处指定4就像等于4个空格,2就等于两个空格"editor.detectIndentation": false, //必须指定!!否则指定的tab大小将不起效果"editor.formatOnSave": true,// 每次保存的时候自动格式化"editor.formatOnType": true, // 每次保存的时候自动格式化"editor.codeActionsOnSave": { // #每次保存的时候将代码按eslint格式进行修复"source.fixAll.eslint": true},"workbench.iconTheme": "vscode-icons", //图标主题"vsicons.dontShowNewVersionMessage": true,//不显示新版本提示信息"editor.fontSize": 18,//字体大小// -------------------------Operator Mono字体设置 Start-----------------------------------"editor.fontFamily": "Operator Mono","editor.fontLigatures": true, // 这个控制是否启用字体连字,true启用,false不启用,这里选择启用"editor.tokenColorCustomizations": {"textMateRules": [{"name": "italic font","scope": ["comment","keyword","storage","keyword.control.import","keyword.control.default","keyword.control.from","keyword.operator.new","keyword.control.export","keyword.control.flow","storage.type.class","storage.type.function","storage.type","storage.type.class","variable.language","variable.language.super","variable.language.this","meta.class","meta.var.expr","constant.language.null","support.type.primitive","entity.name.method.js","entity.other.attribute-name","punctuation.definition.comment","text.html.basic entity.other.attribute-name.html","text.html.basic entity.other.attribute-name","tag.decorator.js entity.name.tag.js","tag.decorator.js punctuation.definition.tag.js","source.js constant.other.object.key.js string.unquoted.label.js",],"settings": {"fontStyle": "italic",}},]},"[vue]": {"editor.defaultFormatter": "esbenp.prettier-vscode"},"tabnine.experimentalAutoImports": true,"editor.quickSuggestions": {"strings": true}// -------------------------Operator Mono字体设置 End-----------------------------------}
2. 格式化单引
双引号统一格式化为单引号
在项目根目录新建.prettierrc.json
或者.prettierrc
文件
{"singleQuote": true, //使用单引号, 默认false(在jsx中配置无效, 默认都是双引号)"semi": false // 是否使用分号, 默认true}