Upgrade lsp-zero to version 4.x

main
Nick Zana 2 months ago
parent 082162454f
commit 13e2f31a86

@ -1,18 +1,22 @@
local lsp = require('lsp-zero').preset({ local lsp = require('lsp-zero')
name = 'minimal',
set_lsp_keymaps = false, -- name = 'minimal',
manage_nvim_cmp = true, -- set_lsp_keymaps = false,
suggest_lsp_servers = false, -- manage_nvim_cmp = true,
}) -- suggest_lsp_servers = false,
--})
local keybindings = require('keybindings') local keybindings = require('keybindings')
local on_attach = keybindings.on_attach local on_attach = keybindings.on_attach
local cmp_mapping = keybindings.cmp_mappings local cmp_mapping = keybindings.cmp_mappings
lsp.on_attach(on_attach) lsp.extend_lspconfig({
lsp_attach = on_attach,
capabilities = require('cmp_nvim_lsp').default_capabilities(),
})
local cmp = require('cmp') local cmp = require('cmp')
local cmp_config = lsp.defaults.cmp_config({ local cmp_config = {
preselect = 'none', preselect = 'none',
window = { window = {
completion = cmp.config.window.bordered(), completion = cmp.config.window.bordered(),
@ -26,25 +30,29 @@ local cmp_config = lsp.defaults.cmp_config({
experimental = { experimental = {
ghost_text = false -- conflicts with copilot.vim's preview ghost_text = false -- conflicts with copilot.vim's preview
}, },
}) }
cmp.setup(cmp_config) cmp.setup(cmp_config)
-- Configure lua language server for neovim
lsp.nvim_workspace()
lsp.configure('rust_analyzer', { lsp.configure('rust_analyzer', {
settings = { settings = {
["rust-analyzer"] = { ["rust-analyzer"] = {
procMacro = { procMacro = {
enable = true enable = true,
ignored = {
leptos_macro = { "server" },
},
},
cargo = {
allFeatures = true,
}, },
} }
} }
}) })
require'lspconfig'.tsserver.setup { lsp.configure('ts_ls', {
-- set commands to run the language server using npx
cmd = { "npx", "typescript-language-server", "--stdio" }, cmd = { "npx", "typescript-language-server", "--stdio" },
} })
lsp.configure('html', { lsp.configure('html', {
cmd = { "npx", "vscode-html-language-server", "--stdio" }, cmd = { "npx", "vscode-html-language-server", "--stdio" },
@ -61,6 +69,9 @@ lsp.configure('clangd', {})
lsp.configure('pylsp', {}) lsp.configure('pylsp', {})
lsp.setup_servers({'rust_analyzer', 'html', 'texlab', 'clangd', 'pylsp'}) -- gopls
lsp.configure('gopls', {})
lsp.setup_servers({'rust_analyzer', 'html', 'texlab', 'clangd', 'pylsp', 'gopls', 'ts_ls'})
lsp.setup() lsp.setup()

@ -30,7 +30,7 @@ local plugins = require('packer').startup(function(use)
-- lsp -- lsp
use { use {
'VonHeikemen/lsp-zero.nvim', 'VonHeikemen/lsp-zero.nvim',
branch = 'v2.x', branch = 'v4.x',
requires = { requires = {
-- LSP Support -- LSP Support
{'neovim/nvim-lspconfig'}, {'neovim/nvim-lspconfig'},

Loading…
Cancel
Save