You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy the configuration from the server configuration
Reload the Neovim configuration
See the error
Actual behavior
Vim globals are not recognized, and LSP server throws errors when using it. Other plugins such as nvim-cmp do not provide any completion for the vim global.
Expected behavior
Vim global should be recognized, and other plugins such as nvim-cmp should benefit from the LSP completions.
Minimal config
return {
"neovim/nvim-lspconfig",
event="VeryLazy",
dependencies= {
"williamboman/mason-lspconfig.nvim",
"hrsh7th/nvim-cmp",
},
config=function()
locallspconfig=require("lspconfig")
localcapabilities=require("cmp_nvim_lsp").default_capabilities()
lspconfig.lua_ls.setup({
capabilities=capabilities,
on_init=function(client)
localpath=client.workspace_folders[1].nameifnotvim.loop.fs_stat(path..'/.luarc.json') andnotvim.loop.fs_stat(path..'/.luarc.jsonc') thenclient.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 filesworkspace= {
checkThirdParty=false,
library= {
vim.env.VIMRUNTIME-- "${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)
}
}
})
client.notify("workspace/didChangeConfiguration", { settings=client.config.settings })
endreturntrueend
})
end,
}
LSP log
None
The text was updated successfully, but these errors were encountered:
Description
Documentation for configuring Lua to use Vim does not work as expected.

Neovim version
NVIM v0.9.4
Build type: Release
LuaJIT 2.1.1700008891
Nvim-lspconfig version
Operating system and version
Archlinux
Affected language servers
lua
Steps to reproduce
Actual behavior
Vim globals are not recognized, and LSP server throws errors when using it. Other plugins such as
nvim-cmp
do not provide any completion for thevim
global.Expected behavior
Vim global should be recognized, and other plugins such as
nvim-cmp
should benefit from the LSP completions.Minimal config
LSP log
None
The text was updated successfully, but these errors were encountered: