.config/nvim/lua/config/lsp.lua

changeset 1163
40367220022e
parent 1101
40419d8e3cbb
child 1166
34bf03fa07e4
equal deleted inserted replaced
1162:e6da5f7156c2 1163:40367220022e
31 buffer = args.buf, 31 buffer = args.buf,
32 callback = vim.diagnostic.open_float, 32 callback = vim.diagnostic.open_float,
33 }) 33 })
34 end, 34 end,
35 }) 35 })
36
37 -- Format on write, but only certain languages
38 local autoformat_filetypes = { elixir = true, go = true }
39
40 vim.api.nvim_create_autocmd("BufWritePre", {
41 group = vim.api.nvim_create_augroup("lsp_autoformat", { clear = true }),
42 callback = function()
43 if autoformat_filetypes[vim.bo.filetype] then
44 vim.lsp.buf.format({ timeout_ms = 100 })
45 end
46 end,
47 })

mercurial