Skip to content

This commit adds support for R with roxygen2 annotations #217

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

RufusVijayaratnam
Copy link

@RufusVijayaratnam RufusVijayaratnam commented Apr 18, 2025

fixes #216
Always adds 'return' tag.

  • R always returns a value, even with no return statement, and even if you call invisible(...) at the end of the function. Always adds 'export' tag
  • Export tag added because it is easier to delete a line then type "#'" as for most people I expect the single quote will autoclose

Always adds @return tag.
- R always returns a value, even with no return statement, and even if
  you call invisible(...) at the end of the function.
Always adds @export tag
- Export tag added because it is easier to delete a line then type "#'"
  as for most people I expect the single quote will autoclose
@KevinFalzone
Copy link

I encountered an issue with your code. I had to rename the file from R.lua to r.lua. It's also possible to write it like this if you want to keep R.lua:

require('neogen').setup({
  languages = {
    ['r'] = require('neogen.configurations.R')
  }
})

@RufusVijayaratnam
Copy link
Author

@KevinFalzone Can you please share how you have installed / are configuring neogen? Using Lazy.nvim I have the following (using my fork for now):

return {
  'RufusVijayaratnam/neogen',
    -- dir = vim.fn.expand("~/dev/neogen"),
    config = true,
    dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-treesitter/playground' },
    cmd = "Neogen",
}

And this functions correctly if I open an R file an run the command :Neogen which results in:

#' @title
#' @description
#' @param x
#' @param y
#' @param ...
#' @return
#' @export
myfunc <- function(x, y, ...) {
    return(x + y)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for R with roxygen2 annotations
3 participants