diff --git a/.gitattributes b/.gitattributes index f09f37b30..205396b4e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,3 +3,4 @@ tests/stubtest_allowlists/*.txt linguist-language=ini tests/pytype_exclude_list.txt linguist-language=ini pyrightconfig*.json linguist-language=jsonc +.vscode/*.json linguist-language=jsonc diff --git a/.gitignore b/.gitignore index cca2cf7b8..e3c7bee32 100644 --- a/.gitignore +++ b/.gitignore @@ -60,7 +60,9 @@ analyze.py # Editor backup files *~ .*.sw? -.vscode/ +.vscode/* +!.vscode/settings.default.json +!.vscode/extensions.json .idea/ .venv*/ diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 000000000..0d247ae06 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,35 @@ +// ⚠ Disclaimer: The typeshed team doesn't commit to maintaining this file. It exists purely for your ease of use. + +// Keep in alphabetical order +{ + "recommendations": [ + "bierner.github-markdown-preview", + "bungcip.better-toml", + "editorconfig.editorconfig", + "ms-python.black-formatter", + "ms-python.flake8", + "ms-python.isort", + "ms-python.python", + "ms-python.vscode-pylance", + "redhat.vscode-yaml", +], +"unwantedRecommendations": [ + /* + * Don't recommend by default for this workspace + */ + "christian-kohler.npm-intellisense", + /* + * Must disable in this workspace + * https://github.com/microsoft/vscode/issues/40239 + */ + // We use black + "ms-python.autopep8", + // Not using pylint + "ms-python.pylint", + // VSCode has implemented an optimized version + "coenraads.bracket-pair-colorizer", + "coenraads.bracket-pair-colorizer-2", + // Obsoleted by Pylance + "ms-pyright.pyright", + ], +} diff --git a/.vscode/settings.default.json b/.vscode/settings.default.json new file mode 100644 index 000000000..0aa71375b --- /dev/null +++ b/.vscode/settings.default.json @@ -0,0 +1,94 @@ +/* + * Copy this file as `.vscode/settings.json` to configure VSCode for this workspace. + * Unfortunately, VSCode doesn't (yet) offer any way to have "workspace defaults" or "user-worspace settings", + * so offering defaults to copy is the best we can do at the moment. + * + * ⚠ Disclaimer: The typeshed team doesn't commit to maintaining this file. It exists purely for your ease of use. +*/ +{ + // Don't format on save for formatters we don't explicitely control + "editor.formatOnSave": false, + "editor.codeActionsOnSave": { + "source.fixAll": false + }, + // Set file associations to support comments syntax highlight + "files.associations": { + "settings.default.json": "jsonc", + "pyrightconfig*.json": "jsonc", + ".flake8": "properties", + "stubtest_allowlist*.txt": "properties", + "**/stubtest_allowlists/*.txt": "properties", + "pytype_exclude_list.txt": "properties" + }, + "files.exclude": { + "**/.mypy_cache": true + }, + "files.insertFinalNewline": true, + "files.trimFinalNewlines": true, + "files.trimTrailingWhitespace": true, + "editor.comments.insertSpace": true, + "editor.insertSpaces": true, + "editor.detectIndentation": false, + "editor.tabSize": 2, + "[json][jsonc][python]": { + "editor.tabSize": 4 + }, + "[markdown]": { + "editor.rulers": [ + 90, + 130 + ] + }, + "[git-commit]": { + "editor.rulers": [ + 72 + ] + }, + "[yaml]": { + "editor.defaultFormatter": "redhat.vscode-yaml", + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.fixAll": true + } + }, + "[python]": { + "editor.defaultFormatter": "ms-python.black-formatter", + "editor.rulers": [ + 130 + ], + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.fixAll": true, + "source.fixAll.unusedImports": true, + "source.fixAll.convertImportFormat": true, + "source.organizeImports": true + } + }, + "isort.check": true, + // Using the dedicated black extension + "black-formatter.importStrategy": "fromEnvironment", + "python.formatting.provider": "none", + // Important to follow the config in pyrightconfig.json + "python.analysis.useLibraryCodeForTypes": false, + "python.analysis.extraPaths": [ + "tests" + ], + "python.linting.enabled": true, + "python.linting.mypyEnabled": true, + "python.linting.mypyArgs": [ + "--show-column-numbers", + "--no-pretty", + "--custom-typeshed-dir=${workspaceFolder}", + "--python-version=3.7" + ], + "isort.importStrategy": "fromEnvironment", + // Not using bandit + "python.linting.banditEnabled": false, + // Using dedicated Flake8 extension + "python.linting.flake8Enabled": false, + "python.linting.pycodestyleEnabled": false, + "python.linting.prospectorEnabled": false, + "python.linting.pylamaEnabled": false, + // Use the new dedicated extensions instead (and we're not using pylint) + "python.linting.pylintEnabled": false +}