I have a function foo with some documentation, using roxygen2.
#' @param a description a
#' @param b description b
foo <- function(a, b, c){
cat(a, b, c)
}
I have written a wrapper, foo_wrapper, whose help file inherit all parameters, but a, from foo. They show as expected in the help file.
#' @inheritDotParams foo -a
foo_wrapper <- function(a, ...){
foo(a = "a", ...)
}
The autocomplete only show the arguments a and ... from foo_wrapper. How can I get it to suggest the parameters from foo instead, i.e. the same parameters that are in the help file from foo_wrapper?
Found this issue which seem related, but not the same problem.
I think the best way to do that is to copy the parameter names, i.e. define
foo_wrapperasThe autocomplete is usually based on the function definition, and
@inheritDotParamshas no effect on the function definition, it only affects the Rd documentation file that is produced.If you are really determined to do it, you could use the methods described in
?rcompgen. For example, runningwill cause the base R GUIs to offer all three arguments as completions. It appears that the RStudio completion code doesn't pay any attention to this. I don't know if there's a way to do it if you're using RStudio.