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-11-25 02:52:31 UTC |
Source: | https://github.com/milesmcbain/fnmate |
Create a definition below for the function used at index.
fnmate_below(text, index)
fnmate_below(text, index)
text |
some text from a source file |
index |
an index into text indicating the cursor position. |
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.
text containing function definition.
Miles McBain
Create a definition in file for the function used at index.
fnmate_fn.R(text, index)
fnmate_fn.R(text, index)
text |
some text from a source file |
index |
an index into text indicating the cursor position. |
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.
Nothing, file created as side effect.
Miles McBain
Search for a local function definion matching the function the cursor is on, and jump to it, if found.
rs_fn_defn_jump(context = rstudioapi::getActiveDocumentContext())
rs_fn_defn_jump(context = rstudioapi::getActiveDocumentContext())
context |
the active document context from rstudioapi |
nothing
Miles McBain
Generate a function definition file from a function call in RStudio
rs_fnmate(context = rstudioapi::getActiveDocumentContext())
rs_fnmate(context = rstudioapi::getActiveDocumentContext())
context |
from the rstudioapi |
nothing.
Generate a function definition below from a function call in RStudio
rs_fnmate_below(context = rstudioapi::getActiveDocumentContext())
rs_fnmate_below(context = rstudioapi::getActiveDocumentContext())
context |
from the rstudioapi |
nothing.
Generate function definition and paste it to the clipboard
rs_fnmate_clip(context = rstudioapi::getActiveDocumentContext())
rs_fnmate_clip(context = rstudioapi::getActiveDocumentContext())
context |
from the rstudioapi |
nothing.
Miles McBain