Skip to contents

Reads the current file using the rstudioapi, which works in RStudio, Positron and VS Code (with the vscode-r extension).

Usage

btw_tool_read_current_editor(selection = TRUE, consent = FALSE)

Arguments

selection

Should only the selected text be included? If no text is selected, the full file contents are returned.

Boolean indicating whether the user has consented to reading the current file. The tool definition includes language to induce LLMs to confirm with the user before calling the tool. Not all models will follow these instructions. Users can also include the string @current_file to induce the tool.

Value

Returns the contents of the current editor.