diff --git a/lua/kickstart/plugins/blink-cmp.lua b/lua/kickstart/plugins/blink-cmp.lua index 2b2f325..e2b21b3 100644 --- a/lua/kickstart/plugins/blink-cmp.lua +++ b/lua/kickstart/plugins/blink-cmp.lua @@ -30,7 +30,6 @@ return { }, opts = {}, }, - 'folke/lazydev.nvim', }, --- @module 'blink.cmp' --- @type blink.cmp.Config @@ -76,10 +75,7 @@ return { }, sources = { - default = { 'lsp', 'path', 'snippets', 'lazydev' }, - providers = { - lazydev = { module = 'lazydev.integrations.blink', score_offset = 100 }, - }, + default = { 'lsp', 'path', 'snippets' }, }, snippets = { preset = 'luasnip' }, diff --git a/lua/kickstart/plugins/lspconfig.lua b/lua/kickstart/plugins/lspconfig.lua index d0ff865..44206a9 100644 --- a/lua/kickstart/plugins/lspconfig.lua +++ b/lua/kickstart/plugins/lspconfig.lua @@ -1,17 +1,5 @@ -- LSP Plugins return { - { - -- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins - -- used for completion, annotations and signatures of Neovim apis - 'folke/lazydev.nvim', - ft = 'lua', - opts = { - library = { - -- Load luvit types when the `vim.uv` word is found - { path = '${3rd}/luv/library', words = { 'vim%.uv' } }, - }, - }, - }, { -- Main LSP Configuration 'neovim/nvim-lspconfig', @@ -206,22 +194,6 @@ return { -- -- But for many setups, the LSP (`ts_ls`) will work just fine -- ts_ls = {}, - -- - - lua_ls = { - -- cmd = { ... }, - -- filetypes = { ... }, - -- capabilities = {}, - settings = { - Lua = { - completion = { - callSnippet = 'Replace', - }, - -- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings - -- diagnostics = { disable = { 'missing-fields' } }, - }, - }, - }, } -- Ensure the servers and tools above are installed @@ -241,22 +213,58 @@ return { vim.list_extend(ensure_installed, { 'stylua', -- Used to format Lua code }) + require('mason-tool-installer').setup { ensure_installed = ensure_installed } require('mason-lspconfig').setup { - ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer) - automatic_installation = false, - handlers = { - function(server_name) - local server = servers[server_name] or {} - -- This handles overriding only values explicitly passed - -- by the server configuration above. Useful when disabling - -- certain features of an LSP (for example, turning off formatting for ts_ls) - server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) - require('lspconfig')[server_name].setup(server) - end, - }, + ensure_installed = { 'lua_ls' }, } + + for name, server in pairs(servers) do + server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) + vim.lsp.config(name, server) + vim.lsp.enable(name) + end + + vim.lsp.config('lua_ls', { + on_init = function(client) + if client.workspace_folders then + local path = client.workspace_folders[1].name + if path ~= vim.fn.stdpath 'config' and (vim.uv.fs_stat(path .. '/.luarc.json') or vim.uv.fs_stat(path .. '/.luarc.jsonc')) then + return + end + end + + client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, { + runtime = { + version = 'LuaJIT', + path = { + 'lua/?.lua', + 'lua/?/init.lua', + }, + }, + -- Make the server aware of Neovim runtime files + workspace = { + checkThirdParty = false, + -- NOTE: this is a lot slower and will cause issues when working on your own configuration. + -- See https://github.com/neovim/nvim-lspconfig/issues/3189 + library = vim.api.nvim_get_runtime_file('', true), + -- + -- Alternatively: + -- library = { + -- vim.env.VIMRUNTIME, + -- -- Depending on the usage, you might want to add additional paths + -- -- here. + -- -- '${3rd}/luv/library', + -- -- '${3rd}/busted/library', + -- }, + }, + }) + end, + settings = { + Lua = {}, + }, + }) end, }, }