New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Insert Roxygen Skeleton #405
Comments
Hi @assignUser, thank you for the suggestion. This seems like a good fit for a snippet. Users can add their own snippets. Also, snippets can be added to the extension without needing to write TypeScript. Here is a guide on how to create them: https://code.visualstudio.com/docs/editor/userdefinedsnippets#_create-your-own-snippets |
@andycraig Hey thanks for the quick reply. I will look into it but I am not sure that snippets are flexible enough to completely emulate the rstudio function which adds params depending on the function signature. But it is a good quick fix for now I guess 👍 |
@assignUser Oh, I see what you mean. Yes, that would probably require some TypeScript rather than just a snippet. If you decide you want to try implementing this, we can provide advice etc. as needed. |
I guess this could be made much easier to implement if we define some customized requests in language server so that editor clients could query the information of the parsed data of the document at a document point (row, column). Otherwise, detecting the function arguments could be non-trivial in many cases when cursor is somewhere in the function, e.g., cursor at function formals vs. function body, complex function argument default value, cursor at closure in function, cursor at (raw?!) string literal in function. Having access to the language client will make it much easier to implement customized language-related features such as this. Unfortunately, vscode-r-lsp and vscode-R are separate projects. I'm not sure if there's a way to access the language client created in vscode-r-lsp unless we merge the two projects (#98) previously done at https://github.com/renkun-ken/vscode-R/tree/lsp. |
This would come very cheaply with #302. That way we could take advantage or R code that already exists to do this. I know of code in {sinew} and {fnmate}, there's probably a few others. |
@MilesMcBain I didn't know there's already RStudio plugins doing all these. Thanks for letting us know! |
Recently I've been using the RStudio addin in The differences to the built in RStudio behavior are the function object name needs to be selected, and the function needs to exist as an object in the session, e.g. having been placed there by |
It sounds like @MilesMcBain's approach of using the RStudio Addin {docthis} provides this functionality, so I'm going to close this issue as resolved. @assignUser If you feel like any essential functionality is still missing, please feel free to reply and we can re-open. |
@andycraig the use of Rstudio Addins sounds like a good solution for now 👍 ! |
In Rstudio you can insert a roxygen skeleton with the correct param tags via keybind (when the cursor is within a function definition) to create e.g. this:
It would be a nice qol feature for package developers.
I might look into this but I have yet to make the first steps with vsc extension development/ts and wanted to put the idea out here :)
The text was updated successfully, but these errors were encountered: