repositories / dotfiles
dotfiles
bugabingas dorkfiles
owned by bugabinga
neovim/lsp/lua_ls.lua
Rawlocal project = require 'std.project'
local normalize = vim.fs.normalize
local realpath = vim.uv.fs_realpath
return {
cmd = { 'lua-language-server' },
filetypes = { 'lua' },
root_dir = function(_, set_root_dir) set_root_dir(project.find_lua_project_root()) end,
settings = {
Lua = {
hint = { enable = true, setType = true },
},
},
on_init = function(client)
if client.workspace_folders then
local path = normalize(realpath(client.workspace_folders[1].name))
local config_path = normalize(realpath(vim.fn.stdpath('config')))
if path ~= config_path 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',
},
},
diagnostics = { globals = { "vim" } },
workspace = {
checkThirdParty = false,
library = {
vim.env.VIMRUNTIME,
'${3rd}/luv/library'
}
}
})
end,
}