diff --git a/home/.config/nvim/init.lua b/home/.config/nvim/init.lua index 5789ff4..25d011c 100644 --- a/home/.config/nvim/init.lua +++ b/home/.config/nvim/init.lua @@ -487,7 +487,30 @@ require('lazy').setup({ --[[ cfg_lazy_lsp_servers ]] local servers = { - lua_ls = {}, + 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' }, + }, + workspace = { + checkThirdParty = false, + library = vim.tbl_extend('force', vim.api.nvim_get_runtime_file('', true), { + '${3rd}/luv/library', + '${3rd}/busted/library', + }), + }, + }) + end, + }, ts_ls = { filetypes = { 'javascript', 'javascriptreact', 'typescript', 'typescriptreact', 'vue' }, init_options = {