-
Notifications
You must be signed in to change notification settings - Fork 27.9k
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
Select To Next/Previous Command loses terminal focus when invoked from the command palette. #46961
Comments
I don't think it's just the Select to Next / Previous Command. Anytime the command palette is invoked, the focus goes to the workbench(? main window?) and anything else will lose focus. |
@kennyle1412 when the command deals with focus or selection we should definitely make sure focus works. Maybe there's a way we can do this generally @bpasero? |
@Tyriar currently we just always put focus back to the editor which is probably not clever and can be improved. The tricky part is though that some commands actually might operate on the editor and it would make sense to have focus there. So maybe we should find those commands that want to have focus elsewhere and fix those instead of changing it for all. I think it is fair to say that in most cases you want focus back in the editor after quick commands close. |
@Tyriar Then I guess every terminalAction that deals with those things should do a terminal.focus() before it returns. That should work for when the action actually goes though how efficient that is I can't say. However, if the quick command is invoked then cancelled, we'd be out of luck since nothing is executed haha. We can try to save the previousFocus when invoking quick command and refocus previousFocus if the command palette is cancelled (/ nothing selected) instead of forcing it to the editor or only focus the editor if a command is chosen. Though I haven't looked at the quick command code yet so I'm not sure if those are feasible. @bpasero that way we can still focus to the editor in the general case, but don't change anything when the action is cancelled. |
@bpasero how about adding something like this to export interface IAction {
restoreFocus(): TPromise<any>
} Which would be run to restore focus when it's implemented (or noop if not) when escape is pretty or the command is triggered. |
@Tyriar I would stay away from adding anything to Can you not just change focus from your action when it runs? Maybe we need to pass some extra context into the actions that get executed from the command palette. |
@bpasero but there's the case @kennyle1412 brought up where cancelling the command palette will then focus the editor as |
Issue Type: Bug
When invoking
Select to next/previous command
from the command palette, the terminal loses focus and causes confusion.VS Code version: Code - Insiders 1.22.0-insider (952b2a6, 2018-03-29T05:17:25.524Z)
OS version: Windows_NT x64 10.0.16299
The text was updated successfully, but these errors were encountered: