-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Unexpected indentation behavior after latest update #6886
Comments
Got the same issue as well, it breaks my code indentation when moving lines around. |
I've noticed the same behavior reported by @kbd. In addition and perhaps related, when I paste, the code gets indented inappropriately as well. When you paste a function under another function, the second function is indented to be inside the first function. This place in two steps - the indentation is in the right place first, and then the whole block gets indented. An undo will reach the first step where things are in the right place. |
I have another version of the bug.
|
I'm adding my voice to the chorus. (I'm glad there's a chorus to join!) Because Python has semantic indentation and no end-block delimiters, it is absolutely critical that the editor doesn't try to be too "smart". Some of the seemingly new behaviors described in this thread are actually things that VS Code users in general have enjoyed/endured for quite a while now. For example, there's this thread where they discussed the indent-on-paste behavior. It was opened in 2016 and closed in 2017. In my view, part of the purpose of this extension is to fight against some of the "helpful behaviors" provided by VS Code. What might be genuinely helpful in other languages can actually be actively unhelpful in Python. Please dumb the indentation back down to where it was! (Or at least provide settings that allow us to choose how dumb we want it.) |
I have the same problem as kbd, the latest version of the extension indents lines that absolutely should not be indented.
If you hit "Enter" when your cursor is dedented relative to the previous line, then it will move your cursor in 4 spaces to match the previous line. Which is exactly the opposite of what you want when you are, for instance, adding whitespace after a function definition before writing a new function. Please just revert this to the previous behaviour (Indent after ':' at the end of a function definition, for loop, and other lines that require an indent immediately after) |
It's a good tip, thanks for pointing it out. It's just kind of painful for me because 2019.8.29288 fixes #1062 and #4241, and I've been looking forward to those for a long time. But I think those older problems are probably easier to live with than the current hyperaggressive autoindentation of everything, so yeah, I think I'll be reverting too. :( |
Well, in case anyone else is really bothered by #4241, I guess I might as well report that you can go way back in time to before that bug was introduced, and install 2018.12.1 (the first version that exhibits #4241 is 2019.1.0). |
We're really sorry about that. We're going to revert these changes and will let you know once it's out there so you can use the latest update. |
FYI, the related PRs are #6440 (indent after escaped characters) and #6497 (dedent after else, etc.). We should not need to revert #6440 and the "onEnterRules" part of #6497 could probably stay too. That's assuming the problem is strictly with the "indentationRules" part of the language configuration. |
I was able to verify that using the insiders build everything works correctly now. |
We're going to push a hot fix for this soon, but if anyone would like to try it out ahead of time, you can use the Insiders build (here or by opting-in the Insiders program as a daily basis, more details about it in the blog post) |
🤦♀️ sorry about that, and thank you so much @michaelkolber |
Is there an ETA on when this will be released? I'd rather not opt-in to the insiders build, and I definitely don't want to downgrade. |
It's already released. |
Environment data
Expected behaviour
When moving a line up or down (using the
editor.action.moveLinesDownAction
andeditor.action.moveLinesUpAction
actions), the following should happen:Actual behaviour
When moving a line up or down, the indentation levels of the lines surrounding it are wrongfully affected.
Steps to reproduce:
See GIF screenshot below. The
Baz
class is wrongfully indented one level to the right, when a line was begin moved through it:Logs
Output for
Python
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
)Output from
Console
under theDeveloper Tools
panel (toggle Developer Tools on underHelp
; turn on source maps to make any tracebacks be useful by runningEnable source map support for extension debugging
)The text was updated successfully, but these errors were encountered: