jpd
jpd

Reputation: 38

Does VS Code have anything like Atom's addKeystrokeResolver?

Atom has a feature that allows you to intercept keyboard input events and transform them into different keyboard input before Atom does anything with them. Here's an example from Atom's documentation:

atom.keymaps.addKeystrokeResolver ({event}) ->
  if event.code is 'KeyG' and event.altKey and event.ctrlKey and event.type isnt 'keyup'
    return 'ctrl-@'

This code causes Atom to treat ctrl-alt-g as if it were ctrl-@.

(See http://flight-manual.atom.io/behind-atom/sections/keymaps-in-depth/#overriding-atoms-keyboard-layout-recognition)

Does VS Code have anything similar to this?

Upvotes: 0

Views: 356

Answers (1)

Matt Bierner
Matt Bierner

Reputation: 65195

Take a look at what the VSCode vim extension does: https://github.com/VSCodeVim/Vim/blob/aa8d9549ac0d31b393a9346788f9a9a93187c222/extension.ts#L208

It hooks into and overrides VSCode's type command. This is a lower level extension point than atom's keystroke resolvers but it may provide what you are looking for

Upvotes: 1

Related Questions