autoformat
This commit is contained in:
@@ -8,13 +8,21 @@ require('mason').setup({
|
||||
}
|
||||
})
|
||||
|
||||
local servers = { 'pylsp', 'lua_ls', 'rust_analyzer', 'zls'}
|
||||
local servers = { 'pylsp', 'lua_ls', 'rust_analyzer', 'zls' }
|
||||
|
||||
require('mason-lspconfig').setup({
|
||||
-- A list of servers to automatically install if they're not already installed
|
||||
ensure_installed = servers,
|
||||
})
|
||||
|
||||
-- auto format on save
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
buffer = vim.b.buffer,
|
||||
callback = function()
|
||||
vim.lsp.buf.format { async = false }
|
||||
end
|
||||
})
|
||||
|
||||
-- Set different settings for different languages' LSP
|
||||
-- LSP list: https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
|
||||
-- How to use setup({}): https://github.com/neovim/nvim-lspconfig/wiki/Understanding-setup-%7B%7D
|
||||
@@ -63,7 +71,7 @@ end
|
||||
-- 2. add configuration below
|
||||
|
||||
for _, lsp in ipairs(servers) do
|
||||
lspconfig[lsp].setup {
|
||||
on_attach = on_attach,
|
||||
}
|
||||
lspconfig[lsp].setup {
|
||||
on_attach = on_attach,
|
||||
}
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user