Steps to Reproduce:
Jumpy Word Mode. Two letter decorations should appear at the start of each wordI am the author of vscode-jumpy (repo). A user has reported that Jumpy does not work in combination with VSCodeVim: wmaurer/vscode-jumpy#1.
It seems that both extensions are doing a registerCommand('type'), but VSCodeVim seems to take priority over vscode-jumpy. Is there are way to manage which extension has priority, so that it can receive and process the keystrokes?
Ideally I want to Jumpy to receive and process the next two keystrokes after enabling Jumpy Word Mode, but then let the rest of the keystrokes forward to VSCodeVim.
We added registerCommand("type") especially to enable vim mode to be implemented from an extension. We didn't want to bake vim mode in the core, and there can be only one handler. We never considered typing being something collaborative (in this case between vscode-jumpy and VSCodeVim). Today, the last one wins.
Could this be changed to something like ahandleKeys function? Something like:
...
vscode.commands.registerCommand("start-mode", () => {
// Latest attached handler receives the keys first.
const subscription = vscode.handleKeys((evt) => {
// event will bubble to the next handler if you don't cancel
evt.stopPropagation()
})
// End subscription to return the key priority to the previous holder.
setTimeout(() => subscription.unsubscribe(), 3000)
})
Would really like to use vscode-jumpy, I imagine this would be fairly easy to implement?
For what it's worth, Atom is able to handle both jumpy and vim emulation (and probably more).
@alexandrudima I'd really like this feature, if you would point me in the right direction in the source and discuss a pull request I'd be glad to work on it.
I have the same precise issue by using my extension (codeacejumper)
I would like to turn off vim keybinding while activating jumpy line or word mode.
Is there any possible solution to do this? (ex: create a extension or set keymap)
Hey, all.
May we have this issue updated, please?
It's has been 2 years, still can't get emacs-keymap work with ace-jump ext, does anyone have solution about this issue ?
If my reading of registerCommand is right, it already seems to implement the stack-like behavior we'd need聽for an extension to temporarily claim the type handler and then return it to the previous claimant (the Ace Jump usecase). https://github.com/Microsoft/vscode/blob/v1.19.3/src/vs/platform/commands/test/commands.test.ts#L25
@alexandrudima am I misunderstanding anything there?
I think there is a separate use case worth discussing though, which is extensions that want to be notified when typing happens but do not need exclusive control over changes to the output buffer. These might be well-served by an onDidType event or similar, which I don't think is provided currently. Thoughts on that, as well?
edit: I'm actually seeing references to an onDidType event that I didn't see in vscode.d.ts, I'll have to see if I can get to that
I like @thieman's ideas, especially (2):
type command handlers pass the ball by invoking the default:type command instead of communicating their intentions back to the calleronWillType and onDidType events to the Extension API
Most helpful comment
It's has been 2 years, still can't get emacs-keymap work with ace-jump ext, does anyone have solution about this issue ?