I think the last rounds of improvement re: function completions were in #819 and #754. For now, the heuristic for deciding whether to treat as a function reference vs. call is based on whether we're inside a list of special functions:
|
static FUNCTIONS_EXPECTING_A_FUNCTION_REFERENCE: &[&str] = &[ |
|
"args", |
|
"debug", |
|
"debugonce", |
|
"formals", |
|
"help", |
|
"trace", |
|
"str", |
|
]; |
Two examples of sites where a user wants a function reference (but gets parentheses anyway) came up in posit-dev/positron#9044 (comment)
library(tidyverse)
penguins |> relocate(where(is.character()))
map(1:3, mean())
The current list only contains functions from the base and utils packages. But tidyselect::where() is a pretty clearcut case. More complicated, but also compelling is purrr::map() (and base equivalents). Not sure which will come first: improving the ad hoc list or improving the whole approach, but opening this as a place to track concrete examples that folks mention.
I think the last rounds of improvement re: function completions were in #819 and #754. For now, the heuristic for deciding whether to treat as a function reference vs. call is based on whether we're inside a list of special functions:
ark/crates/ark/src/lsp/completions/function_context.rs
Lines 158 to 166 in 1577d04
Two examples of sites where a user wants a function reference (but gets parentheses anyway) came up in posit-dev/positron#9044 (comment)
The current list only contains functions from the base and utils packages. But
tidyselect::where()is a pretty clearcut case. More complicated, but also compelling ispurrr::map()(and base equivalents). Not sure which will come first: improving the ad hoc list or improving the whole approach, but opening this as a place to track concrete examples that folks mention.