Skip to content

Commit

Permalink
feat: make the preview action a toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed May 30, 2024
1 parent 8cc680a commit 86da179
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lua/trouble/config/actions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ local M = {
self:goto_main()
end,
preview = function(self, ctx)
self:preview(ctx.item)
local Preview = require("trouble.view.preview")
if Preview.preview then
Preview.close()
else
self:preview(ctx.item)
end
end,
toggle_auto_preview = function(self)
self.opts.auto_preview = not self.opts.auto_preview
Expand Down Expand Up @@ -57,7 +62,7 @@ local M = {
end
end,
inspect = function(_, ctx)
vim.print(ctx.item)
vim.print(ctx.item or (ctx.node and ctx.node.item))
end,
fold_reduce = function(self)
self:fold_level({ add = vim.v.count1 })
Expand Down

0 comments on commit 86da179

Please sign in to comment.