Replaces text in the the provided Range with a new text string. This method differs from insert() in that it will not move the cursor.
Failing that, it may be necessary to store the initial cursor position then set the cursor position again using the TextEditor scrollToPosition method once the replace operation is complete.
What would be the easiest way to obtain the current cursor position before I trigger the replace function? Is there a func in the API that will do this? TIA
I have found that scrollToPosition is kinda jerky (FOUC) when the replace occurs. I would like it to appear like nothing happens and the code just stays in place.
I have been studying the Prettier extension, which replaces all the content in document with newly formatted code, and it is clean. I will continue to play around with it, but if anyone knows the trick, then please let me(us) know.