Skip to content
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

collapse blocks of code from closing curly braces #157598

Closed
msh-shf opened this issue Aug 9, 2022 · 11 comments
Closed

collapse blocks of code from closing curly braces #157598

msh-shf opened this issue Aug 9, 2022 · 11 comments
Assignees

Comments

@msh-shf
Copy link

msh-shf commented Aug 9, 2022

Hello,
It is a very practical feature to collapse code blocks from closing curly brace like PHPStorm.

image

@Jacobify
Copy link

Jacobify commented Aug 9, 2022

this is a very practical feature, since i dont always want to fold my blocks using "fold" key shortcuts. With this feature i dont need to scroll up to the beginning of my block every time i need to collapse it.

@gjsjohnmurray
Copy link
Contributor

Meanwhile you may like to try this extension I wrote.

https://marketplace.visualstudio.com/items?itemName=georgejames.thefoldingstuff

@Jacobify
Copy link

Jacobify commented Aug 9, 2022

Meanwhile you may like to try this extension I wrote.

https://marketplace.visualstudio.com/items?itemName=georgejames.thefoldingstuff

thanks a lot but this still does not provide what we mentioned. jet brains already did this for their editors as you can see below
SS_1090003862
.

@msh-shf
Copy link
Author

msh-shf commented Aug 9, 2022

Hi @gjsjohnmurray,
When the cursor is located at the end of the block and I fold the block, the parent block will be folded!

@RedCMD
Copy link
Contributor

RedCMD commented Aug 9, 2022

So you want a upwards facing arrow at the bottom of a folding range as well as the top?
what should happen if there are 2 folding ranges that end/start on the same line?

if {
        // code
∧   }


∨   if {
        // code
∧   } else {    // what should happen here? 
        // code
∧  }

@msh-shf
Copy link
Author

msh-shf commented Aug 9, 2022

Hi @RedCMD,
Yes, this is exactly what I mean and,
If 2 blocks start/end on the same line, the priority would be with the closing curly bracket, like below:

if {...} else {

}

@gjsjohnmurray
Copy link
Contributor

When the cursor is located at the end of the block and I fold the block, the parent block will be folded!

@msh-shf I suggest you right-click one line higher up then.

@Jacobify it isn't possible for extensions to achieve what you want, but the extra context menu items are a workaround.

@gjsjohnmurray
Copy link
Contributor

/duplicate of #60670

@aeschli that issue links to a PR that has been languishing for several years. Can it get some love?

@Jacobify
Copy link

Jacobify commented Aug 10, 2022

@gjsjohnmurray
as much as i find the context menu great to use , i still feel like adding an arrow at the end of each block won't be asking for overkill . the down-side arrow is there folding/unfolding blocks, all needed is a up-side arrow doing the same thing only located at the end of the block
test

@Jacobify
Copy link

@gjsjohnmurray Hello there . Sorry to mention you here again ,but I just wanted to see if this issue is getting any progress ? Thanks in advance for your time

@aeschli
Copy link
Contributor

aeschli commented Aug 26, 2022

Duplicate of #60670

@aeschli aeschli marked this as a duplicate of #60670 Aug 26, 2022
@aeschli aeschli closed this as completed Aug 26, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Oct 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants