I am wondering the difference between these two method: model.onDidChangeContent
vs editor.onKeyUp
So for example, I got two scenarios here:
One thing I am pretty sure is I have to debounce the change (say 500ms) and then call related event handler. However the problem here is i am not sure when event i should use to accomplish these two functionally. Looks like onChange(onInput)
and onKeyUp
most of the time show same behavior.
The event onDidChangeContent
is also triggered for other changes like code actions (e.g. selecting a completion item) or commands (e.g. paste), not only key events. So it's clearly the better choice.