local M = {
  'L3MON4D3/LuaSnip',
  dependencies = {
    'rafamadriz/friendly-snippets',
  },
  keys = {
    {
      '<tab>',
      function()
        return require('luasnip').jumpable(1) and '<Plug>luasnip-jump-next' or '<tab>'
      end,
      expr = true,
      remap = true,
      silent = true,
      mode = 'i',
    },
    { '<tab>',   function() require('luasnip').jump(1) end,  mode = 's' },
    { '<s-tab>', function() require('luasnip').jump(-1) end, mode = { 'i', 's' } },
    { '<M-p>', function () require("luasnip").change_choice(-1) end, mode = { 'i', 's'}},
    { '<M-n>', function () require("luasnip").change_choice(1) end, mode = { 'i', 's'}},
  },
}

function M.config()
  require('luasnip.loaders.from_vscode').lazy_load()
  require('luasnip.loaders.from_snipmate').lazy_load()
  require('luasnip.loaders.from_lua').lazy_load()

  local types = require('luasnip.util.types')

  local ls = require('luasnip')
  ls.setup({
    ext_opts = {
      [types.choiceNode] = {
        active = {
          virt_text = { { '●', 'GruvboxOrange' } },
        },
      },
      [types.insertNode] = {
        active = {
          virt_text = { { '●', 'GruvboxBlue' } },
        },
      },
    },
  })
end

--return M
return {}
