Skip to content
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

Add sidebarFocus, panelFocus, a real editorFocus and focus for each view #59858

Closed
octref opened this issue Oct 2, 2018 · 9 comments
Closed
Assignees
Labels
feature-request Request for new features or functionality keybindings VS Code keybinding issues on-testplan
Milestone

Comments

@octref
Copy link
Contributor

octref commented Oct 2, 2018

Related: #44796 (comment)

I opened #59270 to add 4 commands:

  • workbench.action.previousPanelView
  • workbench.action.previousSidebarView
  • workbench.action.nextPanelView
  • workbench.action.nextSidebarView

The way I want it to work:

Ctrl-[:

  • workbench.action.previousPanelView when panelFocus
  • workbench.action.previousSidebarView when sidebarFocus
  • workbench.action.previousEditor when editorFocus

Ctrl-]:

  • workbench.action.nextPanelView when panelFocus
  • workbench.action.nextSidebarView when sidebarFocus
  • workbench.action.nextEditor when editorFocus

They are impossible because of many keybinding issues:

  • We only have filesExplorerFocus for sidebar views. It's not even explorerFocus, meaning that focusing on Open Editors or Outlines doesn't work
  • We only have terminalFocus for panel views.
  • editorFocus applies to the input box in search view, input in debug console, etc. There is no context key for editorFocus
  • activeViewlet and activePanel do not help. For example, if I have both sidebar and panel open, activeViewlet always wins in the following setting, even if I'm focused on terminal.
[
    {
        "key": "cmd+]",
        "command": "workbench.action.nextEditor"
    },
    {
        "key": "cmd+[",
        "command": "workbench.action.previousEditor"
    },
    { "key": "cmd+]", "command": "workbench.action.nextSidebarView", "when": "activeViewlet == workbench.view.explorer" },
    { "key": "cmd+]", "command": "workbench.action.nextSidebarView", "when": "activeViewlet == workbench.view.search" },
    { "key": "cmd+]", "command": "workbench.action.nextSidebarView", "when": "activeViewlet == workbench.view.scm" },
    { "key": "cmd+]", "command": "workbench.action.nextSidebarView", "when": "activeViewlet == workbench.view.debug" },
    { "key": "cmd+]", "command": "workbench.action.nextSidebarView", "when": "activeViewlet == workbench.view.extensions" },
    { "key": "cmd+[", "command": "workbench.action.previousSidebarView", "when": "activeViewlet == workbench.view.explorer" },
    { "key": "cmd+[", "command": "workbench.action.previousSidebarView", "when": "activeViewlet == workbench.view.search" },
    { "key": "cmd+[", "command": "workbench.action.previousSidebarView", "when": "activeViewlet == workbench.view.scm" },
    { "key": "cmd+[", "command": "workbench.action.previousSidebarView", "when": "activeViewlet == workbench.view.debug" },
    { "key": "cmd+[", "command": "workbench.action.previousSidebarView", "when": "activeViewlet == workbench.view.extensions" },
    { "key": "cmd+]", "command": "workbench.action.nextPanelView", "when": "activePanel == workbench.panel.markers" },
    { "key": "cmd+]", "command": "workbench.action.nextPanelView", "when": "activePanel == workbench.panel.output" },
    { "key": "cmd+]", "command": "workbench.action.nextPanelView", "when": "activePanel == workbench.panel.repl" },
    { "key": "cmd+]", "command": "workbench.action.nextPanelView", "when": "activePanel == workbench.panel.terminal" },
    { "key": "cmd+]", "command": "workbench.action.nextPanelView", "when": "activePanel == workbench.panel.comments" },
    { "key": "cmd+]", "command": "workbench.action.nextPanelView", "when": "activePanel == workbench.view.search" },
    { "key": "cmd+[", "command": "workbench.action.previousPanelView", "when": "activePanel == workbench.panel.markers" },
    { "key": "cmd+[", "command": "workbench.action.previousPanelView", "when": "activePanel == workbench.panel.output" },
    { "key": "cmd+[", "command": "workbench.action.previousPanelView", "when": "activePanel == workbench.panel.repl" },
    { "key": "cmd+[", "command": "workbench.action.previousPanelView", "when": "activePanel == workbench.panel.terminal" },
    { "key": "cmd+[", "command": "workbench.action.previousPanelView", "when": "activePanel == workbench.panel.comments" },
    { "key": "cmd+[", "command": "workbench.action.previousPanelView", "when": "activePanel == workbench.view.search" }
]
@octref octref added the keybindings VS Code keybinding issues label Oct 2, 2018
@octref
Copy link
Contributor Author

