mirror of
https://github.com/nvim-lua/kickstart.nvim.git
synced 2026-10-15 23:19:54 -07:00
Switch from lua_ls to emmylua_ls
This commit is contained in:
@@ -747,36 +747,37 @@ do
|
|||||||
stylua = {}, -- Used to format Lua code
|
stylua = {}, -- Used to format Lua code
|
||||||
|
|
||||||
-- Special Lua Config, as recommended by neovim help docs
|
-- Special Lua Config, as recommended by neovim help docs
|
||||||
lua_ls = {
|
emmylua_ls = {
|
||||||
on_init = function(client)
|
on_init = function(client)
|
||||||
client.server_capabilities.documentFormattingProvider = false -- Disable formatting (formatting is done by stylua)
|
client.server_capabilities.documentFormattingProvider = false -- Disable formatting (formatting is done by stylua)
|
||||||
|
-- If the workspace has its own emmylua_ls/lua_ls config file, defer to it.
|
||||||
if client.workspace_folders then
|
if client.workspace_folders then
|
||||||
local path = client.workspace_folders[1].name
|
local path = client.workspace_folders[1].name
|
||||||
if path ~= vim.fn.stdpath 'config' and (vim.uv.fs_stat(path .. '/.luarc.json') or vim.uv.fs_stat(path .. '/.luarc.jsonc')) then return end
|
if path ~= vim.fn.stdpath 'config' and (vim.uv.fs_stat(path .. '/.emmyrc.json') or vim.uv.fs_stat(path .. '/.luarc.json')) then
|
||||||
|
client.config.settings = {}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local current_settings = client.config.settings --[[@as lspconfig.settings.lua_ls]]
|
|
||||||
client.config.settings.Lua = vim.tbl_deep_extend('force', current_settings.Lua, {
|
|
||||||
runtime = {
|
|
||||||
version = 'LuaJIT',
|
|
||||||
path = { 'lua/?.lua', 'lua/?/init.lua' },
|
|
||||||
},
|
|
||||||
workspace = {
|
|
||||||
checkThirdParty = false,
|
|
||||||
-- 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,
|
end,
|
||||||
---@type lspconfig.settings.lua_ls
|
---@type lspconfig.settings.emmylua_ls
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {
|
emmylua = {
|
||||||
|
-- Tell the server which Lua you're using (usually LuaJIT, for Neovim).
|
||||||
|
runtime = { version = 'LuaJIT' },
|
||||||
|
diagnostics = {
|
||||||
|
globals = {
|
||||||
|
'vim',
|
||||||
|
-- You can add globals here to make emmylua aware of them
|
||||||
|
'MiniIcons',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- Make the server aware of Neovim runtime files.
|
||||||
|
workspace = {
|
||||||
|
library = vim.api.nvim_get_runtime_file('', true),
|
||||||
format = { enable = false }, -- Disable formatting (formatting is done by stylua)
|
format = { enable = false }, -- Disable formatting (formatting is done by stylua)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
vim.pack.add {
|
vim.pack.add {
|
||||||
|
|||||||
Reference in New Issue
Block a user