Skip to content

Commit

Permalink
Merge pull request #630 from ckipp01/enableTestExplorer
Browse files Browse the repository at this point in the history
refactor: include a message when Test Explorer is not set for select commands
  • Loading branch information
ckipp01 authored Nov 24, 2023
2 parents 1a008b3 + df19be3 commit 72972ab
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
14 changes: 12 additions & 2 deletions lua/metals.lua
Original file line number Diff line number Diff line change
Expand Up @@ -508,11 +508,21 @@ M.toggle_setting = function(setting)
end

M.select_test_suite = function()
test_explorer.dap_select_test_suite()
local config = conf.get_config_cache()
if config and config.settings.metals.testUserInterface == "Test Explorer" then
test_explorer.dap_select_test_suite()
else
log.error_and_show(messages.enable_test_explorer)
end
end

M.select_test_case = function()
test_explorer.dap_select_test_case()
local config = conf.get_config_cache()
if config and config.settings.metals.testUserInterface == "Test Explorer" then
test_explorer.dap_select_test_case()
else
log.error_and_show(messages.enable_test_explorer)
end
end

M.open_new_github_issue = function()
Expand Down
3 changes: 3 additions & 0 deletions lua/metals/messages.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,7 @@ You recieved a null response for the tree view.
If you're using Scala 3, this is expected as it's not support yet.
If you're using Scala 2, please create an issue for this in nvim-metals.]]

M.enable_test_explorer = [[
You can't use this command unless you have "Test Explorer" set as the value of testUserInterface in your config.
You can read more about this in :h metals-nvim-dap.]]
return M

0 comments on commit 72972ab

Please sign in to comment.