return { "neovim/nvim-lspconfig", dependencies = { "williamboman/mason.nvim", "williamboman/mason-lspconfig.nvim", "hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-buffer", "hrsh7th/cmp-path", "hrsh7th/cmp-cmdline", "hrsh7th/nvim-cmp", "L3MON4D3/LuaSnip", "saadparwaiz1/cmp_luasnip", "j-hui/fidget.nvim", }, config = function() local cmp = require('cmp') local luasnip = require("luasnip") require("fidget").setup({}) require('mason').setup({}) require('mason-lspconfig').setup({ -- Replace the language servers listed here -- with the ones you want to install ensure_installed = { 'tsserver', 'lua_ls', 'gopls', 'pylsp', 'gitlab_ci_ls', 'yamlls' }, handlers = { function(server_name) require('lspconfig')[server_name].setup({}) end, } }) cmp.setup({ sources = { { name = 'path' }, { name = 'nvim_lsp' }, { name = 'luasnip', keyword_length = 2 }, { name = 'buffer', keyword_length = 3 }, }, mapping = cmp.mapping.preset.insert({ -- `Enter` key to confirm completion [''] = cmp.mapping(function(fallback) if cmp.visible() then if luasnip.expandable() then luasnip.expand() else cmp.confirm({ select = true, }) end else fallback() end end), [""] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_next_item() elseif luasnip.locally_jumpable(1) then luasnip.jump(1) else fallback() end end, { "i", "s" }), [""] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_prev_item() elseif luasnip.locally_jumpable(-1) then luasnip.jump(-1) else fallback() end end, { "i", "s" }), -- Ctrl+Space to trigger completion menu [''] = cmp.mapping.complete(), -- Scroll up and down in the completion documentation [''] = cmp.mapping.scroll_docs(-4), [''] = cmp.mapping.scroll_docs(4), }), snippet = { expand = function(args) require('luasnip').lsp_expand(args.body) end, }, }) end }