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
Drunk behavior of moveLinesDownAction #54829
Comments
Good catch and it helps me understand what's going on there. Let me use a simple if block to describe the root cause here, will work on it after the issue grooming. console.log();
if (true) {
console.log();
} We have 5 lines of code here. Say if we are going to move the 3rd line down, internally we cut the 4th line and paste after 2nd line. So The expected result should be console.log();
console.log();
if (true) {
} However due to the wrong onEnter rules checking, we get console.log();
console.log();
if (true) {
} |
VSCode simply shouldn't touch the indenting when moving lines up and down. It's not moving a statement, it's moving the whole line. So the editor should just stop trying to be smarter than it can be. The correct indentation is very hard to predict with 100% accuracy, and even 99% isn't good enough, because the remaining 1% will drive one insane. Unfinished code is likely not (yet) well-formed, making it impossible to correctly predict the indentation the developer intents to go for. |
Fully agree with @thany's statement. There are a lot of auto indentation issues when moving code up and down (see other referenced issues). It might be best to (allow us to) disable auto indentation when moving code up and down, because it's clearly not working as expected in a lot of cases, and it doesn't seem like these issues are high on the priority list. |
Steps to Reproduce:
The text was updated successfully, but these errors were encountered: