diff options
| author | github-actions <github-actions@github.com> | 2023-08-08 10:58:22 +0000 |
|---|---|---|
| committer | github-actions <github-actions@github.com> | 2023-08-08 10:58:22 +0000 |
| commit | b024fdb52702a682edd57badfbe84a5d8bf7273a (patch) | |
| tree | c22a7c9b14a39436a6d63cb32177966cb21cdfbb | |
| parent | feat(lua_ls): update recommended settings (diff) | |
| download | nvim-lspconfig-b024fdb52702a682edd57badfbe84a5d8bf7273a.tar nvim-lspconfig-b024fdb52702a682edd57badfbe84a5d8bf7273a.tar.gz nvim-lspconfig-b024fdb52702a682edd57badfbe84a5d8bf7273a.tar.bz2 nvim-lspconfig-b024fdb52702a682edd57badfbe84a5d8bf7273a.tar.lz nvim-lspconfig-b024fdb52702a682edd57badfbe84a5d8bf7273a.tar.xz nvim-lspconfig-b024fdb52702a682edd57badfbe84a5d8bf7273a.tar.zst nvim-lspconfig-b024fdb52702a682edd57badfbe84a5d8bf7273a.zip | |
docs: update server_configurations.md
skip-checks: true
| -rw-r--r-- | doc/server_configurations.md | 38 | ||||
| -rw-r--r-- | doc/server_configurations.txt | 38 |
2 files changed, 38 insertions, 38 deletions
diff --git a/doc/server_configurations.md b/doc/server_configurations.md index 0fef2eff..7edad9c2 100644 --- a/doc/server_configurations.md +++ b/doc/server_configurations.md @@ -4987,26 +4987,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 } ``` diff --git a/doc/server_configurations.txt b/doc/server_configurations.txt index 0fef2eff..7edad9c2 100644 --- a/doc/server_configurations.txt +++ b/doc/server_configurations.txt @@ -4987,26 +4987,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 } ``` |
