-
Notifications
You must be signed in to change notification settings - Fork 18
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
Race condition with VSpaceCode comma binding (whichkey.triggerKey) #38
Comments
I didn't think user can type faster than the rendering of the QuickPick 😅. This actually was on my mind when deciding different solutions for implementing the shortcut Anyway, I will implement a solution/fix that won't have this race condition for shortcut to major mode. |
Hehe 😊 I guess when already having the keybinding memorized, and when it happens to be on two separate fingers, that doesn't hold true anymore 😄 Thanks for taking a look, let me know if I can help somehow! |
Let me note that this seems like an issue in generic too - not sure if it's fixable though, and if so, whether I should open a separate issue for it. If I hit edit: I can see there's some handling for this kind of case here: vscode-which-key/src/menu/menu.ts Lines 107 to 125 in 9c6ad3a
and indeed it gets much better when I set |
To solving the race condition of entering second key right after
For this case, it can be adjacent to original issue. But let's open another issue to track it. I think the cause of this is probably because multiple
The difference is that vscode-which-key/src/menu/menu.ts Lines 239 to 245 in 9c6ad3a
@The-Compiler Wondering what's the version of vscode you are running? Can you also try which-key version v0.8.4 to see if it's any better? Btw, I am also having trouble reproducing the issue on my computer |
Alright - let's continue that part in #39! |
FWIW I can still reproduce this one even after downgrading to v0.8.4, using |
Thanks for checking in :) This in some sense is easier to fix than #39. We just need to build a proper support to pass in initial keys instead of "simulating" keys pressed with consecutively commands. |
On a second thought, this might be solved with approach outlined in #39 with better input handling (queue). |
Released in It is tested with sleep 1; xdotool type ,; sleep 0.01; xdotool type x;
# or
sleep 1; xdotool type " "; sleep 0.01; xdotool type mx; We have to wait for at least 10ms for the UI input to be shown before we can type. That's the limit of what we can do. |
Seems to work beautifully now, at least from what I can see so far. Thanks! 👍 |
Bug description
It looks like the default
,
binding of VSpaceCode works by opening vscode-which-key, and then (probably asynchronously) sending them
key to it. However, when typing quickly, this can result in a race condition between what which-key does internally and what the user types.To Reproduce
.tex
file (or presumably, any other file with ax
binding for "text"),
x
very quickly(Alternatively, on Linux/X11, run
sleep 1; xdotool type ,x
and then switch focus to VS Code)Expected behavior
Ending up in the "Text" menu:
Screenshots
Ending up in the "Merge conflict" menu:
Additional context
The merge conflict menu is bound to
SPC x m
, so pressing, x
ended up being interpreted asSPC x m
rather thanSPC m x
.Keybindings
Essentially the default recommended in the VSpaceCode readme:
Click to toggle contents of `keybindinds.json`
Settings
Click to toggle contents of `settings.json`
System information
The text was updated successfully, but these errors were encountered: