I’m trying to setup vscode for python development but some configurations in the user config file are completely ignored.
Here’s my config:
{
// General editor settings
"editor.formatOnSave": true,
"editor.formatOnSaveMode": "modifications",
// Python settings
"[python]": {
"editor.defaultFormatter": "ms-python.autopep8",
"autopep8.args": [
"--max-line-length", "88", // or 94 depending on your preference
"--aggressive",
"--aggressive"
],
"linting.enabled": true,
"linting.pylintEnabled": true,
},
// Ensure that imports are organized on save
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit"
},
// Configure isort settings
"isort.args": [
"--profile=autopep8",
"--force-sort-within-sections",
"--line-length=88" // or 94
],
// Optional: Configure additional Python linting/formatting settings
"python.linting.flake8Enabled": true,
"python.linting.flake8Args": [
"--max-line-length=88" // or 94
],
"python.linting.mypyEnabled": true,
// Optional: Configure additional Python formatting settings
"python.formatting.blackArgs": [
"--line-length=88" // or 94
]
}
And, here’s an image showing with faded blue color the arguments that are not recognized at all. I couldn’t find anything online that properly show how to set things up. Any ideas how to properly set those?
Ideally I’m looking to configure vscode such that:
1. all import modules at the beginning of the file should be sorted in accending order according to character lengths, e.g., import os, sys should be first compared to from matplotlib.pyplot import pyplot as plt
2. function definitions should have two empty lines before and after them
3. function definitions inside a class should have only one empty line before and after them
4. code lines that are larger than 88 or 94 characters should be automatically wrapped "nicely" to fit the line limits
5. remove any trailing space
6. all of the above should happen when saving the file, i.e., ctrl+s