Returns information about an RStudio editor.

getActiveDocumentContext()

getSourceEditorContext()

getConsoleEditorContext()

Value

A list with elements:

idThe document ID.
pathThe path to the document on disk.
contentsThe contents of the document.
selectionA list of selections. See Details for more information.

Details

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.

Note

The getActiveDocumentContext function was added with version 0.99.796 of RStudio, while the getSourceEditorContext and the getConsoleEditorContext functions were added with version 0.99.1111.