Skip to content

Commit

Permalink
fix: don't display picker when no build targets are returned
Browse files Browse the repository at this point in the history
When you just opened up a project if you quickly tried to get the build
target info before importing was done, you'd get an empty table back
resulting in an empty picker, which was confusing. This just adds in a
check to ensure the table isn't empty.
  • Loading branch information
ckipp01 committed Oct 20, 2023
1 parent 7e30210 commit 9a45aa8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lua/metals.lua
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ M.show_build_target_info = function()
if err then
log.error_and_show(string.format("Unable to retrieve build targets", method))
log.error(err)
elseif resp then
elseif resp and not vim.tbl_isempty(resp) then
vim.ui.select(resp, {
prompt = "Choose build target to view:",
}, function(choice)
Expand All @@ -374,7 +374,7 @@ M.show_build_target_info = function()
end
end)
else
log.warn_and_show("Metals returned no info for build target.")
log.warn_and_show("Metals returned no info for build targets. If you're still importing, wait and try again.")
end
end
execute_command({ command = "metals.list-build-targets" }, choose_and_decode)
Expand Down

0 comments on commit 9a45aa8

Please sign in to comment.