Insert Roxygen Skeleton
See original GitHub issueIn Rstudio you can insert a roxygen skeleton with the correct param tags via keybind (when the cursor is within a function definition) to create e.g. this:
#' Title
#'
#' @param x 
#'
#' @return
#' @export
#'
#' @examples
exported <- function(x) {
    x + 1
}
It would be a nice qol feature for package developers. I might look into this but I have yet to make the first steps with vsc extension development/ts and wanted to put the idea out here 😃
Issue Analytics
- State:
 - Created 3 years ago
 - Reactions:4
 - Comments:9 (4 by maintainers)
 
Top Results From Across the Web
RStudio:addins part 2 - roxygen documentation formatting ...
Inserting a skeleton - Do this by placing your cursor anywhere in the function you want to document and click Code Tools ->...
Read more >Can RStudio automatically generate an roxygen template for a ...
(Converting @Crops comment into a full answer). In RStudio v0.99 there is a new option under the "Code" menu for .R files: "Insert...
Read more >Insert Roxygen Skeleton · Issue #405 · REditorSupport/vscode-R
In Rstudio you can insert a roxygen skeleton with the correct param tags via keybind (when the cursor is within a function definition)...
Read more >Get started with roxygen2
The goal of roxygen2 is to make documenting your code as easy as possible. R provides a standard way of documenting packages: you...
Read more >David Neuzerling @md@neuzerling.com on Twitter: "In case ...
Put your cursor in the body of the function and hit Code > Insert Roxygen Skeleton. If you add a new parameter you...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@andycraig the use of Rstudio Addins sounds like a good solution for now 👍 !
I guess this could be made much easier to implement if we define some customized requests in language server so that editor clients could query the information of the parsed data of the document at a document point (row, column). Otherwise, detecting the function arguments could be non-trivial in many cases when cursor is somewhere in the function, e.g., cursor at function formals vs. function body, complex function argument default value, cursor at closure in function, cursor at (raw?!) string literal in function.
Having access to the language client will make it much easier to implement customized language-related features such as this. Unfortunately, vscode-r-lsp and vscode-R are separate projects. I’m not sure if there’s a way to access the language client created in vscode-r-lsp unless we merge the two projects (#98) previously done at https://github.com/renkun-ken/vscode-R/tree/lsp.