Couldn't you use `insertText` here? It would insert at the cursor location and be less drastic than setting the text of the entire buffer.