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

A keybinding when-clause for looking up the position of windows like the panels #111974

Closed
leighmcculloch opened this issue Dec 6, 2020 · 5 comments
Assignees

Comments

@leighmcculloch
Copy link

Could the ability to write "when" expression based on position of windows like the panels be added?

I'm needing this because when the panels are on the right side I want to have different keybindings as when it is on the bottom. I'm mirroring TMUX bindings so when I press CTRL-A H when the panel is on the right I want it to move to the editor, but at the bottom I want it to move to split terminals.

@leighmcculloch leighmcculloch changed the title Add ability to write "when" expression based on position of windows like the panels A keybinding when-clause for looking up the position of windows like the panels Dec 6, 2020
@leighmcculloch
Copy link
Author

I looked in the source code and discovered there is already a context that provides this, panelPosition. It's defined here:

export const PanelPositionContext = new RawContextKey<string>('panelPosition', 'bottom');

This context is not included in the documentation however, so maybe it should be added there. See:
https://code.visualstudio.com/docs/getstarted/keybindings#_when-clause-contexts

Is there anyway to programmatically list all the available contexts for updating the documentation?

@ArturoDent
Copy link

ArturoDent commented Dec 7, 2020

It may not be a direct answer to your question but should help in the future, see https://stackoverflow.com/a/62202897/836330

By following those steps you could see a panelPosition: "bottom" context key for example. You would have to scroll through the list and see if something was on point.

@leighmcculloch
Copy link
Author

leighmcculloch commented Dec 7, 2020

@ArturoDent Thanks for replying and for providing the StackOverflow link, that was really helpful. As I noted above (#111974 (comment)) I found the solution, to use the panelPosition context key, and it is working perfectly! I'll use the developer options tip that you linked to next time.

I think this issue should probably be converted into a documentation issue. It's odd that the official documentation provides a non-exhaustive list of when-clause contexts. Is there a reason the list cannot be exhaustive given that the values are in the code and could be extracted?

Alternatively, there could be information in the official docs about how to use the developer options to identify when-clauses.

@usernamehw
Copy link
Contributor

There's is an open issue for autocomplete in vscode repo #9303. And I think there are multiple issues in https://github.com/microsoft/vscode-docs for documenting all context keys.

@leighmcculloch
Copy link
Author

Thanks! Sounds great. I'll close this then.

@github-actions github-actions bot locked and limited conversation to collaborators Jan 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants