nixos-configuration/users/jrpotter/neovim/config/lang/lua.lua

39 lines
1.1 KiB
Lua
Raw Normal View History

local M = {}
function M.nvim_lspconfig()
2024-03-05 03:10:57 +00:00
require("utils.lsp").setup(require("lspconfig").lua_ls) {
-- 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
client.config.settings = vim.tbl_deep_extend(
2024-03-05 03:10:57 +00:00
"force", client.config.settings, {
Lua = {
runtime = {
2024-03-05 03:10:57 +00:00
version = "LuaJIT"
},
workspace = {
checkThirdParty = false,
library = {
vim.env.VIMRUNTIME
}
}
}
})
client.notify("workspace/didChangeConfiguration", {
settings = client.config.settings,
})
end
return true
end
}
end
return M