Migrate to lsp-zero 3.x branch
This commit is contained in:
parent
3dbf7b8ed4
commit
5f44b663e3
15
.luarc.json
Normal file
15
.luarc.json
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"runtime.version": "LuaJIT",
|
||||
"runtime.path": [
|
||||
"lua/?.lua",
|
||||
"lua/?/init.lua"
|
||||
],
|
||||
"diagnostics.globals": [
|
||||
"vim"
|
||||
],
|
||||
"workspace.checkThirdParty": false,
|
||||
"workspace.library": [
|
||||
"$VIMRUNTIME",
|
||||
"./lua"
|
||||
]
|
||||
}
|
@ -2,27 +2,30 @@ local lsp = require("lsp-zero")
|
||||
|
||||
lsp.preset("recommended")
|
||||
|
||||
lsp.ensure_installed({
|
||||
'lua_ls',
|
||||
})
|
||||
|
||||
-- Fix Undefined global 'vim'
|
||||
lsp.nvim_workspace()
|
||||
|
||||
lsp.extend_cmp()
|
||||
local cmp = require('cmp')
|
||||
local cmp_select = { behavior = cmp.SelectBehavior.Select }
|
||||
local cmp_mappings = lsp.defaults.cmp_mappings({
|
||||
['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
|
||||
['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
|
||||
['<C-y>'] = cmp.mapping.confirm({ select = true }),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
})
|
||||
|
||||
cmp_mappings['<Tab>'] = nil
|
||||
cmp_mappings['<S-Tab>'] = nil
|
||||
|
||||
lsp.setup_nvim_cmp({
|
||||
mapping = cmp_mappings
|
||||
cmp.setup({
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-k>'] = cmp.mapping.select_prev_item(cmp_select),
|
||||
['<C-j>'] = cmp.mapping.select_next_item(cmp_select),
|
||||
['<C-l>'] = cmp.mapping.confirm({ select = true }),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
['<Tab>'] = nil,
|
||||
['<S-Tab>'] = nil,
|
||||
}),
|
||||
sources = {
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'buffer' },
|
||||
{ name = 'path' },
|
||||
{ name = 'nvim_lua' },
|
||||
{ name = 'luasnip' },
|
||||
}
|
||||
})
|
||||
|
||||
lsp.set_preferences({
|
||||
@ -35,6 +38,8 @@ lsp.set_preferences({
|
||||
}
|
||||
})
|
||||
|
||||
lsp.extend_lspconfig()
|
||||
|
||||
lsp.on_attach(function(client, bufnr)
|
||||
local opts = { buffer = bufnr, remap = false }
|
||||
|
||||
@ -55,3 +60,11 @@ lsp.setup()
|
||||
vim.diagnostic.config({
|
||||
virtual_text = true
|
||||
})
|
||||
|
||||
require("mason").setup({})
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = { 'lua_ls' },
|
||||
handlers = {
|
||||
lsp.default_setup,
|
||||
}
|
||||
})
|
||||
|
@ -19,7 +19,7 @@ require('lazy').setup({
|
||||
|
||||
{
|
||||
'VonHeikemen/lsp-zero.nvim',
|
||||
branch = 'v1.x',
|
||||
branch = 'v3.x',
|
||||
dependencies = {
|
||||
-- LSP Support
|
||||
{ 'neovim/nvim-lspconfig' },
|
||||
|
Loading…
Reference in New Issue
Block a user