-
Notifications
You must be signed in to change notification settings - Fork 29.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
Don't include trailing empty lines at end of code folding #26258
Conversation
@acls, thanks for your PR! By analyzing the history of the files in this pull request, we identified @alexandrudima and @egamma to be potential reviewers. |
@acls, It will cover your contributions to all Microsoft-managed open source projects. |
@acls, thanks for signing the contribution license agreement. We will now validate the agreement and then the pull request. |
Could you look into adding a property to the language configuration so that we can distinguish indentation based languages from bracket based languages? Note sure about the name of the property, maybe blockEndStyle: 'c-style' || 'off-side' Sorry for not getting to do this myself, but I'm covered with other issues. |
I think we don't need to serve both camps. Ignoring empty lines at the end of the block during folding will probably not affect c-like code much. I have a dev version with changes from acls here on the right side of the screenshot and the release version on the left side. After folding some typescript code we get exactly the same result in both versions: But we have some big problems with python code. First let's look how some bad formatted python code was folded in the normal (left) and in the patched version (right) : We see that current VS Code version simply hides our formatting problems. Even if the code on the left side looks kind of better after folding, it is still bad formatted, we simply can not see that anymore. Well formatted code also gets some troubles: Notice how current release version puts the for loop and the class definition together. This brakes the entire structure of the code and makes it unreadable. Also if you want to add a new function between two existing folded ones, you get a problem. You can not even start write something, because every newly created empty line will be immediately folded. VS Code is just amazing. This folding problem slows down my transition from Sublime to VS Code now and I have to stick with the patched version. It would be really nice to get better folding behavior right out of the box though. So please merge it into master or at least insider branch. Thx! Best regards, |
I pushed a new language configuration setting to distinguish C-style block language from offSide style languages. Adapted the indentation based folding to use the new setting. |
This fixes #3353.