Skip to content

Commit

Permalink
fix(spec): properly process actions. Fixes #494
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Jun 11, 2024
1 parent 57b50a6 commit 3082f4b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lua/trouble/spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ function M.section(spec)
end

---@param action trouble.Action.spec
---@return trouble.Action
function M.action(action)
if type(action) == "string" then
action = { action = action, desc = action:gsub("_", " ") }
Expand All @@ -96,8 +97,12 @@ function M.action(action)
action = { action = action }
end
if type(action.action) == "string" then
action.desc = action.desc or action.action:gsub("_", " ")
local desc = action.action:gsub("_", " ")
action.action = require("trouble.config.actions")[action.action]
if type(action.action) == "table" then
action = action.action
end
action.desc = action.desc or desc
end
---@cast action trouble.Action
return action
Expand Down

0 comments on commit 3082f4b

Please sign in to comment.