Files
scaffold/template/.vscode/settings.json.jinja
T
baozaotumao 4a25ab3049 feat: 模板自带 .vscode/settings.json + extensions.json(编辑器实时护栏)
- settings.json:formatOnSave + ruff(保存修复/整理import) + eslint onType;
  Pylance basic 即时反馈,权威 strict 交 mypy 扩展读 pyproject,与 pre-commit 同源
- extensions.json:按服务推荐 ruff/pylance/mypy/eslint/prettier 扩展
- 始终生成(不挂 vscode_auto_watch 开关),按 include_backend/agent/frontend 裁剪
- 测试覆盖 全栈/仅后端/仅前端 三配置,条件填充正确、JSON 合法
2026-06-01 21:49:51 -07:00

34 lines
1.4 KiB
Django/Jinja
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 由 scaffold 生成:编辑器实时护栏(第 1 层)。
// 规则单一来源——ruff/mypy 读 pyproject.tomleslint/prettier 读各自配置;
// 本文件只把编辑器指向同一套配置,不另设规则,避免与 pre-commit 漂移。
{
"editor.formatOnSave": true,
{%- if include_backend or include_agent %}
// Pythonruff 做 lint+format(保存自动修复 + 整理 import)
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.codeActionsOnSave": {
"source.fixAll.ruff": "explicit",
"source.organizeImports.ruff": "explicit"
}
},
// Pylance 走 basic(边打字即时反馈、噪声低);
// 权威 strict 类型检查交给 mypy 扩展,按 pyproject 的 [tool.mypy] 跑,与 pre-commit 一致
"python.analysis.typeCheckingMode": "basic",
"mypy-type-checker.importStrategy": "fromEnvironment",
{%- endif %}
{%- if include_frontend %}
// 前端:prettier 格式化 + eslint 实时(边打字边查)
"[typescript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
"[typescriptreact]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
"eslint.run": "onType",
"eslint.workingDirectories": [{ "directory": "frontend", "changeProcessCWD": true }],
{%- endif %}
"files.eol": "\n",
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true
}