[Feature request] Folding for very long strings
Closed this issue · 10 comments
String values are sometimes very long in JSONs I have to work with. Multiple pages long.
It would be nice if such strings (occupying 3+ lines?) could be folded so I don't have to scroll rigorously to find where it ends.
It's a bit tricky about where to place the collapse/expand button for such cases.
But maybe you could switch to regular triangle "twisties" like in other folding viewers?
Or move folding buttons to the very left:
It is very neat by the way that a block can be folded both at the opening bracket as well as at the closing one. Sometimes I need to work with JSON from bottom up. And being able to fold blocks as I scroll up would have been very useful.
Working in progress.
This feature I will do with the feature #5. Trying to find a better way to show the result without breaking the origin structure of the json string.
You could probably use here the idea of an extra button for string values from #5.
If a string value happens to have embedded JSON - show the [parse]
button as described in #5.
Otherwise if the value is very large (length > 1024) - show the [→·←]
button.
{ ▼
"data": [→·←] "Here goes some very long string value"
}
When that button is clicked fold the value and replace the button with [← · →]
.
{ ▼
"data": [← · →] "Here goes ... string value"
}
Or something along these lines.
Looks good to me.
The new version(v3.0) has been uploaded. It will coming soon.
You can see the preview HERE
Good job!
I would like to ask however about not folding all the long the strings by default.
I still want to have the [→ str ←]
button. But I would only use it to "hide" individual strings I am not interested in at the moment. Having to click to reveal every long string is tedious.
It would probably make sense to give these "inline buttons" (also for [→ json ←]
) more distinct background. And also change the mouse pointer to "hand" on hover. Currently they don't look at all as clickable controls.
Also the "long string" limit should be higher. It looks like it is currently set to 80 characters.
This feature is mainly needed for very long strings, The ones that make working with JSON inconvenient (excessive scrolling, etc.) A string that takes a few lines on the screen is fine. But if it's longer than that it'd be nice to be able to fold it.
In my setup a full line of text is about 150 characters. I think the "long string" limit should be set to 300 at least.
looks good to me. And I will make the limit configurable.
How about V3.2?
Thanks, it works great in V3.5