Skip to content
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

Could not get neogen to work with LazyVim #172

Open
AlbertNg02 opened this issue Apr 24, 2024 · 4 comments
Open

Could not get neogen to work with LazyVim #172

AlbertNg02 opened this issue Apr 24, 2024 · 4 comments
Labels
question Further information is requested

Comments

@AlbertNg02
Copy link

image Screenshot 2024-04-24 at 11 59 39 AM

My configs are:

{
    "danymat/neogen",
    config = true,
    -- Uncomment next line if you want to follow only stable versions
    version = "*"
  }
@AlbertNg02 AlbertNg02 changed the title Coudl not get neogen to work with LazyVim Could not get neogen to work with LazyVim Apr 24, 2024
@rabinadk1
Copy link

I came up with this. I am currently wondering how to integrate it with native snippets support of neovim>=0.10. Please reply if someone figures it out.

return {
  "danymat/neogen",
  dependencies = "nvim-treesitter/nvim-treesitter",
  cmd = "Neogen",
  keys = {
    {
      "<leader>ga",
      function()
        require("neogen").generate({})
      end,
      desc = "Generate Annotations",
    },
  },
  ---@param _ LazyPlugin
  ---@param opts table
  opts = function(_, opts)
    local util = require("lazyvim.util")
    if util.has("luasnip") then
      opts.snippet_engine = "luasnip"
    elseif util.has("snippy") then
      opts.snippet_engine = "snippy"
    end
  end,
}

@ArslanTu
Copy link

@rabinadk1 native snippet support has been added according to this issue. Just set snippet_engine to nvim.

@rabinadk1
Copy link

@rabinadk1 native snippet support has been added according to this issue. Just set snippet_engine to nvim.

Thank you very much. I have updated my config to the following.

return {
  "danymat/neogen",
  dependencies = "nvim-treesitter/nvim-treesitter",
  cmd = "Neogen",
  keys = {
    {
      "<leader>ga",
      function()
        require("neogen").generate({})
      end,
      desc = "Generate Annotations",
    },
  },
  ---@param _ LazyPlugin
  ---@param opts table
  opts = function(_, opts)
    local snippet_engine = nil

    if vim.snippet ~= nil then
      snippet_engine = "nvim"
    else
      local util = require("lazyvim.util")
      if util.has("luasnip") then
        snippet_engine = "luasnip"
      elseif util.has("snippy") then
        snippet_engine = "snippy"
      elseif vim.g.loaded_vsnip then
        snippet_engine = "vsnip"
      end
    end

    opts.snippet_engine = snippet_engine
  end,
}

@danymat
Copy link
Owner

danymat commented Jul 28, 2024

Weird, do you still have the issue loading Neogen ?

@danymat danymat added the question Further information is requested label Jul 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants