From 5ac72cba72c2cbb0932534c2abe6983ab6ee4723 Mon Sep 17 00:00:00 2001 From: susd Date: Tue, 9 Jul 2024 17:49:19 +0300 Subject: [PATCH] fix(java): fix `config_overrides` for tests Problem In the default configuration `opts.test` is a boolean and the code tries to access `opts.test.config_overrides` which results in an error. Solution Use control flow to return nil in the case of `opts.test` being boolean. --- lua/lazyvim/plugins/extras/lang/java.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/java.lua b/lua/lazyvim/plugins/extras/lang/java.lua index 7d667338..f03e2ab7 100644 --- a/lua/lazyvim/plugins/extras/lang/java.lua +++ b/lua/lazyvim/plugins/extras/lang/java.lua @@ -227,13 +227,17 @@ return { ["t"] = { name = "+test" }, ["tt"] = { function() - require("jdtls.dap").test_class({ config_overrides = opts.test.config_overrides }) + require("jdtls.dap").test_class({ + config_overrides = type(opts.test) ~= "boolean" and opts.test.config_overrides or nil, + }) end, "Run All Test", }, ["tr"] = { function() - require("jdtls.dap").test_nearest_method({ config_overrides = opts.test.config_overrides }) + require("jdtls.dap").test_nearest_method({ + config_overrides = type(opts.test) ~= "boolean" and opts.test.config_overrides or nil, + }) end, "Run Nearest Test", },