-- nvim/.config/nvim/lua/plugins/lsp/lua.lua
return {
"neovim/nvim-lspconfig",
opts = {
servers = {
lua_ls = {
on_init = function(client)
local path = client.workspace_folders
and client.workspace_folders[1]
and client.workspace_folders[1].name
or ""
if path:find(vim.fn.stdpath("config"), 1, true) then
client.config.settings.Lua = vim.tbl_deep_extend("force",
client.config.settings.Lua, {
runtime = { version = "LuaJIT" },
workspace = {
checkThirdParty = false,
library = {
vim.env.VIMRUNTIME,
"${3rd}/luv/library",
},
},
diagnostics = { globals = { "vim" } },
})
end
end,
settings = {
Lua = {
telemetry = { enable = false },
completion = { callSnippet = "Replace" },
hint = { enable = true, setType = false, paramType = true },
format = { enable = false }, -- handled by stylua
},
},
},
},
},
}