From 90a5602737c478ef051497e8e7d3d8a1aafd4556 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Thu, 12 Jan 2023 11:07:18 +0100 Subject: Fix null-ls for neovim 8 --- .config/nvim/lua/lsp_conf.lua | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to '.config/nvim') diff --git a/.config/nvim/lua/lsp_conf.lua b/.config/nvim/lua/lsp_conf.lua index f5d2769..591f51e 100644 --- a/.config/nvim/lua/lsp_conf.lua +++ b/.config/nvim/lua/lsp_conf.lua @@ -19,7 +19,6 @@ local opts = { noremap=true, silent=true } null_ls.setup({ debug = false, - save_after_format = false, sources = { -- Python null_ls.builtins.formatting.black, @@ -33,12 +32,7 @@ null_ls.setup({ -- JS/TS null_ls.builtins.formatting.prettier, }, - on_attach = function(client) - if client.server_capabilities.document_formatting then - vim.keymap.set('n', '', 'lua vim.lsp.buf.formatting_sync(nil, 2000)', opts) - vim.cmd "autocmd BufWritePre lua vim.lsp.buf.formatting_seq_sync(nil, 2000)" - end - end + on_attach = common_on_attach }) -- Setup lspconfig. @@ -56,6 +50,8 @@ local common_on_attach = function(client, bufnr) vim.api.nvim_buf_set_keymap(bufnr, "n", "K", "lua vim.lsp.buf.hover()", opts) vim.api.nvim_buf_set_keymap(bufnr, "n", "gr", "lua vim.lsp.buf.references()", opts) vim.api.nvim_buf_set_keymap(bufnr, "n", "e", "lua vim.lsp.diagnostic.show_line_diagnostics()", opts) + vim.keymap.set('n', '', 'lua vim.lsp.buf.format {async = true}', opts) + vim.cmd "autocmd BufWritePre lua vim.lsp.buf.format {async = true}" -- lsp_status.on_attach(client) end -- cgit v1.2.3-18-g5258