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

Icons for folding and unfolding #2948

Closed
aeschli opened this issue Feb 11, 2016 · 18 comments
Closed

Icons for folding and unfolding #2948

aeschli opened this issue Feb 11, 2016 · 18 comments
Assignees
Labels
editor-folding Editor code folding issues
Milestone

Comments

@aeschli
Copy link
Contributor

aeschli commented Feb 11, 2016

I'm working on adding folding to the editor. At the beginning of the line we show twisties that signal where you can fold and which ranges are already folded.
The folding arrows are only shown when hovering over the glyph margins. Unfold arrows are always visible.
The current prototype uses the twisties from the file explorer (16x16, arrow-collapse-dark.svg)
The following screenshot is made with the mouse over the glyph margin:
image

The following screenshot also shows git line decorators. The mouse is somewhere in the text area.
image

@aeschli
Copy link
Contributor Author

aeschli commented Feb 11, 2016

@aeschli aeschli added this to the Feb 2016 milestone Feb 11, 2016
@aeschli
Copy link
Contributor Author

aeschli commented Feb 11, 2016

To play around with the prototype, check out the aeschli-folding branch.
In the settings add "editor.folding": true

@Tyriar
Copy link
Member

Tyriar commented Feb 11, 2016

Will themes be able to control the arrow colors? They may clash with certain themes even if there are just standard dark and light versions of them.

@egamma
Copy link
Member

egamma commented Feb 12, 2016

Very nice and the folder regions are even remembered.

I find it somewhat stressful to hit the twisties, they should have a larger hit target area.

@ianwesterfield
Copy link

Along the lines of what @egamma said: To me, the glyphs seem overly inconspicuous. Maybe a bit larger in size would help with the hit area?

@bgashler1
Copy link
Contributor

@aeschli very nice work!

Proposed Design

Here is what I'm thinking on the look and feel. It is based on Visual Studio's experience with code folding.
visual-studio-way

  • We would use a tree view expander and collapse icon
  • #989898 for the line and 1px border-color

Nice to haves:

  • Peak view of the ellipses (see alternative design no. 1 below). This is also done in VS.

Alternative Designs...

1. In-context affordance for folding

This was an interesting idea, but I worry that it may not be scannable as easily to the eyes as a user tries to find where the folding expanders are in his/her code. They may also be confused with code since they are inline. Here it is.
code-folding-02

2. Hierarchical in-context

Some IDE's do a similar approach. I have a competitive analysis doc if you want to take a look.
leaving-it-open-all-the-time

3. Chevrons

As you can see, this could get confusing, especially the more tabbed in you are. It's not clear what each chevron will do, especially in large chunks of a class, for instance.
using-margins

@stevencl, would love your feedback here.

@ianwesterfield
Copy link

@bgashler1, love your first alternative design example with one exception: Please don't fold the closing brace. Atom does this and it really is annoying. Many people have asked that it be left exposed.

@stevencl
Copy link
Member

I too like the look of the first alternative design but does it offer a larger hit area (as per @egamma's suggestion)? Can the user click on the vertical line for example to collapse the region?

Can you also try showing what it looks like if you don't fold the closing brace?

It might also be worth looking at how this works/looks for other languages. For example, will this work just as well with HTML, CSS, Visual Basic (and other languages that don't use punctuation marks as block delimiters)?

@Ristaaf
Copy link

Ristaaf commented Feb 16, 2016

I love the Visual Studio design with plus and minus signs and the line, like the proposal of @bgashler1, however I would like to fold the closing brace too, together with the starting brace replacing both with a hoverable tooltip icon, like visual studio does, so please make that an option.

@LKorowicki
Copy link

Closing brace could be folded like this:

function simpleMethod() { ... }

instead of

function simpleMethod() { ...

I am definitly for folding closing brace.

@bgashler1
Copy link
Contributor

@LKorowicki and @ianwesterfield, I agree that if we show one brace we should show both. @Ristaaf, you bring up a very good point about how VS does it by folding both. These are both very good ideas that we will be considering.

@bgashler1
Copy link
Contributor

@stevencl It's not clear in the pictures here, but I would like to make these expandos slightly larger in VS Code than in VS for this reason. That way users get a visual reassurance that the hit area is larger instead of merely including a large and forgiving hit target. Furthermore, I'm thinking the hit target should be the height of the line with some padding to both the left and the right. I'll post some more images soon that we can discuss.

@Nimzozo
Copy link

Nimzozo commented Feb 16, 2016

Great work @aeschli @bgashler1 ! 👍

I'm 100% sure my favourite is 2. Hierarchical in-context.

  • The [+] / [-] signs are the best because really clear.
  • It helps to see the hierarchy in the code !!

Will this be in the next release ? Or are you doing an extension ?

@ianwesterfield
Copy link

@LKorowicki I'm digging your suggestion for folding the closing brace to the same line, but keeping it visible.

@bgashler1
Copy link
Contributor

@Nimzozo: This will be in the actual product.

@Spown
Copy link

Spown commented Feb 21, 2016

I'm also for Hierarchical folding. On hover shoving/always visible can be a configurable option with either as default. This option is also showing the closing bracket, which is useful even if you are not going to fold. In case of always visible I would still make the controls 50% opacity and 100% if hovered over. The Chevrons kinda defeat the purpose since they introduce the same level of confusion as the level of clarity they bring with them.

Thank you for your hard work!

@bgashler1
Copy link
Contributor

@chrisdias Just added new icons, so perhaps we could make this on by default in the release.

@Tyriar
Copy link
Member

Tyriar commented Feb 23, 2016

Created an issue for folding on a single line #3352, including a comparison with atom, brackets and sublime

@bgashler1 bgashler1 assigned aeschli and unassigned bgashler1 Feb 24, 2016
@aeschli aeschli added the editor-folding Editor code folding issues label Feb 24, 2016
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
editor-folding Editor code folding issues
Projects
None yet
Development

No branches or pull requests

10 participants