aboutsummaryrefslogtreecommitdiffstats
path: root/lua/lspconfig/server_configurations/lua_ls.lua
diff options
context:
space:
mode:
authorabeldekat <abel@nomail.com>2024-03-05 14:37:02 +0100
committerLewis Russell <me@lewisr.dev>2024-03-05 13:53:46 +0000
commit48364fb8f01600ced41a39b745b0ffe8c6a4ff09 (patch)
tree90391e77673c590dba65b0cb9d79a1c764ec080c /lua/lspconfig/server_configurations/lua_ls.lua
parentdocs: update server_configurations.md (diff)
downloadnvim-lspconfig-48364fb8f01600ced41a39b745b0ffe8c6a4ff09.tar
nvim-lspconfig-48364fb8f01600ced41a39b745b0ffe8c6a4ff09.tar.gz
nvim-lspconfig-48364fb8f01600ced41a39b745b0ffe8c6a4ff09.tar.bz2
nvim-lspconfig-48364fb8f01600ced41a39b745b0ffe8c6a4ff09.tar.lz
nvim-lspconfig-48364fb8f01600ced41a39b745b0ffe8c6a4ff09.tar.xz
nvim-lspconfig-48364fb8f01600ced41a39b745b0ffe8c6a4ff09.tar.zst
nvim-lspconfig-48364fb8f01600ced41a39b745b0ffe8c6a4ff09.zip
docs(lua_ls): change suggested setup
Diffstat (limited to 'lua/lspconfig/server_configurations/lua_ls.lua')
-rw-r--r--lua/lspconfig/server_configurations/lua_ls.lua51
1 files changed, 26 insertions, 25 deletions
diff --git a/lua/lspconfig/server_configurations/lua_ls.lua b/lua/lspconfig/server_configurations/lua_ls.lua
index f730d713..3bb9fd6a 100644
--- a/lua/lspconfig/server_configurations/lua_ls.lua
+++ b/lua/lspconfig/server_configurations/lua_ls.lua
@@ -46,32 +46,33 @@ settings.
require'lspconfig'.lua_ls.setup {
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
- client.config.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
- workspace = {
- checkThirdParty = false,
- library = {
- vim.env.VIMRUNTIME
- -- Depending on the usage, you might want to add additional paths here.
- -- E.g.: For using `vim.*` functions, add vim.env.VIMRUNTIME/lua.
- -- "${3rd}/luv/library"
- -- "${3rd}/busted/library",
- }
- -- or pull in all of 'runtimepath'. NOTE: this is a lot slower
- -- library = vim.api.nvim_get_runtime_file("", true)
- }
- }
- })
+ if vim.loop.fs_stat(path..'/.luarc.json') or vim.loop.fs_stat(path..'/.luarc.jsonc') then
+ return
end
- return true
- end
+
+ client.config.settings.Lua = 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
+ workspace = {
+ checkThirdParty = false,
+ library = {
+ vim.env.VIMRUNTIME
+ -- Depending on the usage, you might want to add additional paths here.
+ -- "${3rd}/luv/library"
+ -- "${3rd}/busted/library",
+ }
+ -- or pull in all of 'runtimepath'. NOTE: this is a lot slower
+ -- library = vim.api.nvim_get_runtime_file("", true)
+ }
+ })
+ end,
+ settings = {
+ Lua = {}
+ }
}
```