From 22ccf8cd62630a2c58a6f9e4a212db9828afe91c Mon Sep 17 00:00:00 2001 From: Michael Lingelbach Date: Sun, 14 Feb 2021 18:41:04 -0800 Subject: fix on_attach to correctly pass bufnr as second argument --- lua/lspconfig/configs.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lua') diff --git a/lua/lspconfig/configs.lua b/lua/lspconfig/configs.lua index a17385b9..dcf0e6aa 100644 --- a/lua/lspconfig/configs.lua +++ b/lua/lspconfig/configs.lua @@ -113,7 +113,7 @@ function configs.__newindex(t, config_name, config_def) new_config._on_attach = new_config.on_attach new_config.on_attach = vim.schedule_wrap(function(client, bufnr) if bufnr == api.nvim_get_current_buf() then - M._setup_buffer(client.id) + M._setup_buffer(client.id, bufnr) else api.nvim_command(string.format( "autocmd BufEnter ++once lua require'lspconfig'[%q]._setup_buffer(%d)" @@ -147,10 +147,10 @@ function configs.__newindex(t, config_name, config_def) M.make_config = make_config end - function M._setup_buffer(client_id) + function M._setup_buffer(client_id, bufnr) local client = lsp.get_client_by_id(client_id) if client.config._on_attach then - client.config._on_attach(client) + client.config._on_attach(client, bufnr) end if client.config.commands and not vim.tbl_isempty(client.config.commands) then M.commands = util.tbl_deep_extend("force", M.commands, client.config.commands) -- cgit v1.2.3-70-g09d2