|
| 1 | +{ |
| 2 | + // ============================================================================= |
| 3 | + // Python Language Server |
| 4 | + // ============================================================================= |
| 5 | + // Use ty as the primary language server (completions, hover, go-to-definition) |
| 6 | + // Disable the built-in Python language server to avoid conflicts |
| 7 | + "python.languageServer": "None", |
| 8 | + // Auto-activate virtual environment in terminal |
| 9 | + "python.terminal.activateEnvInCurrentTerminal": true, |
| 10 | + |
| 11 | + // ============================================================================= |
| 12 | + // ty Settings (Language Server + Type Checking) |
| 13 | + // ============================================================================= |
| 14 | + // ty reads config from [tool.ty] in pyproject.toml automatically |
| 15 | + |
| 16 | + // ============================================================================= |
| 17 | + // Ruff Settings (Linting + Formatting) |
| 18 | + // ============================================================================= |
| 19 | + // Ruff reads config from [tool.ruff] in pyproject.toml automatically |
| 20 | + "ruff.nativeServer": true, |
| 21 | + "ruff.organizeImports": true, |
| 22 | + "ruff.fixAll": true, |
| 23 | + "[python]": { |
| 24 | + "editor.formatOnSave": true, |
| 25 | + "editor.defaultFormatter": "charliermarsh.ruff", |
| 26 | + "editor.codeActionsOnSave": { |
| 27 | + "source.fixAll.ruff": "explicit", |
| 28 | + "source.organizeImports.ruff": "explicit" |
| 29 | + } |
| 30 | + }, |
| 31 | + |
| 32 | + // ============================================================================= |
| 33 | + // mypy Settings (Type Checking) |
| 34 | + // ============================================================================= |
| 35 | + // mypy reads config from [tool.mypy] in pyproject.toml automatically |
| 36 | + "mypy-type-checker.args": ["--config-file=${workspaceFolder}/pyproject.toml"], |
| 37 | + "mypy-type-checker.importStrategy": "fromEnvironment", |
| 38 | + "mypy-type-checker.preferDaemon": false, |
| 39 | + |
| 40 | + // ============================================================================= |
| 41 | + // Editor Settings |
| 42 | + // ============================================================================= |
| 43 | + // Match line length from pyproject.toml |
| 44 | + "editor.rulers": [120], |
| 45 | + // Ensure clean file endings (works for all file types, not just Python) |
| 46 | + "files.trimTrailingWhitespace": true, |
| 47 | + "files.trimFinalNewlines": true, |
| 48 | + "files.insertFinalNewline": true, |
| 49 | + // Preserve trailing whitespace in Markdown (double-space = line break) |
| 50 | + "[markdown]": { |
| 51 | + "files.trimTrailingWhitespace": false |
| 52 | + }, |
| 53 | + |
| 54 | + // ============================================================================= |
| 55 | + // File Exclusions |
| 56 | + // ============================================================================= |
| 57 | + // Match the excludes from ruff config in pyproject.toml |
| 58 | + "files.exclude": { |
| 59 | + "**/__pycache__": true, |
| 60 | + "**/.mypy_cache": true, |
| 61 | + "**/.ruff_cache": true, |
| 62 | + "**/.pytest_cache": true, |
| 63 | + }, |
| 64 | + "search.exclude": { |
| 65 | + "uv.lock": true |
| 66 | + }, |
| 67 | + |
| 68 | + // ============================================================================= |
| 69 | + // Testing |
| 70 | + // ============================================================================= |
| 71 | + "python.testing.pytestEnabled": true, |
| 72 | + "python.testing.pytestArgs": ["tests"] |
| 73 | +} |
0 commit comments