Skip to content

VsCode配置 简单

字数统计:237 字
阅读时长:1 分钟

为了能够获得一致的开发体验,建议进行如下配置

  • 补全GsCore函数的代码提示, 请在python.autoComplete.extraPathspython.analysis.extraPaths位置填入合适的路径

  • GsCore目前使用black进行格式化代码

  • GsCore目前使用isort进行自动排序导入库

  • GsCore目前使用autoDocstring插件进行自动文档生成

  • 其他项可参考.pre-commit-config.yaml文件,插件开发也可加入pre-commit代码检查

以下为一份VsCode的settings.json配置,仅供参考

json
{
  "python.languageServer": "Pylance",
  "python.analysis.typeCheckingMode": "basic",
  "cSpell.words": [
    "enka",
    "genshin",
    "genshinuid"
  ],
  "editor.formatOnSave": true,
  "[python]": {
    "editor.defaultFormatter": "ms-python.black-formatter",
    "editor.formatOnSave": true,
    "editor.codeActionsOnSave": {
      "source.organizeImports": true
    }
  },
  "python.autoComplete.extraPaths": [
    "${workspaceFolder}/../../../../"
  ],
  "isort.args": [
    "--profile",
    "black"
  ],
  "python.formatting.provider": "black",
  "python.linting.flake8Enabled": true,
  "python.linting.flake8CategorySeverity.W": "Warning",
  "python.linting.flake8CategorySeverity.F": "Warning",
  "python.linting.flake8CategorySeverity.E": "Warning",
  "python.analysis.extraPaths": [
    "${workspaceFolder}/../../../../"
  ],
  "python.analysis.include": [
    "${workspaceFolder}/../../../../"
  ]
}

GsCore还提供了一份gscore.mustache模板文件

需要在配置项Auto Docstring: Custom Template Path修改模板文件的路径