rstudio/rstudio — pull request #256 by kevinushey (2014-12-16 22:09:04+00:00)
Title: enable 'generic' magrittr pipe completions

This PR allows us to produce autocompletions for 'generic' piped functions, e.g.

(1:10) %>% rnorm(|

The logic is as such:

1. The `getAutocompletionContext` function understands how to find the evaluation context previous to the cursor, so it would find in this case `(1:10) %>% rnorm`. This gets passed down as the first element of `string`, and also is similarly assigned for the `functionCallString`.

2. We strip out everything at and previous to a `pipe` to get the actual function name we want completions for.

3. We let the pre-existing logic run as is.

We also add some special casing for `group_by(foo, |`, so that names from `foo` are completed.