[folding] Collapse ending brace to the same line
Consider a large JavaScript file
function a() {
...
}
function b() {
...
}
function c() {
...
}
and so on...
Collapsing all currently yields:
function a() { ...
}
function b() { ...
}
function c() { ...
}
and so on...
This would be more readable if the closing brace was on the same line:
function a() { ... }
function b() { ... }
function c() { ... }
and so on...
Here is how other prominent editors handle the above:
Atom

Brackets

Sublime Text 3

VS Code

This would not work for languages which do not use punctuation to signify code blocks (i.e python)
Code Folding at the moment uses indentation and so will close everything up to the next line on the same indentation level as the folding line. The implementation would have to change to fold the closing bracket as this would cause issues in some languages
:+1:
ping @alexandrudima
👍 I like the Atom's way. We save a line and the ending curly brace is not virtually on the same line than the beginning one (unlike Bracket).
👍 definitely, would help so much
I like how Jetbrains does theirs which matches "bracket"

I also love being able to fold not only from the first bracket but also the last bracket.
They also have essentially peeking for brackets when they're not on screen so you can see what they belong to. I used to comment what ending brackets belonged to, then I stopped due to the IDE, now I'm feeling lost again w/o it.

I also really like how notepad++ puts the trailing line as mentioned in Alternative Designs #2
I'm for the current model, but since people still think there is something to be corrected I think a preference is in order, something like editor.foldingConsumeLastLine: bool
Also would prefer a way to make it one-line. I often use the folding in CSS and liked the way the Jetbrains IDEs put the collapsed selectors on one line.
Can you solve it? I have this same problem uncomfortable, I read the other post about it, but I did not see anything finished that can help me, someone there knows how to solve ?? it really is very uncomfortable working with multiple collapsed lines, because with this line more than "}" it is difficult and confusing to work.
I like the 'Brackets' example, looks clean

It is a good choice to show the number of folded code lines like vim, and make the folded code more visible.
Hi people!
I think would be nice to see vscode folding with info about amount of lines folded like Netbeans:

BTW: Thank you for this awesome code editor! :smile:
Related issue here: https://github.com/Microsoft/vscode/issues/29155
I would really like to see this implemented. But, in the meantime, is there an extension that does that?
I would to see this implemented soon. It's a right pain. Visual Studio working perfectly for collapse and expanding structure.
+1
#54351 suggests to always show an opening bracket on the first line, even if it's on the next line in the original code
+1 for many of the ideas here! To recap:
- Original idea
- Show number of lines like Net beans as @faustinoaq suggested, but for large blocks only
- Always show an opening bracket on the first line, even if it's on the next line in the original code, as @aeschli said
To add to this, the folded braces { ... } should change state when you hover over it, like a button, and should unfold when clicked.
Also, I would really not like it to look like the Visual Studio folding style. I really want to see those braces surrounding the ellipses.
for large blocks only
@NSExceptional, how much would you consider that to be? 8 lines? 15? 100+? Or maybe a config option?
10 I guess. Or configurable from 10, sure.
Hey DEVS! Don't you tired of merging similar requests from your users? I have been waiting for this incredibly difficult in the implementation feature for two years now, I've got anything, but not what I really want. If this is something fundamental, not relevant to your philosophy, then just let us know.