Add 'function_wrap' wrap shortcut - #63
Conversation
| for (s in a$selection) | ||
| rstudioapi::insertText(location = s$range, text = sprintf("%s%s%s", prefix, s$text, postfix)) | ||
|
|
||
| return(a) |
There was a problem hiding this comment.
can you return this as invisible(a) please. It shouldn't bother with your addin and will not have any unintended outputs in other functions.
| return(a) | ||
| } | ||
|
|
||
| #' Function Wrap |
There was a problem hiding this comment.
please fill in the documentation in the same fashion as other exported functions in the package including an example. you can see one here to mimic. There must be an example for the package to be updated in CRAN.
|
thank you for the pull request. please follow the contribution instructions and add all relevant files to the pull request. |
|
Thank you for the feedback; will update and resubmit |
|
From my perspective it would make sense to have something that allows that behaviour with other symbol like Also, I wonder if we could pimp this with an So that the user is interactively asked for the function name, and it is pasted back in the document. What do you folks think? On another hand, it might be out of scope for |
|
Yes, maybe this is beyond the focus of rmarkdown. It seems useful to allow this function with multiple different symbols. Besides I really wish I could do this in the console, but can't see how. This sounds analogous to rstudio 'extract function' and 'extract variable' shortcuts. Thanks for the consideration. |
Add a function called 'function_wrap' that places parentheses around a given text selection and moves to cursor to a position immediately before the newly added parentheses
I often would like to wrap a text selection in a function call. One extremely common case is a call to
Viewfor a given R object from the console. This pull request makes this process smoother. I accomplish this with a slight modification to theenclosefunction (returning the selection)