Skip to content

Offer sensible default VSCode settings #9436

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ analyze.py
# Editor backup files
*~
.*.sw?
.vscode/
.vscode/*
!.vscode/settings.default.json
!.vscode/extensions.json
.idea/
.venv*/

Expand Down
35 changes: 35 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -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",
],
}
94 changes: 94 additions & 0 deletions .vscode/settings.default.json
Original file line number Diff line number Diff line change
@@ -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
}