Returns information about an RStudio editor.
getActiveDocumentContext()getSourceEditorContext(id = NULL)
getConsoleEditorContext()
A list
with elements:
id | The document ID. |
path | The path to the document on disk. |
contents | The contents of the document. |
selection | A list of selections. See Details for more information. |
The ID of a particular document, as retrieved by documentId()
or similar. Supported in RStudio 2022.06.0 or newer.
The selection
field returned is a list of document selection objects.
A document selection is just a pairing of a document range
, and the
text
within that range.