Is it possible to get code completion for R in Emacs ESS similar to what is available in Rstudio?

后端 未结 3 1268
终归单人心
终归单人心 2020-12-14 06:28

Rstudio has a great code completion feature. It provides a quick view of functions that start with a given string, as well as function and parameter definitions.

ESS

相关标签:
3条回答
  • 2020-12-14 07:18

    You do get the completion thanks to the rcompgen package by Deepayan (now "promoted" into base R as part of the utils package). So when I type

    lm(
    

    and hit TAB a new buffer opens which gets me the left-hand side of your window above: the available options to the function at hand. I don't think you can show the help directly though.

    There is / was also a way to get context-sensitive help in the mini-buffer when typing but I have forgottten how/where that gets turned on.

    0 讨论(0)
  • 2020-12-14 07:19

    [EDIT: This is an old answer and auto-complete package dropped out of fashion since then. Please use company-mode instead. It should work by default. Wiki configuration entry is here.]

    Recent versions of ESS (> v.12.02) integrate with auto-complete package out of the box (you need not configure anything, just install auto-complete). It provides help on arguments as well as function help. I added detailed instructions to the wiki

    Ess-ac screenshot

    enter image description here

    Ess-eldoc was also rewritten and from v.12.02 it's active by default, so you don't need to configure anything.

    0 讨论(0)
  • 2020-12-14 07:28

    Or maybe we should all use search:

    Emacs autocomplete-mode extension for ESS and R

    I don't want to be grumpy, I found this few hours ago and I'm still shocked. It works like a charm. Though I still prefer the old-style pop-ups. =)

    0 讨论(0)
提交回复
热议问题