From debabaf884fc26e9dc257aa5b62581d3846f80f1 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Sat, 8 Mar 2025 09:30:36 +0000 Subject: fix(lsp)!: pass buffer number to root_dir function Problem: The root dir function is not passed any context and can only assume the current buffer is the one being attached. The main use case is for getting the path of the buffer using `nvim_buf_get_name`. Solution: Pass the buffer number as the first argument. --- test/functional/plugin/lsp_spec.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test/functional/plugin') diff --git a/test/functional/plugin/lsp_spec.lua b/test/functional/plugin/lsp_spec.lua index 22c9e4658f..f402ac7e8c 100644 --- a/test/functional/plugin/lsp_spec.lua +++ b/test/functional/plugin/lsp_spec.lua @@ -6348,7 +6348,8 @@ describe('LSP', function() vim.lsp.config('foo', { cmd = server.cmd, filetypes = { 'foo' }, - root_dir = function(cb) + root_dir = function(bufnr, cb) + assert(tmp1 == vim.api.nvim_buf_get_name(bufnr)) vim.system({ 'sleep', '0' }, {}, function() cb('some_dir') end) -- cgit