You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[folding] Collapse ending brace to the same line #3352
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
changed the title [-]Proposal: Code folding collapses ending brace to the same line[/-][+][folding] Collapse ending brace to the same line[/+]on Feb 24, 2016
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
Reacted by Loris Bettazza, Thaina, mtman, Felipe Ribeiro, Plamen Andreev, Alexander, fynn, Daniel Whitney, Ahmad Raza, Waldir Pimenta and 19 more
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
Reacted by Chris Chudzicki, Plamen Andreev, Loris Bettazza, langdonx, Anton Rudnikov, Shane Lawrence, Waldir Pimenta, Brandon Slinkard, Azar, lincoln and 38 more
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.
Reacted by Shane Lawrence, Leslie Evelyn Solorzano, Fmajor, lincoln, Rodrigo Vieira, Chryssa Jones, disfated, BergenSoft, AuroraTea and Alaric
Martin Aeschlimann (@aeschli) what would be the correct solution? Most obvious is to have a setting for this. If yes, what setting scope it should be included in?
a) As a common vscode setting, like editor.foldingIncludeClosingBracketsOrTags: true | false | 'auto' (where true/false is for User preference, and auto is default, meaning that extension decides (current behavior)), so that we could set it for all or selected languages, and then leverage support of it by updating language extensions
b) Each language extension should have its own setting for this
I would go for a), though it will result in a line of extensions which not yet support the feature, but there will be a toggle ready, so it would just need to be picked up by corresponding extensions. b) would be free from this, but it is not convenient to configure each language separately, searching for the specific setting name, which will obviously be named differently by extension developers
I'd like to try implementing this for ts/js, json, css, html (something else, of built-in ones?)
TypeScript 7 should eventually handle this in its language server—it'll include the closing bracket line in the fold as long as there's only whitespace after the bracket when using the lineOnly: true mode that VS Code uses for TS7. microsoft/TypeScript#64235microsoft/TypeScript#65319
On 23 Nov 2026, at 7:22 am, n-gist ***@***.***> wrote:
TypeScript 7 should eventually handle this in its language server—it'll include the closing bracket line in the fold as long as there's only whitespace after the bracket when using the lineOnly: true mode that VS Code uses for TS7.
So could it also collapse the following blank line after the closing brace?
Eg,
function one() { ...
}
function two() { ...
}
function three() { ...
}
becomes:
function one() { ...
function two() { ...
function three() { ...
I think this would affect the visual layout too significantly—something most users wouldn't expect—so it’s unlikely the TypeScript team would consider adding it. It would require a separate configuration setting, and it would likely be difficult to convince the team that it’s truly necessary, especially since this is something we can already control ourselves by simply removing those blank lines from the code.
Activity
tht13 commentedon Feb 24, 2016
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
joaomoreno commentedon Feb 24, 2016
👍
joaomoreno commentedon Feb 24, 2016
ping alexandrudima
[-]Proposal: Code folding collapses ending brace to the same line[/-][+][folding] Collapse ending brace to the same line[/+]pom421 commentedon Jul 12, 2016
👍
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).
danjoa commentedon Dec 23, 2016
👍 definitely, would help so much
g5codyswartz commentedon Feb 1, 2017
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
Spown commentedon Aug 28, 2017
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: boolrenestalder commentedon Nov 24, 2017
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.
92 remaining items
ammarsani-my commentedon Sep 20, 2025
https://marketplace.visualstudio.com/items?itemName=AtroxEGO.better-folding-plus
For JSON, this might help.
But still, +1 for this feature to support natively in vscode.
Vasdranna commentedon Jan 30, 2026
Any updates on this?
It would be great to have this feature, including displaying only the region descriptions (e.g. showing Macros instead of //#region Macros).
jucdev commentedon Feb 24, 2026
Happy 10th anniversary!
n-gist commentedon Feb 26, 2026
Martin Aeschlimann (@aeschli) what would be the correct solution? Most obvious is to have a setting for this. If yes, what setting scope it should be included in?
a) As a common vscode setting, like
editor.foldingIncludeClosingBracketsOrTags:true|false|'auto'(where true/false is for User preference, and auto is default, meaning that extension decides (current behavior)), so that we could set it for all or selected languages, and then leverage support of it by updating language extensionsb) Each language extension should have its own setting for this
I would go for a), though it will result in a line of extensions which not yet support the feature, but there will be a toggle ready, so it would just need to be picked up by corresponding extensions. b) would be free from this, but it is not convenient to configure each language separately, searching for the specific setting name, which will obviously be named differently by extension developers
I'd like to try implementing this for ts/js, json, css, html (something else, of built-in ones?)
gixxy22 commentedon Mar 24, 2026
switched to vscode from jetbrains, and this is the only thing that I miss, it makes code look cluttered and takes up more vertical space.
serhumanos commentedon Jun 17, 2026
the Better Folding extension is not working as spected anymore, so we are alone again
n-gist commentedon Nov 22, 2026
TypeScript 7 should eventually handle this in its language server—it'll include the closing bracket line in the fold as long as there's only whitespace after the bracket when using the lineOnly: true mode that VS Code uses for TS7.
microsoft/TypeScript#64235 microsoft/TypeScript#65319
web3d0 commentedon Nov 23, 2026
n-gist commentedon Nov 23, 2026
I think this would affect the visual layout too significantly—something most users wouldn't expect—so it’s unlikely the TypeScript team would consider adding it. It would require a separate configuration setting, and it would likely be difficult to convince the team that it’s truly necessary, especially since this is something we can already control ourselves by simply removing those blank lines from the code.