-- ~/.config/nvim/lua/plugins/blink.lua
return {
  "saghen/blink.cmp",
  version      = "1.*",
  build        = "cargo build --release",
  lazy         = false,

  dependencies = {
    "L3MON4D3/LuaSnip",
    "rafamadriz/friendly-snippets",
  },

  opts         = {
    fuzzy      = { implementation = "prefer_rust" },

    sources    = {
      min_keyword_length = 2,
      default = { "lsp", "snippets", "buffer", "path", "lua" },
      per_filetype = {
        lua = { default = { "lazydev", "lsp", "snippets", "buffer", "path" } },
      },
    },

    completion = {
      accept = { auto_brackets = { enabled = true } },
      trigger = { show_on_trigger_character = true },
      list = {
        selection = {
          preselect = function(ctx) return ctx.mode ~= "cmdline" end,
        },
      },
      documentation = {
        auto_show = true,
        auto_show_delay_ms = 100,
      },
    },

    signature  = { enabled = true, window = { border = "rounded" } },
    cmdline    = { enabled = false },
  },

  config       = function(_, opts)
    require("blink.cmp").setup(opts)
  end,
}
