Update lsp config

This commit is contained in:
sfigato 2021-11-19 23:42:14 +01:00
parent 1477e88bd9
commit ce2d05e65f
Signed by: blallo
GPG Key ID: 0CBE577C9B72DC3F

View File

@ -31,7 +31,7 @@ local on_attach = function(client, bufrn)
end end
-- Launch language servers -- Launch language servers
local servers = { 'pylsp', 'gopls', 'rust_analyzer', 'tsserver', 'elixirls', 'dartls', 'denols', 'clangd' } local servers = { 'pyright', 'pylsp', 'gopls', 'rust_analyzer', 'tsserver', 'elixirls', 'dartls', 'denols', 'clangd', 'zls' }
for _, lsp in ipairs(servers) do for _, lsp in ipairs(servers) do
nvim_lsp[lsp].setup { nvim_lsp[lsp].setup {
on_attach = on_attach, on_attach = on_attach,
@ -41,5 +41,20 @@ for _, lsp in ipairs(servers) do
} }
end end
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
require'lspconfig'.jsonls.setup {
cmd = { "vscode-json-languageserver", "--stdio" },
capabilities = capabilities,
commands = {
Format = {
function()
vim.lsp.buf.range_formatting({},{0,0},{vim.fn.line("$"),0})
end
},
},
}
-- Format on save -- Format on save
vim.cmd [[autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync()]] vim.cmd [[autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync()]]