Browse Source

Update lsp config

master
blallo 8 months ago
parent
commit
ce2d05e65f
Signed by: blallo GPG Key ID: 0CBE577C9B72DC3F
  1. 17
      lua/config/lspconfig.lua

17
lua/config/lspconfig.lua

@ -31,7 +31,7 @@ local on_attach = function(client, bufrn)
end
-- 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
nvim_lsp[lsp].setup {
on_attach = on_attach,
@ -41,5 +41,20 @@ for _, lsp in ipairs(servers) do
}
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
vim.cmd [[autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync()]]

Loading…
Cancel
Save