Reputation: 105
I am writing python code in vscode, after an expression, each time I hit enter to start a new line, it will automatic add one space for the newline.
Instead, what I really want is the starting new line would be aligned with the start of the statement, i.e:
def fun():
arg = 'fake'
cursor should be aligned with arg
Now what I got is the cursor is one space of the start. I searched and couldn't find out where to set this, the Tab Size is 4 space.
I still don't find out the causing issue, but on my project I solved it by setting black path to my absolute path. The answers provided below is not the reason why it doesn't work in my vscode. I attached the pic here.My vscode shortcut
Upvotes: 3
Views: 6471
Reputation: 81
the problem was 'python indent' extension that I installed. I deleted and it worked
Upvotes: 8
Reputation: 8421
Your situation for now:
Click Space:2
and select Indent Using Space
:
Slect 4:
It should be work:
Upvotes: 0
Reputation: 83
Set also the tab size at the status bar to 4 instead of 2 and you're good to go.
Upvotes: 0
Reputation: 905
Open the command palette with Ctrl+Shift+P, type in Indent with spaces
, press Enter and select 4
.
Upvotes: 1