vscode-R icon indicating copy to clipboard operation
vscode-R copied to clipboard

Rename roxygen `@param` tags at same time as argument names

Open simpar1471 opened this issue 2 years ago • 0 comments

Is your feature request related to a problem? Please describe. If I have a function foo() with some arguments:

#' Do something
#' @param arg1 Description of argument 1
#' @param arg2 Description of argument 2
#' @returns  Sum of `arg1` and `arg2`
foo <- function(arg1, arg2) {
  NULL
}

When I rename arg1 to argument1 using F2, it is renamed elsewhere in the file. However, references to arg1 in the roxygen documentation remain unchanged:

#' Do something
#' @param arg1 Description of argument 1
#' @param arg2 Description of argument 2
#' @returns Sum of `arg1` and `arg2`
foo <- function(argument1, arg2) {
  argument1 + arg2
}

Describe the solution you'd like

When I rename a parameter (e.g. arg1 to argument1) with F2, I would like arg1 to also be renamed in the roxygen documentation after any @params tags. I don't mind if the @returns tag remains unchanged, however:

#' Do something
#' @param argument1 Description of argument 1
#' @param arg2 Description of argument 2
#' @returns Sum of `arg1` and `arg2`
foo <- function(argument1, arg2) {
  NULL
}

Describe alternatives you've considered I can rename the parameter in roxygen documentation myself, but in IntelliJ this 'just works' - so obviously would be nice to have this feature be on par for the VS Code R extension.

Additional context I am using VS Code v1.84.2 and version 2.8.2 of the R extension.

simpar1471 avatar Nov 21 '23 00:11 simpar1471