Skip to content
Prev 11683 / 15075 Next

UI suggestion: allow a tab with no more suggestions to fill in "$"

If you don't see add.fn(), then use this instead which is equivalent:

RGUI = as.environment("tools:RGUI")
RGUI$rcompgen.completion <- function (x) {
comp <- function(x) {
     utils:::.assignLinebuffer(x)
     utils:::.assignEnd(nchar(x))
     utils:::.guessTokenFromLine()
     utils:::.completeToken()
     utils:::.CompletionEnv[["comps"]]
}
res <- unique(comp(x))
if (nzchar(x) && identical(res, x) && !identical(substr(x, nchar(x), nchar(x) + 1L), "$")) {
   rc <- comp(paste0(x, "$"))
   if (!identical(substr(rc, nchar(rc), nchar(rc) + 1L), "$")) res <- rc
}
res
}

Cheers,
Simon