Comments (4)
Yeah I think the second option is something they will do. If I have time I probably willl open an issue and request a unified command.
from vscode-which-key.
You will need to add the following to you shortcut (keybindings.json
).
{
"key": "p",
"command": "whichkey.triggerKey",
"args": {
"key": "p",
"when": "activeEditorIsPinned"
},
"when": "whichkeyVisible && activeEditorIsPinned"
}
We can also choose to bundle this as default so we don't have two separate key for pin and unpin.
Just tested this and apparently, the activeEditorIsPinned
context is unset once the focus exited the editor. So which-key can't the shortcut isn't being triggered (hence, not able to pass the when condition to which-key) when the menu is in focus.
Unfortunately, this is limit of the hack we have to capture context. Either vscode keep activeEditorIsPinned
set or provide a getContext API; otherwise, this is something that we can't do atm.
from vscode-which-key.
Ah that is very sad. But thank you for the investigation, hope there something will happen soon, would be great to have that.
EDIT:
So I had some time and tinkered a bit around and got a hack for that. It basically uses xdotool
to send a key, and that key represents the two toggle states.
keybindings.json
:
{
"key": "f5",
"command": "workbench.action.pinEditor",
"when": "!activeEditorIsPinned",
},
{
"key": "f5",
"command": "workbench.action.unpinEditor",
"when": "activeEditorIsPinned",
},
settings.json
:
{
"key": "p",
"name": "Pin/Unpin editor",
"type": "command",
"command": "workbench.action.terminal.sendSequence",
// without cleaning
"args": { "text": "i;xdotool key F5\n"},
// with cleaning
"args": { "text": "i;xdotool key F5;xdotool key Escape;clear\n"},
},
the ;i
is only to leave the normal
mode of my zsh. I also bound i() { return 0 }
just to not get an error in zshrc
.
I would also like the command to be executed in the background without showing it in the terminal history, but not sure whether this is possible.
from vscode-which-key.
I am glad you are able to find a workaround.
I looked at the vscode api it doesn't seem like they provide anything to extension to know if the editor is pinned. To properly support this, we likely need to do a feature request to vscode for either
- Have programmatic access to the editor pinned state
- Add toggle command to toggle between pin and unpin
from vscode-which-key.
Related Issues (20)
- Show key bindings in menus HOT 3
- Support partial override HOT 1
- triggerKey Not Firing from edamagit HOT 7
- Weird behaviour with Github Pull Request extension HOT 1
- `whichkey.delay` causes a delay in `SPC SPC` shortcut, others seem to be unaffected HOT 6
- Add default binding for `git pull`
- Crash when mixing `key` / `keys` and using `whichkey.sortOrder` HOT 2
- [bug/ feature?]: whichkey.searchBindings should support fuzzy search HOT 2
- [Help Wanted] Show the menu when press g HOT 3
- Debug Transient State gets closed. HOT 4
- Support several menus HOT 4
- Space keybind with vscode-neovim and the Commands option HOT 5
- `bindings` vs `bindingOverrides` and `keys` vs `key` HOT 3
- Ability to specify font for menu "keys" HOT 6
- Typos in commands
- Reliable key sequence handling HOT 2
- Is there a way to have bindings without a doc, and vice versa? HOT 1
- Support initial menu delay HOT 1
- Configure context menu delay? HOT 2
- Code get unselected when menu pops up HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vscode-which-key.