You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am creating a snippet that automatically takes the function name below the cursor, and creates a documentation title from the function name.
The snippet creates the title as expected, but it for some reason removes parts of the line the function definition is on. I have narrowed it down to the setSelectionRanges. It seems that for some reason it deletes the selection.
I have tried to move the selection to the beginning of the document, just to make sure its not because its selected at the end of the snippet, but no matter what I do, the setSelectionRanges removes a part of the selection.
One possibility here is that these APIs are (unfortunately) not synchronous -- you might have better luck if you add a short Sys.sleep() call following the calls to setSelectionRanges and insertText.
I am creating a snippet that automatically takes the function name below the cursor, and creates a documentation title from the function name.
The snippet creates the title as expected, but it for some reason removes parts of the line the function definition is on. I have narrowed it down to the
setSelectionRanges
. It seems that for some reason it deletes the selection.I have tried to move the selection to the beginning of the document, just to make sure its not because its selected at the end of the snippet, but no matter what I do, the
setSelectionRanges
removes a part of the selection.To test, run the snippet in the following code:
I expect:
But I get:
RStudio 2023.03.0+386 "Cherry Blossom" Release (3c53477afb13ab959aeb5b34df1f10c237b256c3, 2023-03-09) for CentOS 7
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36
The text was updated successfully, but these errors were encountered: