{"action":"created","issue":{"url":"https://api.github.com/repos/emacs-ess/ESS/issues/253","labels_url":"https://api.github.com/repos/emacs-ess/ESS/issues/253/labels{/name}","comments_url":"https://api.github.com/repos/emacs-ess/ESS/issues/253/comments","events_url":"https://api.github.com/repos/emacs-ess/ESS/issues/253/events","html_url":"https://github.com/emacs-ess/ESS/issues/253","id":110250365,"number":253,"title":"Extend sources of auto-completion with ESS-R","user":{"login":"lionel-","id":4465050,"avatar_url":"https://avatars.githubusercontent.com/u/4465050?v=3","gravatar_id":"","url":"https://api.github.com/users/lionel-","html_url":"https://github.com/lionel-","followers_url":"https://api.github.com/users/lionel-/followers","following_url":"https://api.github.com/users/lionel-/following{/other_user}","gists_url":"https://api.github.com/users/lionel-/gists{/gist_id}","starred_url":"https://api.github.com/users/lionel-/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lionel-/subscriptions","organizations_url":"https://api.github.com/users/lionel-/orgs","repos_url":"https://api.github.com/users/lionel-/repos","events_url":"https://api.github.com/users/lionel-/events{/privacy}","received_events_url":"https://api.github.com/users/lionel-/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":22,"created_at":"2015-10-07T15:25:17Z","updated_at":"2015-10-08T12:56:34Z","closed_at":null,"body":"It'd be great to extend the places where auto-completion works in ESS.\r\n\r\nWe could start by looking for `data = x` arguments, and look for the names in `x`. This way, auto-completion would be triggered while writing formulaes in `lm()`. In the following example ESS would propose \"disp\" and \"drat\":\r\n```r\r\nfit <- lm(d|, data = mtcars)\r\n```\r\n\r\nI think this kind of autocompletion should be triggered inside all subcalls, so that it'd work inside `I()` with `lm()`, or inside `aes()` with `ggplot()`.\r\n\r\nTo avoid undesired side effects, we could list the arguments where this kind of completion should take place, for example the \"formula\" argument of `lm()`, `glm()`, the \"mapping\" argument of `ggplot()`, etc. This should be defined in a user-customisable variable.\r\n\r\nThen we should think about pipelines. ggplot and dplyr are used to such an extent in the R community that they deserve special attention. We should recognise ggplot pipelines and enable `aes()` completions based on the layer-level data if it exists, and on the top-level data otherwise.\r\n\r\nWith dplyr we have the additional difficulty that the contents may change down the pipelines, so we should check the results at every step. RStudio developers achieved this with good performance by making sure that each dplyr verb works with zero-row data frames. This way we can eval the pipeline with empty data and check the output names at each step with low cost.\r\n\r\nVitalie, do you think the current framework could be arranged to add such new sources of completion?"},"comment":{"url":"https://api.github.com/repos/emacs-ess/ESS/issues/comments/146532750","html_url":"https://github.com/emacs-ess/ESS/issues/253#issuecomment-146532750","issue_url":"https://api.github.com/repos/emacs-ess/ESS/issues/253","id":146532750,"user":{"login":"lionel-","id":4465050,"avatar_url":"https://avatars.githubusercontent.com/u/4465050?v=3","gravatar_id":"","url":"https://api.github.com/users/lionel-","html_url":"https://github.com/lionel-","followers_url":"https://api.github.com/users/lionel-/followers","following_url":"https://api.github.com/users/lionel-/following{/other_user}","gists_url":"https://api.github.com/users/lionel-/gists{/gist_id}","starred_url":"https://api.github.com/users/lionel-/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lionel-/subscriptions","organizations_url":"https://api.github.com/users/lionel-/orgs","repos_url":"https://api.github.com/users/lionel-/repos","events_url":"https://api.github.com/users/lionel-/events{/privacy}","received_events_url":"https://api.github.com/users/lionel-/received_events","type":"User","site_admin":false},"created_at":"2015-10-08T12:56:34Z","updated_at":"2015-10-08T12:56:34Z","body":"here you go."}}