Skip to content

Commit

Permalink
fix(preview): correctly pass options to create scratch buffers. Fixes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed May 30, 2024
1 parent 42693be commit c50c7e3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lua/trouble/view/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ function M:preview(item)
return Util.warn("No item to preview")
end

return Preview.open(self, item)
return Preview.open(self, item, { scratch = self.opts.preview.scratch })
end

function M:main()
Expand Down
5 changes: 3 additions & 2 deletions lua/trouble/view/preview.lua
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,16 @@ end

---@param view trouble.View
---@param item trouble.Item
function M.open(view, item)
---@param opts? {scratch?:boolean}
function M.open(view, item, opts)
if M.item() == item then
return
end
if M.preview then
M.close()
end

local buf = M.create(item)
local buf = M.create(item, opts)
if not buf then
return
end
Expand Down

0 comments on commit c50c7e3

Please sign in to comment.