From c53a9014b9fc922bb82cf803d5c036056302f478 Mon Sep 17 00:00:00 2001 From: Fernando Schauenburg Date: Sun, 9 Jul 2023 14:06:50 +0200 Subject: [PATCH] vim: make lua_ls work with neovim --- config/nvim/lua/user/plugins/lsp.lua | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/config/nvim/lua/user/plugins/lsp.lua b/config/nvim/lua/user/plugins/lsp.lua index fc52d01..7ca80a0 100644 --- a/config/nvim/lua/user/plugins/lsp.lua +++ b/config/nvim/lua/user/plugins/lsp.lua @@ -41,8 +41,27 @@ local config = function() } end, - -- server-specific handlers - -- ['server'] = function() --[[ server-specific stuff... ]] end + lua_ls = function() + require'lspconfig'.lua_ls.setup { + on_attach = on_attach, + capabilities = capabilities, + settings = { + Lua = { + -- I'm using lua only inside neovim, so the runtime is LuaJIT. + runtime = { version = 'LuaJIT' }, + + -- Get the language server to recognize the `vim` global. + diagnostics = { globals = {'vim'} }, + + -- Make the server aware of Neovim runtime files. + workspace = { library = vim.api.nvim_get_runtime_file("", true) }, + + -- Do not send telemetry data containing a randomized but unique identifier + telemetry = { enable = false }, + }, + }, + } + end, } } end