couchdb-fauxton icon indicating copy to clipboard operation
couchdb-fauxton copied to clipboard

Enhance folding support in JSON editor thru UI hints

Open wohali opened this issue 6 years ago • 6 comments

This was raised recently on the users@ mailing list. Quoting:

Settings for code folding—it’d be nice (for us) to have the JSON documents folded by default. Even better would be the ability to set a preference as to how many levels should be unfolded by default, and saved in the browser’s local storage or something. That would help us a lot in navigating deeply nested JSON documents where the top levels usually have all the data we need when debugging.

Looks like Ace supports code folding already, so that's a plus.

wohali avatar Jul 05 '18 15:07 wohali

To be clear, code folding is already working in Fauxton…but it is a pain, for big documents, to go through and manually fold everything when one could be try to quickly scan many deeply-nested documents. Even a keyboard shortcut or button to fold everything would be a great start.

dahjelle avatar Jul 05 '18 17:07 dahjelle

What do you think about double-clicking the folding button to apply nested folding?

popojargo avatar Jul 05 '18 18:07 popojargo

What do you think about double-clicking the folding button to apply nested folding?

That's definitely be a nice start and an improvement on what is there now!

With our particular data structure, we really want everything below, say, level 2 folded, and everything above that unfolded—but I know if that is a common-enough situation to try write code for.

The double-clicking would definitely be an improvement for us!

dahjelle avatar Jul 05 '18 19:07 dahjelle

@dahjelle @popojargo ACE has some keyboard shortcuts for folding (https://github.com/ajaxorg/ace/wiki/Default-Keyboard-Shortcuts#folding) and they worked for me on Fauxton - e.g. you can fold/unfold all.

Antonio-Maranhao avatar Jul 05 '18 20:07 Antonio-Maranhao

@Antonio-Maranhao Oh, fantastic! That should get documented somewhere. :-D

It's not quite as nice as having the fold level set to what what we want every time, but I think it is workable. Thank you!

dahjelle avatar Jul 05 '18 21:07 dahjelle

I've edited the subject to match - @popojargo that sounds interesting.

wohali avatar Jul 06 '18 04:07 wohali