From 3d923bfa5010d0a210696bbb6bd2c537c9386d84 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 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 | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/test/functional/plugin/lsp/util_spec.lua b/test/functional/plugin/lsp/util_spec.lua index bf573f68ee..430a927805 100644 --- a/test/functional/plugin/lsp/util_spec.lua +++ b/test/functional/plugin/lsp/util_spec.lua @@ -1403,16 +1403,15 @@ describe('vim.lsp.util', function() feed('9iG4k') curbuf = api.nvim_get_current_buf() end) - local var_name = 'lsp_floating_preview' it('clean bufvar 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') - 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('clean bufvar after CursorMoved', function() @@ -1424,7 +1423,7 @@ describe('vim.lsp.util', function() return result end) eq(true, result) - 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)