Skip to content

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) }
@KevinFalzone
Copy link

@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) }

Here is my config :

lazy.lua:

 { 'danymat/neogen', commit = "7528bea" }

plugins/neogen.lua:

require('neogen').setup({})

For me, the problem is due to the file type, which is r and not R and the filename should be r and not R.

@RufusVijayaratnam
Copy link
Author

RufusVijayaratnam commented May 6, 2025

@KevinFalzone

Apologies for the delay, you are absolutely right.

I had tested only on macOS, which brief research indicates uses a case insensitive file system. Testing on Ubuntu demonstrated the issue. I have renamed the file as suggested.

@RufusVijayaratnam RufusVijayaratnam requested a review from danymat May 6, 2025 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants