nvim/lua/plugs/nvim-lspconfig.lua

55 lines
1.4 KiB
Lua
Raw Normal View History

2023-11-22 12:59:44 +08:00
return {
{
"neovim/nvim-lspconfig",
config = function ()
end
},
{
'williamboman/nvim-lsp-installer',
config = function ()
local lsp_installer = require "nvim-lsp-installer"
-- 安装列表
-- https://github.com/williamboman/nvim-lsp-installer#available-lsps
-- { key: 语言 value: 配置文件 }
local servers = {
sumneko_lua = require "lsp.lua", -- /lua/lsp/lua.lua
}
-- 自动安装 LanguageServers
for name, _ in pairs(servers) do
local server_is_found, server = lsp_installer.get_server(name)
if server_is_found then
if not server:is_installed() then
print("Installing " .. name)
server:install()
end
end
end
end
},
{
'hrsh7th/cmp-nvim-lsp', -- { name = 'nvim_lua' }
'hrsh7th/cmp-buffer', -- { name = 'buffer' },
'hrsh7th/cmp-path', -- { name = 'path' }
'hrsh7th/cmp-cmdline', -- { name = 'cmdline' }
'onsails/lspkind-nvim',
{
"hrsh7th/nvim-cmp",
config = function()
local cmp = require('cmp')
-- local lspkind = require('lspkind')
cmp.setup {
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'buffer' },
{ name = 'path' },
{ name = 'cmdline' },
}),
}
end,
}
}
}