Open
Description
If I want to insert text at the end of the currently open document, I can use
id <- rstudioapi::getSourceEditorContext()$id
rstudioapi::insertText(location = Inf, text = "test", id = id)
However, when I'm in a Rmd or Qmd file and the "Visual" mode is selected, nothing happens. No text gets added. This is especially problematic with Qmd files because Visual mode is the default.
Another way to see this issue: rstudioapi::getSourceEditorContext()$selection
always returns [1, 1] -- [1, 1]: ''
when in Visual mode.
Metadata
Metadata
Assignees
Labels
No labels