question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Insert Roxygen Skeleton

See original GitHub issue

In 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:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
assignUsercommented, Apr 4, 2021

@andycraig the use of Rstudio Addins sounds like a good solution for now 👍 !

1reaction
renkun-kencommented, Sep 1, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found