diff options
Diffstat (limited to 'after/lsp/emmylua_ls.lua')
| -rw-r--r-- | after/lsp/emmylua_ls.lua | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/after/lsp/emmylua_ls.lua b/after/lsp/emmylua_ls.lua new file mode 100644 index 0000000..4e0cd88 --- /dev/null +++ b/after/lsp/emmylua_ls.lua @@ -0,0 +1,29 @@ +return { + cmd = { vim.env.XDG_DATA_HOME .. "/cargo/bin/emmylua_ls" }, + filetypes = { "lua" }, + root_markers = { + ".emmyrc.json", + }, + workspace_required = false, + 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") + or vim.uv.fs_stat(path .. "/.emmyrc.jsonc") + ) + then + return + end + end + + client.config.settings.Lua.workspace = + vim.tbl_deep_extend("force", client.config.settings.Lua.workspace, { + library = vim.api.nvim_get_runtime_file("", true), + }) + end, + settings = { Lua = { workspace = {} } }, +} |
