Quantcast
Channel: Active questions tagged visual-studio-code - Stack Overflow
Viewing all articles
Browse latest Browse all 97327

vscode extension - How to log keystrokes

$
0
0

I am doing user testing for a vscode extension (for some university project) and I need to get a log of the keys that are pressed in the text editor.

I have tried with onDidChangeTextDocument, but that doesn't capture keystrokes that don't modify the document (for instance, Ctrl or Alt). I have also tried to add an event listener to the active text editor like so:

vscode.window.activeTextEditor.addEventListener(('keydown', event => {
  console.log(`KeyboardEvent: ${event.key || event.keyCode}`)
}))

but it doesn't look like activeTextEditor allows to add such function.

Does anyone know if vscode allows to listen for keystrokes?


Viewing all articles
Browse latest Browse all 97327

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>