lua_ls
URL: https://github.com/luals/lua-language-server
plugins.lsp.servers.lua_ls.enable
Whether to enable https://github.com/luals/lua-language-server
Lua language server.
lua-language-server
can be installed by following the instructions
here.
The default cmd
assumes that the lua-language-server
binary can be
found in $PATH
.
If you primarily use lua-language-server
for Neovim, and want to
provide completions, analysis, and location handling for plugins on
runtime path, you can use the following settings.
require'lspconfig'.lua_ls.setup {
on_init = function(client)
if client.workspace_folders then
local path = client.workspace_folders[1].name
if vim.loop.fs_stat(path..'/.luarc.json') or vim.loop.fs_stat(path..'/.luarc.jsonc') then
return
end
end
client.config.settings.Lua = 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 = {
checkThirdParty = false,
library = {
vim.env.VIMRUNTIME
-- Depending on the usage, you might want to add additional paths here.
-- "${3rd}/luv/library"
-- "${3rd}/busted/library",
}
-- or pull in all of 'runtimepath'. NOTE: this is a lot slower and will cause issues when working on your own configuration (see https://github.com/neovim/nvim-lspconfig/issues/3189)
-- library = vim.api.nvim_get_runtime_file("", true)
}
})
end,
settings = {
Lua = {}
}
}
See lua-language-server
’s
documentation for an
explanation of the above fields: *
Lua.runtime.path
*
Lua.workspace.library
.
Type: boolean
Default:
false
Example:
true
Declared by:
plugins.lsp.servers.lua_ls.package
The lua_ls package to use.
Type: null or package
Default:
pkgs.lua-language-server
Declared by:
plugins.lsp.servers.lua_ls.autostart
Controls if the FileType
autocommand that launches a language server is created.
If false
, allows for deferring language servers until manually launched with
:LspStart
(|lspconfig-commands|).
Type: null or boolean or raw lua code
Default:
null
Plugin default: true
Declared by:
plugins.lsp.servers.lua_ls.cmd
A list where each entry corresponds to the blankspace delimited part of the command that launches the server.
The first entry is the binary used to run the language server. Additional entries are passed as arguments.
Type: null or (list of string)
Default:
null
Declared by:
plugins.lsp.servers.lua_ls.extraOptions
Extra options for the lua_ls language server.
Type: attribute set of anything
Default:
{ }
Declared by:
plugins.lsp.servers.lua_ls.filetypes
Set of filetypes for which to attempt to resolve {root_dir}. May be empty, or server may specify a default value.
Type: null or (list of string)
Default:
null
Declared by:
plugins.lsp.servers.lua_ls.rootDir
A function (or function handle) which returns the root of the project used to determine if lspconfig should launch a new language server, or attach a previously launched server when you open a new buffer matching the filetype of the server.
Type: null or lua function string
Default:
null
Plugin default: "nil"
Declared by: