diff options
| author | yuzu-eva <stevenhu@web.de> | 2023-10-30 14:11:13 +0100 |
|---|---|---|
| committer | yuzu-eva <stevenhu@web.de> | 2023-10-30 14:11:13 +0100 |
| commit | b423014b0e51a8324e7ff0fb925d7e7c4000cd45 (patch) | |
| tree | 6f7475db75cbcaa425f6b663b39ac996f152e62d /.config/nvim/lua/user/plugins | |
| parent | 342b7b50d4f95ebf8f17b3696d4f5b9c116e75a8 (diff) | |
update for new system
Diffstat (limited to '.config/nvim/lua/user/plugins')
| -rw-r--r-- | .config/nvim/lua/user/plugins/lspconfig.lua | 51 |
1 files changed, 20 insertions, 31 deletions
diff --git a/.config/nvim/lua/user/plugins/lspconfig.lua b/.config/nvim/lua/user/plugins/lspconfig.lua index 39f27c3..67d82a7 100644 --- a/.config/nvim/lua/user/plugins/lspconfig.lua +++ b/.config/nvim/lua/user/plugins/lspconfig.lua @@ -59,38 +59,27 @@ require 'lspconfig'.emmet_ls.setup { filetypes = { 'html', 'javascript', 'typescript', 'javascriptreact', 'typescriptreact', 'eruby' } } -local runtime_path = vim.split(package.path, ';') -table.insert(runtime_path, "lua/?.lua") -table.insert(runtime_path, "lua/?/init.lua") -require 'lspconfig'.lua_ls.setup { - on_attach = on_attach, - capabilities = capabilities, - flags = { - debounce_text_changes = 150, - }, - cmd = { "/home/cafebabe/.local/share/lua-language-server/bin/lua-language-server", "-E", "/home/cafebabe/.local/share/lua-language-server/bin/main.lua" }; - settings = { - Lua = { - runtime = { - -- Tell language server which version of lua is used. - version = 'LuaJIT', - -- Setup lua path - path = runtime_path, - }, - diagnostics = { - -- Recognize globals - globals = { 'vim', 'use', 'parse' }, - }, - workspace = { - -- Make server aware of Neovim runtime files - library = vim.api.nvim_get_runtime_file("", true), - }, - -- Do not send telemetry data - telemetry = { - enable = false, - }, +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 = { + 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 = client.config.settings }) + end + return true + end } require 'lspconfig'.bashls.setup { |
