radian
radian copied to clipboard
Autocomplete to include parentheses?
Any way to set in the settings that autocomplete finishes function calls by providing the () at the end of a function name? I'm so used to having this feature that it always causes bugs in my code when working with rice
Do you mean pairing opening brackets and close brackets?
Yes
There is no such feature right now. It should not be hard to implement it in a similar fashion of the auto match feature of Rstudio. 😎 AFAIK, other repls such as julia and IPython also do not auto match brackets. It keeps me wonder why....
I can see why developers might want to limit bracket matching, sometimes they can be a pain when you don't need a second bracket. Especially the case for quotations though.
Ah, I understand why other repls do not support auto bracketing. It is mostly because a terminal, in general, cannot distinguish between typing and pasting. For example, copying and pasting foo( may end up with foo() unless the terminal supports bracketed paste mode and the user triggers BPM correctly. There are more bizarre situations when multiple lines are involved.
Yes, it is possible to support auto bracketing. But there are also use cases that auto bracketing becomes problematic.
With that said, I have added a new setting rice.auto_match with the default value set as FALSE.
Check out the dev version and try.
@randy3k This is great. I really appreciate you doing that. I wanted to say though that my original idea was that when you TAB-ENTER to autocomplete a function it would also provide the open and closing brackets for that function and place your cursor in-between those brackets. The console in Rstudio does this and I've posted a gif of what I mean below:
![]()
Currently, rice will auto complete the function name but not provide the opening and closing brackets.
![]()
Thanks for your time, and I understand if that's a little bigger than intended.
Oic, rice uses R internal completion system and the system tells nothing about what is being suggested, eg whether the suggestion is a variable or a function.
I am afraid that it is impossible by now unless we implement a new completion system, which won’t happen any time soon.
ahhh I see, well great. Thanks for implementing the bracket auto-complete
This would be really great to have. Saving some keystrokes in the long run :)
Hi Randy! It's been a few years and I love this tool you have created. I wanted to check in and see if there have been any changes to the codebase that would allow this functionality?
unfortunately, there were not many changes in the completion system to allow this.
I have the same issue as @dylanjm and it is a breaker for me as I am so used to using autocomplete at the RStudio console and having the brackets added automatically. Muscle memory!
Great solution!!!
It works fine with these settings in VS code:
R version 4.2.3 (2023-03-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.2 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0
locale:
[1] LC_CTYPE=es_ES.UTF-8 LC_NUMERIC=C
[3] LC_TIME=es_CL.UTF-8 LC_COLLATE=es_ES.UTF-8
[5] LC_MONETARY=es_CL.UTF-8 LC_MESSAGES=es_ES.UTF-8
[7] LC_PAPER=es_CL.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=es_CL.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
is this supposed to work now? do I just have to update radian? :)