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

Keybind with when: panelPosition == right doesn't work #143357

Closed
dankox opened this issue Feb 18, 2022 · 6 comments
Closed

Keybind with when: panelPosition == right doesn't work #143357

dankox opened this issue Feb 18, 2022 · 6 comments
Assignees
Labels
layout General VS Code workbench layout issues under-discussion Issue is under discussion for relevance, priority, approach

Comments

@dankox
Copy link

dankox commented Feb 18, 2022

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.64.2, 1.65.0-insider (Universal)
  • OS Version: macOS Big Sur 11.6

Steps to Reproduce:

  1. Setup keybindings like this:
    {
        "key": "shift+alt+j",
        "command": "workbench.action.moveSidePanelToPanel",
        "when": "panelPosition == 'right'"
    },
    {
        "key": "shift+alt+j",
        "command": "workbench.action.movePanelToSidePanel",
        "when": "panelPosition == 'bottom'"
    }
  1. Open terminal panel and hit Shift + Option + J, it will move the panel to the side panel on the right side
  2. Hit Shift + Option + J again and nothing happend. It should move it back to the bottom.
  3. If the when condition is removed for moving it to the bottom and the other keybind is disabled, it works. So it seems like the panelPosition == 'right' is not recognized.

This worked on older versions of vscode. After the upgrade I had to update the commands (as explained in the release notes about new side panel), but I kept the when condition the same.

I know there were several issues with this which were fixed. And I also found this issue #142749 which reference the same problem but was closed as duplicate referencing other issue which doesn't seem like the same thing (the desrcription was about resizing, not moving and the commits associated with it also does not reference any panel position properties). It was mentioned also that the problem was not reproduced in the insider version. However, I can reproduce it in the insider obtained from the webpage.

@gjsjohnmurray
Copy link
Contributor

/assign @sbatten

@ArturoDent
Copy link

ArturoDent commented Feb 21, 2022

Those commands:

View: Move Views From Side Panel To Panel
workbench.action.moveSidePanelToPanel

View: Move Views From Panel To Side Panel
workbench.action.movePanelToSidePanel

don't move the Panel. They move the views within the Panel to the Side Panel or vice versa. That is more clear when you look at the command descriptions rather than the command ids.

It does appear as if the Panel is moving because it closes automatically once all the views within it are moved elsewhere.

So the panelPosition context key never changes with the above commands. Your keybinding with "when": "panelPosition == 'right'" will never be triggered (assuming you have the Panel at the bottom to start with).

What are you trying to accomplish? If you want to move the Panel from the bottom to the side or vice versa use:

{
  "key": "shift+alt+j",
  "command": "workbench.action.positionPanelBottom",
  "when": "panelPosition == 'right'"
},

{
  "key": "shift+alt+j",
  "command": "workbench.action.positionPanelRight",
  "when": "panelPosition == 'bottom'"
}

@sbatten sbatten added under-discussion Issue is under discussion for relevance, priority, approach layout General VS Code workbench layout issues labels Feb 21, 2022
@sbatten
Copy link
Member

sbatten commented Feb 21, 2022

all the information from @ArturoDent is correct, but its a good callout of some UX ambiguity

@dankox
Copy link
Author

dankox commented Feb 22, 2022

@ArturoDent Thanks for explaining, it does make sense and I thought that probably I will need another condition to do this, but I couldn't figure out what that should be. Also vscode is reporting that I have duplicate keybind so I assumed that the condition probably stopped work (before it was ok).

What I'm trying to accomplish is to have one keybind to "move" the panel (terminal and all the other panels) to the side and back. Before I was able to do it with one keybind and the condition as shown in the description of the problem. I had it as a "toggle", swapping to side and bottom when necessary.
So I would like to know what kind of condition could I use to determine where the panel (or terminal view) is currently located. Is there such option now, or it's impossible after the panel change? Thanks for letting me know.

Sorry... totally misread the last comment. Thanks for the help with this.

@sbatten
Copy link
Member

sbatten commented Feb 22, 2022

@ArturoDent has provided the recommended keybindings for the scenario that you want to move the panel instead of moving the views to the side panel. (Side panel name is leading to confusion and will likely be revisited soon).

@dankox
Copy link
Author

dankox commented Feb 22, 2022

@sbatten @ArturoDent I'm so sorry, I didn't really realized the shortcuts are different. Now I see. I just misread it sorry.
Yeah that works for me, so that's fine and this issue can be closed and thanks a bunch for the help.

@sbatten sbatten closed this as completed Feb 22, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Apr 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
layout General VS Code workbench layout issues under-discussion Issue is under discussion for relevance, priority, approach
Projects
None yet
Development

No branches or pull requests

4 participants