Capturing keystrokes in visual studio code extension

后端 未结 1 883
灰色年华
灰色年华 2021-01-21 02:34

I would like to be able to capture keystrokes in a visual studio code extension. I need to know the new text that was either added or removed and the position of the change in t

相关标签:
1条回答
  • 2021-01-21 03:21

    I discovered the problem in my original question. I was listening for the wrong event. To get TextDocumentChangeEvents which have a property called contentChanges which returns TextDocumentContentChangeEvents, use this code:

    vscode.workspace.onDidChangeTextDocument(handleChange)
    

    and pass in a function which will be called with a TextDocumentChangeEvent on every change to a file.

    0 讨论(0)
提交回复
热议问题