mirror of
https://github.com/dam9000/kickstart-modular.nvim.git
synced 2026-03-30 01:31:30 +00:00
Clean up the lua_ls config
This commit is contained in:
parent
1ba1789318
commit
b9f3965282
53
init.lua
53
init.lua
@ -594,6 +594,7 @@ require('lazy').setup({
|
|||||||
-- Enable the following language servers
|
-- Enable the following language servers
|
||||||
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
|
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
|
||||||
-- See `:help lsp-config` for information about keys and how to configure
|
-- See `:help lsp-config` for information about keys and how to configure
|
||||||
|
---@type table<string, vim.lsp.Config>
|
||||||
local servers = {
|
local servers = {
|
||||||
-- clangd = {},
|
-- clangd = {},
|
||||||
-- gopls = {},
|
-- gopls = {},
|
||||||
@ -605,32 +606,11 @@ require('lazy').setup({
|
|||||||
--
|
--
|
||||||
-- But for many setups, the LSP (`ts_ls`) will work just fine
|
-- But for many setups, the LSP (`ts_ls`) will work just fine
|
||||||
-- ts_ls = {},
|
-- ts_ls = {},
|
||||||
}
|
|
||||||
|
|
||||||
-- Ensure the servers and tools above are installed
|
stylua = {}, -- Used to format Lua code
|
||||||
--
|
|
||||||
-- To check the current status of installed tools and/or manually install
|
|
||||||
-- other tools, you can run
|
|
||||||
-- :Mason
|
|
||||||
--
|
|
||||||
-- You can press `g?` for help in this menu.
|
|
||||||
local ensure_installed = vim.tbl_keys(servers or {})
|
|
||||||
vim.list_extend(ensure_installed, {
|
|
||||||
'lua_ls', -- Lua Language server
|
|
||||||
'stylua', -- Used to format Lua code
|
|
||||||
-- You can add other tools here that you want Mason to install
|
|
||||||
})
|
|
||||||
|
|
||||||
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
|
|
||||||
|
|
||||||
for name, server in pairs(servers) do
|
|
||||||
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
|
|
||||||
vim.lsp.config(name, server)
|
|
||||||
vim.lsp.enable(name)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Special Lua Config, as recommended by neovim help docs
|
-- Special Lua Config, as recommended by neovim help docs
|
||||||
vim.lsp.config('lua_ls', {
|
lua_ls = {
|
||||||
on_init = function(client)
|
on_init = function(client)
|
||||||
if client.workspace_folders then
|
if client.workspace_folders then
|
||||||
local path = client.workspace_folders[1].name
|
local path = client.workspace_folders[1].name
|
||||||
@ -646,15 +626,38 @@ require('lazy').setup({
|
|||||||
checkThirdParty = false,
|
checkThirdParty = false,
|
||||||
-- NOTE: this is a lot slower and will cause issues when working on your own configuration.
|
-- 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
|
-- See https://github.com/neovim/nvim-lspconfig/issues/3189
|
||||||
library = vim.api.nvim_get_runtime_file('', true),
|
library = vim.tbl_extend('force', vim.api.nvim_get_runtime_file('', true), {
|
||||||
|
'${3rd}/luv/library',
|
||||||
|
'${3rd}/busted/library',
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {},
|
Lua = {},
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Ensure the servers and tools above are installed
|
||||||
|
--
|
||||||
|
-- To check the current status of installed tools and/or manually install
|
||||||
|
-- other tools, you can run
|
||||||
|
-- :Mason
|
||||||
|
--
|
||||||
|
-- You can press `g?` for help in this menu.
|
||||||
|
local ensure_installed = vim.tbl_keys(servers or {})
|
||||||
|
vim.list_extend(ensure_installed, {
|
||||||
|
-- You can add other tools here that you want Mason to install
|
||||||
})
|
})
|
||||||
vim.lsp.enable 'lua_ls'
|
|
||||||
|
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
|
||||||
|
|
||||||
|
for name, server in pairs(servers) do
|
||||||
|
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
|
||||||
|
vim.lsp.config(name, server)
|
||||||
|
vim.lsp.enable(name)
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user