-
Notifications
You must be signed in to change notification settings - Fork 765
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dedent nested else
blocks correctly
#4820
Comments
I have to say I find all this focus on indentation aids a little disconcerting. If I had found microsoft/vscode-python#6333 (or microsoft/vscode-python#6497) earlier, I would have commented there. I had kind of thought that once the fancy continuation-line indentation was finished, we were really done with automatic indentation. Note that in Python, this is perfectly legal: if foo:
if bar:
print('foobar')
else:
print('not foo') One of the consequences of not having suite-ending delimiters is that it is impossible to infer, even in principle, what the "proper" indentation level is for I would appeal to the Python sensibility of refusing the temptation to guess. Please tell me that whatever is being done with auto-dedentation of For example, let's say I've already typed the following, and the cursor is on the next line, aligned with if foo:
if bar:
print('foobar')
#<--cursor is here And let's say I want an if foo:
if bar:
print('foobar')
else:
print('foo') Now, recall I said I dedented manually. Please tell me that the plan is not for automatic dedent to kick in when I type the Or, let's say I want to achieve the following: if foo:
if bar:
print('foobar')
else:
print('not foo') Again, after typing I am sort of OK with the editor automatically dedenting |
Note that solving this specific issue will require context-aware whitespace formatting. |
Is it a bug or an enhancement to the regexes added when working on microsoft/vscode-python#6333 (PR microsoft/vscode-python#6497)?
Expected behaviour
Actual behaviour
The text was updated successfully, but these errors were encountered: