Skip to content

Instantly share code, notes, and snippets.

@luizomf
Created November 4, 2021 23:58
Show Gist options
  • Save luizomf/276820fed43130edaf4fa8ab3c57a0a1 to your computer and use it in GitHub Desktop.
Save luizomf/276820fed43130edaf4fa8ab3c57a0a1 to your computer and use it in GitHub Desktop.
Configuração do VS Code para Python e Django.
{
"window.zoomLevel": 0,
"python.languageServer": "Pylance", // ms-python.vscode-pylance
"python.testing.unittestEnabled": false, // ms-python.python
"python.testing.pytestEnabled": true,
"python.testing.pytestArgs": [], // -x to bail
"python.linting.flake8Enabled": true,
"python.linting.mypyEnabled": true,
"python.linting.pylintArgs": [
"--load-plugins=pylint_django",
"--errors-only"
],
"python.formatting.autopep8Args": ["--indent-size=4"],
"python.defaultInterpreterPath": "venv/bin/python",
"[python]": {
"editor.defaultFormatter": "ms-python.python", // ms-python.python
"editor.tabSize": 4,
"editor.insertSpaces": true,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
},
"[html]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "vscode.html-language-features",
"editor.quickSuggestions": {
"other": true,
"comments": true,
"strings": true
}
},
"[django-html]": {
"editor.formatOnSave": false,
"editor.defaultFormatter": "vscode.html-language-features",
"editor.quickSuggestions": {
"other": true,
"comments": true,
"strings": true
}
},
"files.associations": {
"*.js": "javascript",
"*.jsx": "javascriptreact",
"*.xml": "html",
"*.svg": "html",
"*.html": "html",
"django-html": "html", // batisteo.vscode-django
"**/*.html": "html",
"**/templates/**/*.html": "django-html",
"**/base_templates/**/*.html": "django-html",
"**/requirements{/**,*}.{txt,in}": "pip-requirements"
},
"emmet.includeLanguages": {
"django-html": "html", // batisteo.vscode-django
"javascript": "javascriptreact",
"typescript": "typescriptreact"
}
}
@dcarnelossi
Copy link

    "source.organizeImports": "explicit"

@aafrozza
Copy link

aafrozza commented Feb 3, 2025

Erro 1:
"source.organizeImports": true
// organizeImports vai ordenar os imprts, porém remover os imports não usados.
// Experimente trocar conforme abaixo para ordenar os imports, mas não remover os imports não usados.
"editor.codeActionsOnSave": {
//"source.organizeImports": true
"source.sortImports": "explicit"
}

Erro 2:
"editor.defaultFormatter": "ms-python.python"

  • Basta instalar as extensoes indicadas no curso: ms-python.vscode-pylance e batisteo.vscode-django

@Edurocha7
Copy link

As dicas acima resolveram tudo, valeu!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment