2023-11-17 22:02:07 +00:00
|
|
|
local M = {}
|
|
|
|
|
|
|
|
function M.nvim_lspconfig()
|
2024-03-05 03:10:57 +00:00
|
|
|
require("utils.lsp").setup(require("lspconfig").lua_ls) {
|
2023-11-17 22:02:07 +00:00
|
|
|
-- Provide completions, analysis, and location handling for plugins on the
|
|
|
|
-- vim runtime path.
|
|
|
|
-- https://github.com/neovim/nvim-lspconfig/blob/48347089666d5b77d054088aa72e4e0b58026e6e/doc/server_configurations.md#lua_ls
|
|
|
|
on_init = function(client)
|
|
|
|
local path = client.workspace_folders[1].name
|
|
|
|
if (
|
2024-03-05 03:10:57 +00:00
|
|
|
not vim.loop.fs_stat(path .. "/.luarc.json") and
|
|
|
|
not vim.loop.fs_stat(path .. "/.luarc.jsonc")
|
|
|
|
) then
|
2023-11-17 22:02:07 +00:00
|
|
|
client.config.settings = vim.tbl_deep_extend(
|
2024-03-05 03:10:57 +00:00
|
|
|
"force", client.config.settings, {
|
2023-11-17 22:02:07 +00:00
|
|
|
Lua = {
|
|
|
|
runtime = {
|
2024-03-05 03:10:57 +00:00
|
|
|
version = "LuaJIT"
|
2023-11-17 22:02:07 +00:00
|
|
|
},
|
|
|
|
workspace = {
|
|
|
|
checkThirdParty = false,
|
|
|
|
library = {
|
|
|
|
vim.env.VIMRUNTIME
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
client.notify("workspace/didChangeConfiguration", {
|
|
|
|
settings = client.config.settings,
|
|
|
|
})
|
|
|
|
end
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
return M
|