Skip to content

Fix: VS Code settings files. "ast.pyi", for example, no longer has 330 diagnostic errors. #14318

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ analyze.py
*~
.*.sw?
.vscode/*
!.vscode/settings.default.json
!.vscode/settings.json
!.vscode/extensions.json
.idea/
.venv*/
Expand Down
9 changes: 0 additions & 9 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// ⚠ 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",
Expand All @@ -14,9 +13,6 @@
"redhat.vscode-yaml",
],
"unwantedRecommendations": [
/*
* Don't recommend by default for this workspace
*/
"christian-kohler.npm-intellisense",
/*
* Must disable in this workspace
Expand All @@ -32,10 +28,5 @@
"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",
],
}
152 changes: 62 additions & 90 deletions .vscode/settings.default.json → .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,110 +1,61 @@
/*
* 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.
* ⚠ 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": "never"
},
// 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": {
"**/.*_cache": true, // mypy and Ruff cache
"**/__pycache__": true
},
"files.eol": "\n",
"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][toml]": {
"editor.tabSize": 4
},
"editor.rulers": [
90,
130
],
"[git-commit]": {
"editor.rulers": [
72
]
},
// Format on save for formatters we explicitely control
"[json][jsonc][yaml][python][toml]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": "explicit"
}
},
"[json][jsonc]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
"[yaml]": {
"editor.defaultFormatter": "redhat.vscode-yaml"
"[json][jsonc][python][toml]": {
"editor.tabSize": 4
},
"[toml]": {
"editor.rulers": [
90
],
"editor.defaultFormatter": "tamasfe.even-better-toml"
// The typeshed team recommends these extensions "fixAll" "OnSave" for your ease of use.
"[json][jsonc][yaml][python][toml]": {
"editor.codeActionsOnSave": {
"source.fixAll": "explicit"
},
"editor.formatOnSave": true
},
"[python]": {
"editor.rulers": [
130
],
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.codeActionsOnSave": {
// Let Ruff lint fixes handle imports
// The typeshed team recommends using Ruff for import statements.
"source.organizeImports": "never",
"source.unusedImports": "never"
}
},
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.rulers": [
130
]
},
"[toml]": {
"editor.defaultFormatter": "tamasfe.even-better-toml",
"editor.rulers": [
90
]
},
"[yaml]": {
"editor.defaultFormatter": "redhat.vscode-yaml"
},
// python.analysis is Pylance (pyright) configurations
"python.analysis.fixAll": [
// Explicitly omiting "source.convertImportFormat", some stubs use relative imports
// Explicitly omiting "source.unusedImports", Let Ruff lint fixes handle imports
],
"python.analysis.typeshedPaths": [
"${workspaceFolder}"
],
"python.analysis.extraPaths": [
"tests"
],
"mypy-type-checker.importStrategy": "fromEnvironment",
"mypy-type-checker.args": [
"--custom-typeshed-dir=${workspaceFolder}",
// We only guarantee all of our tests can be run if you're on Python 3.9 or higher
"--python-version=3.9",
"--strict",
// Needed because a library stubbed in typeshed won't necessarily be installed in the dev's environment
"--ignore-missing-imports"
],
// Ensure typeshed's configs are used, and not user's VSCode settings
"flake8.args": [
"--config=.flake8"
],
"flake8.importStrategy": "fromEnvironment",
"black-formatter.importStrategy": "fromEnvironment",
// Using Ruff instead of isort
"isort.check": false,
"ruff.importStrategy": "fromEnvironment",
"ruff.fixAll": true,
"ruff.organizeImports": true,
"editor.codeActionsOnSave": {
"source.fixAll": "never"
},
"editor.comments.insertSpace": true,
"editor.detectIndentation": false,
// The typeshed team recommends disabling generalized "on save" actions in favor of "on save"
// actions per extension.
"editor.formatOnSave": false,
"editor.insertSpaces": true,
"editor.rulers": [
90,
130
],
"editor.tabSize": 2,
"evenBetterToml.formatter.alignComments": false,
"evenBetterToml.formatter.alignEntries": false,
"evenBetterToml.formatter.allowedBlankLines": 1,
Expand All @@ -119,7 +70,28 @@
"evenBetterToml.formatter.indentTables": false,
"evenBetterToml.formatter.inlineTableExpand": false,
"evenBetterToml.formatter.reorderArrays": true,
// "We" do not want you to reorder TOML keys because "we" like keeping TOML keys in a "specific
// non-alphabetical order" that feels more natural to "us". (Note: This file does not document
// the "specific non-alphabetical order", and this file does not identify who "we" are.)
"evenBetterToml.formatter.reorderKeys": false,
"evenBetterToml.formatter.trailingNewline": true,
// We like keeping TOML keys in a certain non-alphabetical order that feels more natural
"evenBetterToml.formatter.reorderKeys": false
"files.eol": "\n",
"files.exclude": {
"**/__pycache__": true,
"**/.*_cache": true // This includes the mypy and Ruff caches.
},
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
"files.trimTrailingWhitespace": true,
"flake8.args": [
"--config=.flake8 ${workspaceRoot}"
],
// Using Ruff instead of isort
"isort.check": false,
"mypy-type-checker.args": [
"--custom-typeshed-dir=${workspaceRoot}",
"--strict",
// A developer's environment might not have a library that typeshed provides a stub for.
"--ignore-missing-imports"
],
}
25 changes: 25 additions & 0 deletions typeshed.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"folders": [
{
"path": "."
}
],
"settings": {
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
},
"files.associations": {
".flake8": "properties",
"**/stubtest_allowlists/*.txt": "properties",
"pyrightconfig*.json": "jsonc",
"pytype_exclude_list.txt": "properties",
"settings.default.json": "jsonc",
"stubtest_allowlist*.txt": "properties"
},
"flake8.importStrategy": "fromEnvironment",
"mypy-type-checker.importStrategy": "fromEnvironment",
"ruff.fixAll": true,
"ruff.importStrategy": "fromEnvironment",
"ruff.organizeImports": true,
}
}