diff options
Diffstat (limited to 'lua/lspconfig/server_configurations/lua_ls.lua')
| -rw-r--r-- | lua/lspconfig/server_configurations/lua_ls.lua | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/lua/lspconfig/server_configurations/lua_ls.lua b/lua/lspconfig/server_configurations/lua_ls.lua index acb57318..e6a1438e 100644 --- a/lua/lspconfig/server_configurations/lua_ls.lua +++ b/lua/lspconfig/server_configurations/lua_ls.lua @@ -49,26 +49,26 @@ Completion results will include a workspace indexing progress message until the ```lua require'lspconfig'.lua_ls.setup { - settings = { - Lua = { - runtime = { - -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) - version = 'LuaJIT', - }, - diagnostics = { - -- Get the language server to recognize the `vim` global - globals = {'vim'}, - }, - workspace = { + on_init = function(client) + local path = client.workspace_folders[1].name + if not vim.loop.fs_stat(path..'/.luarc.json') and not vim.loop.fs_stat(path..'/.luarc.jsonc') then + local settings = vim.tbl_deep_extend('force', client.config.settings.Lua, { + runtime = { + -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) + version = 'LuaJIT' + }, -- Make the server aware of Neovim runtime files - library = vim.api.nvim_get_runtime_file("", true), - }, - -- Do not send telemetry data containing a randomized but unique identifier - telemetry = { - enable = false, - }, - }, - }, + workspace = { + library = { vim.env.VIMRUNTIME } + -- or pull in all of 'runtimepath'. NOTE: this is a lot slower + -- library = vim.api.nvim_get_runtime_file("", true) + } + } + + client.notify("workspace/didChangeConfiguration", { settings = settings }) + end + return true + end } ``` |
