autoformat

This commit is contained in:
2024-09-30 06:12:57 +02:00
parent 2bed3cbe6e
commit b9b77abfa4
8 changed files with 116 additions and 109 deletions

View File

@@ -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