{ // ====== 1. 编辑器通用设置 ====== "editor.fontSize": 14, // 字体大小 "editor.lineHeight": 24, // 行高,让代码不那么紧凑 "editor.tabSize": 2, // Tab 键的宽度为 2 个空格 "editor.insertSpaces": true, // 敲 Tab 键时插入空格而不是制表符 "editor.detectIndentation": false, // 关闭自动检测缩进,强制使用 tabSize "editor.renderWhitespace": "none", // 不显示空白字符('all'/'boundary'/'none') "editor.minimap.enabled": false, // 显示代码小地图 "editor.wordWrap": "off", // 不自动换行,让 Prettier 处理 "editor.cursorSmoothCaretAnimation": "on", // 光标动画更平滑 "editor.smoothScrolling": true, // 滚动平滑 // ====== 2. 格式化设置 (Prettier) ====== "editor.defaultFormatter": "esbenp.prettier-vscode", // 设置默认格式化程序为 Prettier "editor.formatOnSave": true, // 保存时自动格式化 "editor.formatOnPaste": false, // 粘贴时是否格式化,通常设置为 false 避免干扰 "editor.formatOnType": false, // 输入时是否格式化,通常设置为 false 避免干扰 // ====== 3. Prettier 插件的特定配置 ====== // 这些配置会覆盖 .prettierrc 中的同名配置,如果项目有 .prettierrc,建议在 .prettierrc 中配置 "prettier.printWidth": 100, // 单行代码的最大长度(超过会换行) "prettier.tabWidth": 2, // 缩进宽度为 2 个空格 "prettier.useTabs": false, // 不使用 Tab 字符缩进,使用空格 "prettier.singleQuote": true, // 使用单引号代替双引号 "prettier.semi": false, // 不在语句末尾添加分号 "prettier.trailingComma": "es5", // 在多行对象、数组等末尾添加逗号(如在 ES5 中有效) "prettier.bracketSpacing": true, // 在对象字面量的大括号之间添加空格 "prettier.jsxBracketSameLine": false, // JSX 元素的右括号是否和属性在同一行 "prettier.arrowParens": "avoid", // 箭头函数只有一个参数时省略括号 (e.g., x => x 而不是 (x) => x) "prettier.endOfLine": "lf", // 统一行尾序列为 LF (Linux Line Feed) "prettier.vueIndentScriptAndStyle": true, // Vue 文件中