Files
dotfiles/nvim/after/lsp/lua_ls.lua
FaultyBranches 86475a8e8e feat: Removing nvim-lspconfig and starting the removal of Mason, adding
in LSP definitions for servers that are used, adding in a script to
check for LSPs, removing some extraneous items in the tmux conf, moving
autopairs to its own file
2026-08-16 20:19:05 -05:00

48 lines
1.4 KiB
Lua

-- Lua LSP config handles the initialization of workspace folders to pull in library references for completion
return {
cmd = { 'lua-language-server' },
filetypes = { 'lua' },
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.env.VIMRUNTIME,
vim.api.nvim_get_runtime_file('lua/lspconfig', false)[1],
},
},
})
end,
root_markers = {
'.emmyrc.json',
'.git',
'.luachecrc',
'.luarc.json',
'.luarc.jsonc',
'.stylua.toml',
},
settings = {
Lua = {
codeLens = { enable = true },
hint = { enable = true, semicolon = 'Disable' },
},
},
}