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

Add some controls for expanding/collapsing a section or everything. #22

Open
SpicyLemon opened this issue Sep 29, 2022 · 0 comments
Open

Comments

@SpicyLemon
Copy link
Owner

As a user, I want to be able to expand and collapse the entire keys list so that I can more easily navigate large files.

As a user, I want to be able to expand and collapse a single entry for the same reason.

As a user, I want to be able to provide a flag that starts the explorer out either fully expanded or fully collapsed.

There are four desired actions here.

  • Collapse the entire file. For an object, this would reduce the list down to only the root keys. For a list, this would reduce the list down to just the indexes (e.g. .[0]).
  • Expand the entire file. This would expand everything. It'd look like the explorer currently does when opening a file.
  • Collapse a single entry. This would remove everything from the list that is deeper than the currently highlighted entry. For example, say the JSON is {"foo":[{"bar":true,"baz": 88},{"bar":false,"baz": 3}]}. If the highlighted entry is .foo[0], the collapse would remove .foo[0].bar and .foo[0].baz. In other words, it'd remove any entries that start with .foo[0], but are longer than that.
  • Expand a single entry. This would add entries that are 1 level deeper than the highlighted entry. For example, say the JSON is {"foo":[{"bar":true,"baz": 88},{"bar":false,"baz": 3}]}. If the highlighted entry is .foo, this would add the entries for .foo[0] and .foo[1] (but not any of the .bar or .baz items).

Desired bindings:

  • Collapse the entire file: shift-left
  • Expand the entire file: shift-right
  • Collapse the current entry: left
  • Expand the current entry: right

This will probably use the reload action, but I'm not sure what that command would look like. I'm also not sure how to best keep track of what's been expanded and what's been collapsed.

An alternative to this might be a new mode for the explorer that loads a single level at start, and as you expand a section, it gets rid of the other entries and shows just the selected entry and it's contents one level deeper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant