return { -- LSP 'williamboman/mason.nvim', 'williamboman/mason-lspconfig.nvim', 'neovim/nvim-lspconfig', { 'nvimdev/lspsaga.nvim', config = function() require('lspsaga').setup({ lightbulb = { enable = true, sign = true, virtual_text = false, }, }) end, dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, }, { "zbirenbaum/copilot.lua", cmd = "Copilot", event = "InsertEnter", config = function() require("copilot").setup({ panel = { enabled = true, auto_refresh = true, }, suggestion = { enabled = true, auto_trigger = true, accept = false, -- disable built-in keymapping }, filetypes = { markdown = true, yaml = true } }) end, }, { "saghen/blink.cmp", version = '*', opts_extend = { "sources.completion.enabled_providers", "sources.compat", "sources.default", }, dependencies = { "rafamadriz/friendly-snippets", -- add blink.compat to dependencies }, event = "InsertEnter", ---@module 'blink.cmp' ---@type blink.cmp.Config opts = { appearance = { use_nvim_cmp_as_default = false, nerd_font_variant = "mono", }, completion = { accept = { -- experimental auto-brackets support auto_brackets = { enabled = true, }, }, menu = { draw = { treesitter = { "lsp" }, }, }, documentation = { auto_show = true, auto_show_delay_ms = 200, }, ghost_text = { enabled = vim.g.ai_cmp, }, }, -- experimental signature help support signature = { enabled = true }, -- sources = { -- adding any nvim-cmp sources here will enable them -- with blink.compat compat = {}, default = { "lsp", "path", "snippets", "buffer" }, cmdline = {}, -- This is what prevents blink from showing up when using noice }, keymap = { preset = "enter", [""] = { "select_and_accept" }, }, }, ---@param opts blink.cmp.Config | { sources: { compat: string[] } } config = function(_, opts) -- setup compat sources local enabled = opts.sources.default for _, source in ipairs(opts.sources.compat or {}) do opts.sources.providers[source] = vim.tbl_deep_extend( "force", { name = source, module = "blink.compat.source" }, opts.sources.providers[source] or {} ) if type(enabled) == "table" and not vim.tbl_contains(enabled, source) then table.insert(enabled, source) end end -- TODO: Re-enable this to use tab and super-tab -- add ai_accept to key -- if not opts.keymap[""] then -- if opts.keymap.preset == "super-tab" then -- super-tab -- opts.keymap[""] = { -- require("blink.cmp.keymap.presets")["super-tab"][""][1], -- LazyVim.cmp.map({ "snippet_forward", "ai_accept" }), -- "fallback", -- } -- else -- other presets -- opts.keymap[""] = { -- LazyVim.cmp.map({ "snippet_forward", "ai_accept" }), -- "fallback", -- } -- end -- end -- Unset custom prop to pass blink.cmp validation opts.sources.compat = nil -- check if we need to override symbol kinds for _, provider in pairs(opts.sources.providers or {}) do ---@cast provider blink.cmp.SourceProviderConfig|{kind?:string} if provider.kind then local CompletionItemKind = require("blink.cmp.types").CompletionItemKind local kind_idx = #CompletionItemKind + 1 CompletionItemKind[kind_idx] = provider.kind ---@diagnostic disable-next-line: no-unknown CompletionItemKind[provider.kind] = kind_idx ---@type fun(ctx: blink.cmp.Context, items: blink.cmp.CompletionItem[]): blink.cmp.CompletionItem[] local transform_items = provider.transform_items ---@param ctx blink.cmp.Context ---@param items blink.cmp.CompletionItem[] provider.transform_items = function(ctx, items) items = transform_items and transform_items(ctx, items) or items for _, item in ipairs(items) do item.kind = kind_idx or item.kind end return items end -- Unset custom prop to pass blink.cmp validation provider.kind = nil end end require("blink.cmp").setup(opts) end, }, }