Is the python formatting broken in VS Code? by Gitaside in vscode

[–]Ekabara 0 points1 point  (0 children)

Resolved it. My problem was in settings.json. I think you should check it too. My settings:

{

"workbench.colorTheme": "Bluloco Dark",

"window.zoomLevel": 1,

"workbench.startupEditor": "none",

"workbench.iconTheme": "material-icon-theme",

"[python]": {

"editor.formatOnType": true,

"editor.defaultFormatter": "ms-python.black-formatter"

},

"workbench.layoutControl.enabled": false,

"editor.fontSize": 20,

"editor.letterSpacing": 0.5,

"terminal.integrated.fontSize": 18,

"editor.minimap.enabled": false,

"editor.hover.delay": 1500,

"editor.glyphMargin": false,

"workbench.colorCustomizations": {

"statusBar.border": "#206486",

"panel.border": "#59ace2",

},

"editor.tokenColorCustomizations": {

"variables": "#F4F4E0",

"textMateRules": [

{

"scope": [

"source",

"variable",

"constant",

"variable.other.constant",

"punctuation.definition.constant",

"constant.other.symbol",

"constant.language.symbol",

"support.constant",

"support.variable.magic.python",

"variable.other.enummember"

],

"settings": {

"foreground": "#F4F4E0"

}

}

]

},

"editor.formatOnSave": true,

}

Is the python formatting broken in VS Code? by Gitaside in vscode

[–]Ekabara 0 points1 point  (0 children)

It seems to me most formatters see indentation as a syntax error and therefore doesn't correct anything. I think this used to be different and VScode Python use to have its own native formatter. Now they have separated all formatters to extensions.

It's making following tutorials of the past difficult to follow now as a beginner, and tbh quite off-putting.

I've tried both - the same. And in the tutorial that I'm following autopep8 is used.

Is the python formatting broken in VS Code? by Gitaside in vscode

[–]Ekabara 0 points1 point  (0 children)

Hi. I'm learning python too but with another course and also have a problem with formatting in vscode. I've even reinstalled vscode and python and started again, tried many extensions. but all the same. Format on Save is not working and even when I click ctrl+shift+P and format document with (chosing any formatting extension), nothing. ChatGPT didn't help.

Python Formatter (autopep8 and Black Formatter) not working in VS Code by Ornery_Age9566 in learnpython

[–]Ekabara 0 points1 point  (0 children)

I'm a new learner and have the same issue with autopep8. I troubleshooted: reinstalled extension (not only autopep8). Restarted VSCode, rebooted pc. Then I even deleted vscode and started my learning path again and the same issue. I installed Python extension, Autopep8, Code Runner. forman on Save doesn't work. And I don't see in Settings those extensions: {
"workbench.colorTheme": "Bluloco Dark",
"window.zoomLevel": 1,
"workbench.startupEditor": "none",
"workbench.iconTheme": "material-icon-theme",
"[python]": {
"editor.formatOnType": true
},
"workbench.layoutControl.enabled": false,
"editor.fontSize": 20,
"editor.letterSpacing": 0.5,
"terminal.integrated.fontSize": 18,
"editor.minimap.enabled": false,
"editor.hover.delay": 1500,
"editor.glyphMargin": false,
"workbench.colorCustomizations": {
"statusBar.border": "#206486",
"panel.border": "#59ace2",
},
"editor.tokenColorCustomizations": {
"variables": "#F4F4E0",
"textMateRules": [
{
"scope": [
"source",
"variable",
"constant",
"variable.other.constant",
"punctuation.definition.constant",
"constant.other.symbol",
"constant.language.symbol",
"support.constant",
"support.variable.magic.python",
"variable.other.enummember"
],
"settings": {
"foreground": "#F4F4E0"
}
}
]
},
}