octref commented Oct 2, 2018

/cc @isidorn @sandy081 @bpasero since this touches every view in sidebar/panel. I'm wondering if it's possible to generate a focus context key for each view, as implementing it in each view seems redundant.

@bpasero
Copy link
Member

bpasero commented Oct 3, 2018

I'm wondering if it's possible to generate a focus context key for each view, as implementing it in each view seems redundant.

Yes, possibly in the base class of all panels and views (composite.ts?)

How does this work when an extension contributes a view?

@octref
Copy link
Contributor Author

octref commented Oct 3, 2018

Maybe focusedViewlet and focusedPanel similar to activeViewlet and activePanel, and make workbench.view.<viewId> available for contributed views?

Together with a sidebarFocus and panelFocus that's managed by sidebar/panel part this would solve my problems and open up a lot of customization possibilities.

@sandy081
Copy link
Member

sandy081 commented Oct 3, 2018

All views in the side bar do not extend Composite, they are Panel (Split View Panels).

@isidorn
Copy link
Contributor

isidorn commented Oct 3, 2018

@octref your last comment makes sense.
Let's assign this issue to you so you can tackle it with a PR, and I can review. If you do not have time let me know and I can look into this.
Any way this should not be assigned to Alex

@isidorn isidorn assigned octref and unassigned alexdima Oct 3, 2018
@isidorn isidorn added the feature-request Request for new features or functionality label Oct 3, 2018
@octref
Copy link
Contributor Author

octref commented Oct 22, 2018

Actually focusedViewlet and focusedPanel can be expressed through sidebarFocus + activeViewlet = <viewletId>, so I guess adding sidebarFocus and panelFocus would be enough.

@octref
Copy link
Contributor Author

octref commented Oct 22, 2018

Thinking on this again, sidebarFocus + activeViewlet = focusedViewlet, so I guess we can skip activeViewlet/activePanel.

isidorn added a commit that referenced this issue Oct 23, 2018
@octref
Copy link
Contributor Author

octref commented Oct 23, 2018

For those who are interested, here's my config:

[
  { "key": "cmd+]",                 "command": "workbench.action.nextEditor" },
  { "key": "cmd+[",                 "command": "workbench.action.previousEditor" },
  {
    "key": "cmd+]",
    "command": "workbench.action.nextSidebarView",
    "when": "sidebarFocus"
  },
  {
    "key": "cmd+[",
    "command": "workbench.action.previousSidebarView",
    "when": "sidebarFocus"
  },
  {
    "key": "cmd+]",
    "command": "workbench.action.nextPanelView",
    "when": "panelFocus"
  },
  {
    "key": "cmd+[",
    "command": "workbench.action.previousPanelView",
    "when": "panelFocus"
  }
]

@octref octref closed this as completed Oct 23, 2018
@isidorn isidorn added this to the October 2018 milestone Oct 24, 2018
@isidorn
Copy link
Contributor

isidorn commented Oct 24, 2018

@octref I would definentely add this to the release notes, maybe even with your customisation to make it more easy for people to navigate.
Great job.

@octref octref added verification-needed Verification of issue is requested on-testplan and removed verification-needed Verification of issue is requested labels Oct 24, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Dec 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality keybindings VS Code keybinding issues on-testplan
Projects
None yet
Development

No branches or pull requests

5 participants