vimish-fold icon indicating copy to clipboard operation
vimish-fold copied to clipboard

Fold over folds

Open vermiculus opened this issue 8 years ago • 11 comments

It's perfectly understandable that you shouldn't be able to make partial-intersect folds [ ( ] ), but there's no good reason to not support superset folds [ ( ) ].

vermiculus avatar Oct 02 '15 05:10 vermiculus

@vermiculus, This is possible and it should be quite easy to change a couple of lines to allow that. That said, I still think it may be confusing. Maybe we could have a customization option to enable this behavior. Thanks for the suggestion.

mrkkrp avatar Oct 02 '15 05:10 mrkkrp

Highly support it. Just a common example of use case:

public class SomeClass {
    public T1 Member1() {
        // ...
    }
    public T2 Member2() {
        // ...
    }
}

It's natural to fold Member1, Member2 separately, but also have an opportunity to fold SomeClass.

P. S. So far I like vimish-fold. So thanks a lot for it :)

d12frosted avatar Oct 02 '15 10:10 d12frosted

Yes, vimish-fold is quite lovely :) First folding package that I haven't hated and I've used emacs for years.

I don't think it would be confusing – Org effectively does the same thing. The thing to note is that Org takes care to differentiate the different levels somehow. Since we're making the indication in the fringe, we can't use any variation of the * approach used by Org (not enough room) but we can imitate its color:

_  // hello
r public class SomeClass {
g     public T1 Member1() {
g         // ...
g     }
r     // things
g     public T2 Member2() {
g         // ...
g     }
r }
_  // goodbye

vermiculus avatar Oct 02 '15 12:10 vermiculus

@vermiculus, OK, I'll see how to make it decently when I have time to hack it. We could have option to allow nested folds and also we could detect level of nesting and adjust color of fringe, so for example most nested folds would have brightest indication.

I mostly find this package satisfactory too, although I'm still not sure if C-g was a good choice for toggling, but that's another issue.

Thanks for the feedback.

mrkkrp avatar Oct 02 '15 13:10 mrkkrp

Sorry for any confusion, this feature is added to the version 3.0?

It would be great if so, however I can imagine this is hard to achieve it.

ReneFroger avatar Nov 23 '15 13:11 ReneFroger

@ReneFroger, Well, this will requite some work indeed. I'm currently busy with other things. Addition of this feature will happen some day, but I don't put deadlines on my open-source work, so I cannot give you any estimations when it will happen.

mrkkrp avatar Nov 23 '15 13:11 mrkkrp

Little bump here, I want this nested feature.

I just forked the repo, I can't see why you would put the error given when finding nested folds, it seems to work without it. Any reason I am not seeing maybe ?

Monkeypac avatar Nov 29 '17 22:11 Monkeypac

@Monkeypac, I'm afraid I do not remember the context now. I certainly do not have the time to work on this myself, but I'll accept a PR implementing the feature.

I personally find nested folding confusing, so if you open a PR, please add a customization option that allows to enable/disable the feature. I'm in favor of disabling it by default.

mrkkrp avatar Nov 30 '17 07:11 mrkkrp

it's been 3 years, is there a reason @Monkeypac never opened a PR. I'd open an issue on his repo, but he doesn't seem to have an issue tracker.

mohkale avatar Feb 22 '20 09:02 mohkale

I did open a PR, see https://github.com/mrkkrp/vimish-fold/pull/44 As we decided, I cloned the repo and kept my work on my github at https://github.com/Monkeypac/vimish-fold

I don't have an issue tracker as estimate my work being something kinda ugly and not specifically to share and I don't use it much anymore so it might be buggy. Feel free to clone.

Monkeypac avatar Feb 22 '20 09:02 Monkeypac

I see, thnx for the great work :).

mohkale avatar Feb 22 '20 09:02 mohkale