-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
Switch first and second result in quickOpen if first result is the current editor #159301
base: main
Are you sure you want to change the base?
Switch first and second result in quickOpen if first result is the current editor #159301
Conversation
Another benefit of this reordering is that a quick |
The disadvantage of course is that |
Quite right @nikita-r; I didn't know you could navigate in that list with |
I don't really know how I use it TBH :) the secondary purpose of I have read the issue though and I have a comment on it: consider Angular projects where there are three "paired" files: |
Again good point @nikita-r ! I think if you have multiple files, you would subconsciously expect to have to look in the list (not expect there to be one obviously right answer), or you'd add a distinguisher in the query. I could imagine if I worked with angular I'd learn to just type I consider it very unlikely that the user would want to go to the file they're already in. I feel that when typing that quick open query, I'm specifying the file I want among the other files. Maybe the switching behaviour could be triggered by a non-empty query, and even controlled by settings. In Atom, when I needed this years ago, I ended up making an extension that tweaked the default behavior of the editor. I think VSCode extensions are more constrained (not that that's necessarily a bad thing) so I don't think the same approach is available here. |
824b167
to
8f0c7a6
Compare
I have rebased the branch. The rationale stands: when using the "go to file" picker, when I have typed something to search, I'm unlikely to want to go to the active file, therefore it shouldn't be the first result. This PR switches the first and second results if the first result is the active file. |
Fixes #159299
This code intercepts quick-open pick lists and if the first pick is the same file as the current editor, it switches the first two results.
It's my first attempt to contribute to VSCode therefore it's more of an RFC, I guess. 8-)
To test this, go to quick open (ctrl-p or cmd-p), type something to find a file, open that file, then go to quick open, type the same something as before, and the same file shouldn't be the first pick this time.