Add x/u/U commands to hide/unhide/unhide-all nodes#146
Open
YongJieYongJie wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed Feature: Ability to hide and unhide nodes
One of jless's major strength over simple pretty-printing of JSON is the interactivity it provides. This PR adds support for hiding and unhiding of individual map key nodes (based on jq query matching), enhancing the interactivity by allowing user to hide irrelevant nodes to better navigate and view the JSON.
The attached video demonstrates three features:
xto hide individual object keys (ServiceId,ServiceTypeandAvailabilityZones). Notice that the objects keys are hidden across all objects in theServiceDetailsarray.uto undo hiding of the above object keys one at a timeUto undo hiding of all object keys all at once2024.02.06-jless-hiding-unhiding-demo.mp4
Changes
vec<string>field on theflatjsonstruct to storejqpaths for testing which rows to hide.xis pressed, we generate thejqpath for the current node, and push it to the above vector.uis pressed, we pop the last item of the above vector.Uis pressed, we clear the vector.flatjson::next_visible_row()andflatjson::prev_visible_row()to skip over hidden rows.jqpath is included in the vector above.