REditorSupport / REditorSupport/vscode-R

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

Open
#1,451 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature-request
Dominant language
TypeScript
Stars
1.2k
Forks
139
Avg merge
2h 46m
Merged PRs (30d)
5

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Begin at the F2 rename entry point in the VS Code R extension and trace how function arguments and roxygen comments are handled. Use the provided foo example to verify that renaming an argument also updates its @param tag while leaving @returns text unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
r, typescript, vscode
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.