feat(TreeEditor): add keyboard support - arrow key move / expand #74
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.
Hello, and happy Modtoberfest!
This PR adds the ability to navigate the
TreeEditor
with via keyboardUp,Down,Left,Right
orHJKL
(vim keys).I tried to mirror vscode's file tree navigation behavior pretty closely since, well, we're in vscode. (and I think vscode's behavior here is reasonable). A known exception in this current iteration is that
Down
when on the last item in a container doesn't take you to the item after the container. (andDown
when on the root item of a container takes you to that container's sibling, rather than entering the container (Right
is used for that)). This might be worth changing, but I'm fairly happy with where this is at right now.I tried not to restructure things too much, so I computed most of the "next item" fun on the fly, rather than modifying the core tree data structure to support it. (A new structure, or added cache, at least, might be helpful on super big objects, but I think this will be more than fast enough for the vast majority of files.)
Demo!
2024-10-12_14-32-19.c.mp4