rstudioapi (version 0.4.0)

getActiveDocumentContext: Get the Active Document Context

Description

Returns information about the currently active RStudio document.

Usage

getActiveDocumentContext()

Arguments

Value

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.

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.