改 settings.json 反而更卡,主因是错误开启自动检查或监听;需配置 files.watcherexclude、禁用 typescript.autoimports、慎用 editor.suggest.snippetspreventquicksuggestions;缩进须与 eslint 对齐,禁用 editor.detectindentation;eslint/prettier/gitlens 等插件设置必须写入 json 才生效。

别复制别人的 settings.json —— 大部分人直接粘贴后反而更卡、更乱、更难排查问题。
为什么改了 settings.json 越配越慢?
VS Code 启动和文件响应变慢,90% 是因为开了不该开的自动检查或监听。比如 "files.watcherExclude" 没配,它就会在 node_modules 里逐个 stat 文件;又比如 "editor.quickSuggestions" 对所有语言都开,TypeScript 服务一加载就卡住。
-
"files.watcherExclude"必须包含"**/node_modules/**"、"**/.git/**",否则监听器吃满 CPU -
"typescript.preferences.includePackageJsonAutoImports"设为"auto"会触发频繁的依赖分析,新手建议关成"off" - 禁用
"editor.suggest.snippetsPreventQuickSuggestions"看似能多出提示,实则让 JavaScript/TS 的智能感知延迟翻倍
editor.tabSize 和 editor.insertSpaces 怎么设才不踩 Git 冲突?
团队协作时,缩进配置错位是隐形冲突源。不是“统一设 2 就行”,要看项目真实代码风格和 ESLint 配置是否对齐。
- 先运行
npx eslint --print-config .eslintrc.js | grep -i indent查 ESLint 实际要求的缩进规则 - 如果 ESLint 用
indent: ["error", 2],则必须配"editor.tabSize": 2+"editor.insertSpaces": true - 切忌在
settings.json里写"editor.detectIndentation": true—— 它会在打开每个文件时重读缩进,导致光标跳动、格式错乱
哪些插件的设置必须写进 settings.json 才生效?
很多插件(比如 ESLint、Prettier、GitLens)只认 workspace 或 user 级的 JSON 配置,UI 里点开关根本不起作用。
-
eslint.enable必须显式设为true,否则即使装了插件也不校验 -
prettier.requireConfig建议设为true,避免它用默认规则覆盖项目里的.prettierrc -
gitlens.advanced.messages设为{"suppressShowKeyBindingsNotice": true},不然每次重启都弹烦人的快捷键提示
真正关键的不是“配得多”,而是哪几项改了会影响语言服务启动、文件监听、格式化链路。一个没配对的 files.associations 就能让 Vue 文件失去 TypeScript 支持,而你可能还在调 vetur 的配置。











