Created
November 4, 2021 23:58
-
-
Save luizomf/276820fed43130edaf4fa8ab3c57a0a1 to your computer and use it in GitHub Desktop.
Configuração do VS Code para Python e Django.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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" | |
} | |
} |
Qual foi a solução utilizada?
?
"source.organizeImports": "explicit"
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
As dicas acima resolveram tudo, valeu!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Quando colo essas configurações no meu VScode, ele aponta dois problemas: "source.organizeImports": true (Aqui ele diz que o esperado é "string" ao invés de True) e o seguinte é: "editor.defaultFormatter": "ms-python.python"(Valor não é aceito. Valores válidos: null, "vscode.css-linguagem-features", "vscode.html-linguagem-features", "vscode.json-linguagem-features", "vscode.markdown-linguagem-features", "vscode.markdown- matemática", "recursos de linguagem vscode.php", "recursos de linguagem vscode.typescript", "vscode.configuration-editing", "vscode.debug-auto-launch", "vscode.debug-server-ready" , "vscode.emmet", "vscode.extension-editing", "vscode.git", "vscode.git-base", "vscode.github", "vscode.github-authentication", "vscode.grunt", " vscode.gulp", "vscode.ipynb", "vscode.jake", "ms-vscode.js-debug", "ms-vscode.js-debug-companion", "vscode.media-preview", "vscode. conflito de mesclagem", "vscode.microsoft-authentication", "vscode.npm", "vscode.references-view", "vscode.search-result", "vscode.simple-browser", "vscode.tunnel-forwarding" , "ms-vscode.vscode-js-profile-table").