I have searched for a solution but nothing I have found worked.
I have lazy.nvim as plugin manager.
I installed the following plugins
return { "mason-org/mason-lspconfig.nvim", opts = {}, dependencies = { { "mason-org/mason.nvim", opts = {} }, "neovim/nvim-lspconfig", }, } Then, in my after folder, I created a lua file that contains the following setup
require("mason-lspconfig").setup({ ensure_installed = { "lua_ls", "ts_ls", "rust_analyzer", }, handlers = { function(server_name, test) ■ Unused local `test`. local capabilities = require('cmp_nvim_lsp').default_capabilities() require('lspconfig')[server_name].setup { capabilities = capabilities, } end, ["lua_ls"] = function() local lspconfig = require("lspconfig") local capabilities = require('cmp_nvim_lsp').default_capabilities() lspconfig.lua_ls.setup { capabilities = capabilities, settings = { Lua = { workspace = { checkThirdParty = false, library = vim.api.nvim_get_runtime_file("", true) }, ■ Undefined global `vim`. runtime = { version = 'LuaJIT' }, telemetry = { enable = false }, diagnostics = { globals = { "vim" }, }, }, }, } end, } }) vim.diagnostic.config({ ■ Undefined global `vim`. virtual_text = true, signs = false, underline = false, update_in_insert = false, severity_sort = true, }) (Ignore the test variable, I created it to see if diagnostic worked)
My problem is that I cannot get rid of the Undefined global `vim` warning.