rstudio / rstudio

RStudio is an integrated development environment (IDE) for R
https://posit.co/products/open-source/rstudio/
Other
4.68k stars 1.09k forks source link

Pressing tab to show possible function arguments doesn't work when on a new line #15141

Closed dvg-p4 closed 1 month ago

dvg-p4 commented 1 month ago

System details

RStudio Edition : Desktop (and server)
RStudio Version : 2024.04.2+764 (and every other version I've used)
OS Version      : MacOS 14.6.1 (and Rocky 8 Linux)
R Version       : 4.4.1 (and every other version I've used)

Steps to reproduce the problem

In a .R file (or .Rmd file within a code block) type: glm([return]

Rstudio will automatically add the closing brace and an indent, as desired. (| represents the cursor):

glm(
  |
)

Then, press the "tab" key.

Describe the problem in detail

An additional indent is inserted:

glm(
    |
)

Describe the behavior you expected

A list of function arguments pops up, as when pressing tab within function arguments without a newline, e.g. typing glm([tab] yields

image
dvg-p4 commented 1 month ago

This is especially annoying since the situation in which this feature is the most needed -- a function that takes a large number of arguments -- is also the situation in which I'm most likely to want to spread out the arguments across multiple lines, in accordance with https://style.tidyverse.org/syntax.html#long-lines

kevinushey commented 1 month ago

Do you have this preference checked?

Screenshot 2024-09-11 at 9 25 14 AM
dvg-p4 commented 1 month ago

...yes, but if I also turn on "Use tab for multiline autocompletions" directly below it, that produces exactly the behavior I want and completely solves my problem. Thanks!

dvg-p4 commented 1 month ago

I'd argue that should be on by default, but I don't feel super strongly about that since I've already gotta muck around with the settings to turn on vim keybinds at every new place I use Rstudio in, so it's not much additional hassle to me personally :-)

dvg-p4 commented 1 month ago

...actually, it looks like I'm the third person to file a ticket not realizing this was an option (oops, should've searched) and a couple of my coworkers said that they were unaware this was an option and definitely want to turn it on now that they know what it is. So maybe I do feel strongly that it should be on by default.