From 6096e5c1b17f642d8d41a866a77a3a70ceae7564 Mon Sep 17 00:00:00 2001 From: Patrick Lindsay Date: Fri, 9 Feb 2024 15:37:13 -0600 Subject: [PATCH] Handle nil test.name I assume the treesitter API changed (again) and caused this to start breaking. If I try to run `debug_test()` outside of a test file, then I get an exception for trying to concatenate a nil value. This commit just fixes the "no test found" short-circuit clause to handle empty string or nil. --- lua/dap-go.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/dap-go.lua b/lua/dap-go.lua index b2419fe..bbf2304 100644 --- a/lua/dap-go.lua +++ b/lua/dap-go.lua @@ -145,7 +145,7 @@ end function M.debug_test() local test = ts.closest_test() - if test.name == "" then + if test.name == "" or test.name == nil then vim.notify("no test found") return false end