Fixes #69843 - Navigate File Search History #88307
Closed
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.
This pull request implements a possible solution to issue #69843. Note that this is simply an idea for a solution, I made some assumptions that may not be true for other users. I mention these points in the "Doubts/Talking points" section of this PR.
Summary of the feature request
It was requested that when searching for a file (through
Cmd+p
orCtrl+p
) it should be possible to go back (and forward) through the inputed filenames (such as is possible in the Atom text editor).Overview of the solution
I added an array to
QuickOpenController
to store thelastSubmittedInputValue
. The value is stored each timeonOK()
executes.The array always begins and ends with an empty string
''
so that when the user goes beyond the very first submitted input value, theQuickOpenWidget
search bar is cleared (same reasoning for when the user goes too far forward in the history).The
navigateInputHistory
method I added to theQuickOpenController
is the code that handles navigating the array.How to test
To test this out, open a folder with vscode and add a custom keybinding in
User/keybindings.json
similar to:You can then:
enter
to open up each of those filesCmd+p
Cmd+z
(and laterCmd+y
) to ensure that the keybindings correctly go back and forth in the list of filenames you previously submitted and hitenter
with.Doubts/Talking points
enter
, then search for "A" again and hitenter
again. The way this solution is implemented, "A" would show up twice in a row in the history which is kind of ugly.alt+up/down
to work as a shortcut on my machine, that just kept navigating me through the list of found files.