neogen icon indicating copy to clipboard operation
neogen copied to clipboard

Could not get neogen to work with LazyVim

Open AlbertNg02 opened this issue 1 year ago • 4 comments

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 avatar Apr 24 '24 17:04 AlbertNg02

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,
}

rabinadk1 avatar May 19 '24 17:05 rabinadk1

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

ArslanTu avatar May 22 '24 11:05 ArslanTu

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

rabinadk1 avatar May 24 '24 10:05 rabinadk1

Weird, do you still have the issue loading Neogen ?

danymat avatar Jul 28 '24 12:07 danymat