return { "neovim/nvim-lspconfig", dependencies = { "hrsh7th/nvim-cmp", "hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-buffer", }, lazy = false, config = function() local nvim_lsp = require("lspconfig") local capabilities = require('cmp_nvim_lsp').default_capabilities() local cmp = require("cmp") cmp.setup({ expand = function () require("cmp.config").set_onetime({ sources = {} }) end, window = { completion = cmp.config.window.bordered(), documentation = cmp.config.window.bordered() }, sources = { { name = "path" }, { name = "nvim_lsp" }, { name = "buffer" } }, formatting = { fields = {"menu", "abbr", "kind"}, format = function(entry, item) local menu_icon = { nvim_lsp = 'λ', buffer = 'Ω', path = '⊏', } item.menu = menu_icon[entry.source.name] return item end }, mapping = cmp.mapping.preset.insert({ [""] = cmp.mapping(function(fallback) if cmp.visible() then local entry = cmp.get_selected_entry() if not entry then cmp.select_next_item({ behavior = cmp.SelectBehavior.Select }) end cmp.confirm() else fallback() end end, {"i","s","c",}), }) }) nvim_lsp.lua_ls.setup({ capabilities = capabilities, settings = { Lua = { diagnostics = { globals = { 'vim' }, }, workspace = { library = vim.api.nvim_get_runtime_file("", true), checkThirdParty = false }, }, }, }) nvim_lsp.ts_ls.setup({ capabilities = capabilities }) end }