From 256497cbaac713b777d04357b1f67b7a63934e27 Mon Sep 17 00:00:00 2001 From: Philippe Zwietering Date: Thu, 13 Apr 2023 13:43:57 +0200 Subject: [PATCH] Added vim to lsp global variables in order to remove warnings --- after/plugin/lsp.lua | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua index 54fca2c..b2422e1 100644 --- a/after/plugin/lsp.lua +++ b/after/plugin/lsp.lua @@ -8,6 +8,28 @@ lsp.ensure_installed({ 'jedi_language_server', -- Python }) +-- Fix undefined global 'vim' +lsp.configure('lua_ls', { + cmd = { 'lua-language-server' }, + settings = { + Lua = { + runtime = { + version = 'LuaJIT', + path = vim.split(package.path, ';'), + }, + diagnostics = { + globals = { 'vim' }, + }, + workspace = { + library = { + [vim.fn.expand('$VIMRUNTIME/lua')] = true, + [vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true, + }, + }, + }, + }, +}) + lsp.on_attach(function(client, bufnr) lsp.default_keymaps({buffer = bufnr}) end)