From b481b644ddf9f02470ec50264e63c6dd69d444f8 Mon Sep 17 00:00:00 2001 From: sus-domesticus <134197728+sus-domesticus@users.noreply.github.com> Date: Tue, 9 Jul 2024 18:12:02 +0300 Subject: [PATCH] fix(java): fix `config_overrides` for tests (#3968) ## Description 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. ## Related Issue(s) - Fixes #3965. ## Checklist - [ x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. --- 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", },