Skip to content

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

@SpicyLemon

Description

@SpicyLemon

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions