Package 'fnmate'

Title: Create function definitions from function expressions
Description: Convert any funcntion expression under the cursor to a definition contained in a file.
Authors: Miles McBain [aut, cre], Kirill Müller [ctb], Andrew Craig [ctb], Shir Dekel [ctb]
Maintainer: Miles McBain <[email protected]>
License: MIT + file LICENSE
Version: 0.0.6
Built: 2024-08-27 03:06:50 UTC
Source: https://github.com/milesmcbain/fnmate

Help Index


fnmate_below

Description

Create a definition below for the function used at index.

Usage

fnmate_below(text, index)

Arguments

text

some text from a source file

index

an index into text indicating the cursor position.

Details

Given some text and an index into the text, this function generates text containing a definition for the function used at the index. An error is thrown if no function is found.

By default the function is created in the './R' folder. This can be changed with the 'fnmate_folder' option.

By default the function body contains only NULL. This can be changed with the 'fnmate_placeholder' option.

This function is not intended to be used directly but by the fnmate front end - either Emacs or RStudio.

Value

text containing function definition.

Author(s)

Miles McBain


fnmate_fn.R

Description

Create a definition in file for the function used at index.

Usage

fnmate_fn.R(text, index)

Arguments

text

some text from a source file

index

an index into text indicating the cursor position.

Details

Given some text and an index into the text, this function creates a new file containing a definition for the function used at the index. The file name is the same as the function. An error is thrown if no function is found.

By default the function is created in the './R' folder. This can be changed with the 'fnmate_folder' option.

By default the function body contains only NULL. This can be changed with the 'fnmate_placeholder' option.

This function is not intended to be used directly but by the fnmate front end - either Emacs or RStudio.

Value

Nothing, file created as side effect.

Author(s)

Miles McBain


Jump to a function definition in the local project

Description

Search for a local function definion matching the function the cursor is on, and jump to it, if found.

Usage

rs_fn_defn_jump(context = rstudioapi::getActiveDocumentContext())

Arguments

context

the active document context from rstudioapi

Value

nothing

Author(s)

Miles McBain


rs_fnmate

Description

Generate a function definition file from a function call in RStudio

Usage

rs_fnmate(context = rstudioapi::getActiveDocumentContext())

Arguments

context

from the rstudioapi

Value

nothing.


rs_fnmate_below

Description

Generate a function definition below from a function call in RStudio

Usage

rs_fnmate_below(context = rstudioapi::getActiveDocumentContext())

Arguments

context

from the rstudioapi

Value

nothing.


rs_fnmate_clip

Description

Generate function definition and paste it to the clipboard

Usage

rs_fnmate_clip(context = rstudioapi::getActiveDocumentContext())

Arguments

context

from the rstudioapi

Value

nothing.

Author(s)

Miles McBain