From a57fab2f2d852ec33bdbcb7fc8b90d611e6a653b Mon Sep 17 00:00:00 2001 From: glepnir Date: Fri, 24 Apr 2026 21:30:33 +0800 Subject: [PATCH] test: curbuf initialized in describe-block #39365 Problem: curbuf was initialized at describe-block load time before any Nvim session existed. Solution: Replace with 0 directly at call sites. --- test/functional/plugin/lsp/util_spec.lua | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/test/functional/plugin/lsp/util_spec.lua b/test/functional/plugin/lsp/util_spec.lua index c4d99854f7..8aa78602c5 100644 --- a/test/functional/plugin/lsp/util_spec.lua +++ b/test/functional/plugin/lsp/util_spec.lua @@ -1400,18 +1400,16 @@ describe('vim.lsp.util', function() Screen.new(10, 10) feed('9iG4k') end) - local var_name = 'lsp_floating_preview' - local curbuf = api.nvim_get_current_buf() it('after fclose', function() exec_lua(function() vim.lsp.util.open_floating_preview({ 'test' }, '', { height = 5, width = 2 }) end) - eq(true, api.nvim_win_is_valid(api.nvim_buf_get_var(curbuf, var_name))) + eq(true, api.nvim_win_is_valid(api.nvim_buf_get_var(0, var_name))) command('fclose') -- b:lsp_floating_preview should be cleared. - eq('Key not found: lsp_floating_preview', pcall_err(api.nvim_buf_get_var, curbuf, var_name)) + eq('Key not found: lsp_floating_preview', pcall_err(api.nvim_buf_get_var, 0, var_name)) end) it('after CursorMoved', function() @@ -1427,7 +1425,7 @@ describe('vim.lsp.util', function() -- 'winfixbuf' should be set. #39058 eq(true, winfixbuf) -- b:lsp_floating_preview should be cleared. - eq('Key not found: lsp_floating_preview', pcall_err(api.nvim_buf_get_var, curbuf, var_name)) + eq('Key not found: lsp_floating_preview', pcall_err(api.nvim_buf_get_var, 0, var_name)) end) end)