This commit is contained in:
newbie 2023-11-22 12:59:44 +08:00
parent 1572e264bb
commit b99c2fb31b
3 changed files with 82 additions and 0 deletions

27
lua/lsp/lua.lua Normal file
View File

@ -0,0 +1,27 @@
local runtime_path = vim.split(package.path, ';')
table.insert(runtime_path, "lua/?.lua")
table.insert(runtime_path, "lua/?/init.lua")
return {
settings = {
Lua = {
runtime = {
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
version = 'LuaJIT',
-- Setup your lua path
path = runtime_path,
},
diagnostics = {
-- Get the language server to recognize the `vim` global
globals = {'vim'},
},
workspace = {
-- Make the server aware of Neovim runtime files
library = vim.api.nvim_get_runtime_file("", true),
},
-- Do not send telemetry data containing a randomized but unique identifier
telemetry = {
enable = false
},
},
},
}

View File

@ -6,6 +6,7 @@ return {
require('plugs.coc'), -- coc require('plugs.coc'), -- coc
-- require('plugs.nvim-lspconfig'), -- compe
require('plugs.lualine'), -- lualine require('plugs.lualine'), -- lualine
require('plugs.nvimtree'), -- nvimtree require('plugs.nvimtree'), -- nvimtree
require('plugs.treesitter'), -- treesitter require('plugs.treesitter'), -- treesitter

View File

@ -0,0 +1,54 @@
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,
}
}
}