removed lsp-zero in favor of the built-in nvim lsp
This commit is contained in:
@@ -1,26 +1,45 @@
|
|||||||
local lsp = require("lsp-zero")
|
local cmp = require('cmp')
|
||||||
|
local default_capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||||
|
|
||||||
lsp.preset("recommended")
|
local capabilities = vim.tbl_deep_extend(
|
||||||
|
'force',
|
||||||
|
{},
|
||||||
|
vim.lsp.protocol.make_client_capabilities(),
|
||||||
|
default_capabilities
|
||||||
|
)
|
||||||
|
|
||||||
require('mason').setup({})
|
require('mason').setup({})
|
||||||
require('mason-lspconfig').setup({
|
require('mason-lspconfig').setup({
|
||||||
ensure_installed = { 'tsserver', 'rust_analyzer' },
|
ensure_installed = { 'tsserver', 'rust_analyzer' },
|
||||||
handlers = {
|
handlers = {
|
||||||
lsp.default_setup,
|
function(server_name)
|
||||||
lua_ls = function()
|
require('lspconfig')[server_name].setup {
|
||||||
local lua_opts = lsp.nvim_lua_ls()
|
capabilities = capabilities
|
||||||
require('lspconfig').lua_ls.setup(lua_opts)
|
}
|
||||||
|
end,
|
||||||
|
['lua_ls'] = function()
|
||||||
|
local lspconfig = require('lspconfig')
|
||||||
|
lspconfig.lua_ls.setup {
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
diagnostics = {
|
||||||
|
globals = { 'vim' }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
require('lspconfig').yamlls.setup({
|
require('lspconfig').yamlls.setup({
|
||||||
on_attach = function(client, bufnr)
|
on_attach = function(client, bufnr)
|
||||||
client.resolved_capabilities.document_formatting = true
|
client.resolved_capabilities.document_formatting = true
|
||||||
end,
|
end,
|
||||||
settings = {
|
settings = {
|
||||||
yaml = {
|
yaml = {
|
||||||
customTags = { "!enemy", "!delay", "!composite" },
|
customTags = { '!enemy', '!delay', '!composite' },
|
||||||
validate = false,
|
validate = false,
|
||||||
format = {
|
format = {
|
||||||
enable = true
|
enable = true
|
||||||
@@ -44,31 +63,30 @@ require('lspconfig').tsserver.setup {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
local cmp = require('cmp')
|
|
||||||
|
|
||||||
local cmp_select = { behavior = cmp.SelectBehavior.Select }
|
local cmp_select = { behavior = cmp.SelectBehavior.Select }
|
||||||
local cmp_mappings = lsp.defaults.cmp_mappings({
|
|
||||||
})
|
|
||||||
|
|
||||||
cmp_mappings['<Tab>'] = nil
|
|
||||||
cmp_mappings['<S-Tab>'] = nil
|
|
||||||
|
|
||||||
local lspkind = require('lspkind')
|
local lspkind = require('lspkind')
|
||||||
|
|
||||||
cmp.setup({
|
cmp.setup({
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
require('luasnip').lsp_expand(args.body)
|
||||||
|
end
|
||||||
|
},
|
||||||
sources = {
|
sources = {
|
||||||
{ name = 'path' },
|
|
||||||
{ name = 'nvim_lsp' },
|
{ name = 'nvim_lsp' },
|
||||||
{ name = 'lsp-zero' },
|
{ name = 'path' },
|
||||||
|
{ name = 'nvim_lsp_signature_help' },
|
||||||
{ name = 'nvim_lua' },
|
{ name = 'nvim_lua' },
|
||||||
{ name = 'luasnip', keyword_length = 2 },
|
{ name = 'luasnip', keyword_length = 2 },
|
||||||
{ name = 'buffer', keyword_length = 3 },
|
{ name = 'buffer', keyword_length = 3 },
|
||||||
},
|
},
|
||||||
view = {
|
view = {
|
||||||
entries = 'native',
|
entries = 'native',
|
||||||
},
|
},
|
||||||
completion = {
|
completion = {
|
||||||
completeopt = 'menu,menuone,noinsert'
|
completeopt = 'menu,menuone,noinsert',
|
||||||
|
docs_initially_visible = true
|
||||||
},
|
},
|
||||||
window = {
|
window = {
|
||||||
documentation = cmp.config.window.bordered()
|
documentation = cmp.config.window.bordered()
|
||||||
@@ -94,33 +112,35 @@ cmp.setup({
|
|||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
|
|
||||||
lsp.set_preferences({
|
|
||||||
suggest_lsp_servers = true,
|
vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
sign_icons = {
|
callback = function(args)
|
||||||
error = 'E',
|
local bufnr = args.buf
|
||||||
warn = 'W',
|
|
||||||
hint = 'H',
|
local opts = { buffer = bufnr, remap = false }
|
||||||
info = 'I'
|
|
||||||
}
|
vim.keymap.set('n', 'gd', function() vim.lsp.buf.definition() end, opts)
|
||||||
|
vim.keymap.set('n', 'K', function() vim.lsp.buf.hover() end, opts)
|
||||||
|
vim.keymap.set('n', '<leader>vws', function() vim.lsp.buf.workspace_symbol() end, opts)
|
||||||
|
vim.keymap.set('n', '<leader>vd', function() vim.diagnostic.open_float() end, opts)
|
||||||
|
vim.keymap.set('n', '[d', function() vim.diagnostic.goto_next() end, opts)
|
||||||
|
vim.keymap.set('n', ']d', function() vim.diagnostic.goto_prev() end, opts)
|
||||||
|
vim.keymap.set('n', '<leader>vca', function() vim.lsp.buf.code_action() end, opts)
|
||||||
|
vim.keymap.set('n', '<leader>vrr', function() vim.lsp.buf.references() end, opts)
|
||||||
|
vim.keymap.set('n', '<leader>vrn', function() vim.lsp.buf.rename() end, opts)
|
||||||
|
vim.keymap.set('i', '<C-h>', function() vim.lsp.buf.signature_help() end, opts)
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
lsp.on_attach(function(client, bufnr)
|
|
||||||
local opts = { buffer = bufnr, remap = false }
|
|
||||||
|
|
||||||
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
|
|
||||||
vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts)
|
|
||||||
vim.keymap.set("n", "<leader>vws", function() vim.lsp.buf.workspace_symbol() end, opts)
|
|
||||||
vim.keymap.set("n", "<leader>vd", function() vim.diagnostic.open_float() end, opts)
|
|
||||||
vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts)
|
|
||||||
vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts)
|
|
||||||
vim.keymap.set("n", "<leader>vca", function() vim.lsp.buf.code_action() end, opts)
|
|
||||||
vim.keymap.set("n", "<leader>vrr", function() vim.lsp.buf.references() end, opts)
|
|
||||||
vim.keymap.set("n", "<leader>vrn", function() vim.lsp.buf.rename() end, opts)
|
|
||||||
vim.keymap.set("i", "<C-h>", function() vim.lsp.buf.signature_help() end, opts)
|
|
||||||
end)
|
|
||||||
|
|
||||||
lsp.setup()
|
|
||||||
|
|
||||||
vim.diagnostic.config({
|
vim.diagnostic.config({
|
||||||
virtual_text = true
|
virtual_text = true,
|
||||||
|
update_in_insert = true,
|
||||||
|
float = {
|
||||||
|
focusable = false,
|
||||||
|
style = 'minimal',
|
||||||
|
border = 'rounded',
|
||||||
|
source = 'always',
|
||||||
|
header = '',
|
||||||
|
prefix = ''
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -39,19 +39,20 @@ return require('packer').startup(function(use)
|
|||||||
requires = { 'nvim-tree/nvim-web-devicons', opt = true }
|
requires = { 'nvim-tree/nvim-web-devicons', opt = true }
|
||||||
}
|
}
|
||||||
|
|
||||||
use {
|
use('williamboman/mason.nvim')
|
||||||
'VonHeikemen/lsp-zero.nvim',
|
|
||||||
branch = 'v3.x',
|
|
||||||
requires = {
|
|
||||||
{ 'williamboman/mason.nvim' },
|
|
||||||
{ 'williamboman/mason-lspconfig.nvim' },
|
|
||||||
|
|
||||||
-- LSP Support
|
|
||||||
{ 'neovim/nvim-lspconfig' },
|
use('williamboman/mason-lspconfig.nvim')
|
||||||
-- Autocompletion
|
|
||||||
{ 'hrsh7th/nvim-cmp' },
|
-- LSP Support
|
||||||
{ 'hrsh7th/cmp-nvim-lsp' },
|
use('neovim/nvim-lspconfig')
|
||||||
{ 'L3MON4D3/LuaSnip' },
|
-- Autocompletion
|
||||||
}
|
use('hrsh7th/nvim-cmp')
|
||||||
}
|
use('hrsh7th/cmp-nvim-lsp')
|
||||||
|
use('hrsh7th/cmp-nvim-lsp-signature-help')
|
||||||
|
use('hrsh7th/cmp-nvim-lua')
|
||||||
|
use('hrsh7th/cmp-buffer')
|
||||||
|
use('hrsh7th/cmp-path')
|
||||||
|
use('hrsh7th/cmp-cmdline')
|
||||||
|
use('L3MON4D3/LuaSnip')
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -84,21 +84,41 @@ _G.packer_plugins = {
|
|||||||
path = "/home/j409/.local/share/nvim/site/pack/packer/start/catppuccin",
|
path = "/home/j409/.local/share/nvim/site/pack/packer/start/catppuccin",
|
||||||
url = "https://github.com/catppuccin/nvim"
|
url = "https://github.com/catppuccin/nvim"
|
||||||
},
|
},
|
||||||
|
["cmp-buffer"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/j409/.local/share/nvim/site/pack/packer/start/cmp-buffer",
|
||||||
|
url = "https://github.com/hrsh7th/cmp-buffer"
|
||||||
|
},
|
||||||
|
["cmp-cmdline"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/j409/.local/share/nvim/site/pack/packer/start/cmp-cmdline",
|
||||||
|
url = "https://github.com/hrsh7th/cmp-cmdline"
|
||||||
|
},
|
||||||
["cmp-nvim-lsp"] = {
|
["cmp-nvim-lsp"] = {
|
||||||
loaded = true,
|
loaded = true,
|
||||||
path = "/home/j409/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
|
path = "/home/j409/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
|
||||||
url = "https://github.com/hrsh7th/cmp-nvim-lsp"
|
url = "https://github.com/hrsh7th/cmp-nvim-lsp"
|
||||||
},
|
},
|
||||||
|
["cmp-nvim-lsp-signature-help"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/j409/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp-signature-help",
|
||||||
|
url = "https://github.com/hrsh7th/cmp-nvim-lsp-signature-help"
|
||||||
|
},
|
||||||
|
["cmp-nvim-lua"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/j409/.local/share/nvim/site/pack/packer/start/cmp-nvim-lua",
|
||||||
|
url = "https://github.com/hrsh7th/cmp-nvim-lua"
|
||||||
|
},
|
||||||
|
["cmp-path"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/j409/.local/share/nvim/site/pack/packer/start/cmp-path",
|
||||||
|
url = "https://github.com/hrsh7th/cmp-path"
|
||||||
|
},
|
||||||
harpoon = {
|
harpoon = {
|
||||||
loaded = true,
|
loaded = true,
|
||||||
path = "/home/j409/.local/share/nvim/site/pack/packer/start/harpoon",
|
path = "/home/j409/.local/share/nvim/site/pack/packer/start/harpoon",
|
||||||
url = "https://github.com/ThePrimeagen/harpoon"
|
url = "https://github.com/ThePrimeagen/harpoon"
|
||||||
},
|
},
|
||||||
["lsp-zero.nvim"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/j409/.local/share/nvim/site/pack/packer/start/lsp-zero.nvim",
|
|
||||||
url = "https://github.com/VonHeikemen/lsp-zero.nvim"
|
|
||||||
},
|
|
||||||
["lspkind.nvim"] = {
|
["lspkind.nvim"] = {
|
||||||
loaded = true,
|
loaded = true,
|
||||||
path = "/home/j409/.local/share/nvim/site/pack/packer/start/lspkind.nvim",
|
path = "/home/j409/.local/share/nvim/site/pack/packer/start/lspkind.nvim",
|
||||||
|
|||||||
Reference in New Issue
Block a user