Skip to content

Commit

Permalink
fix: auto_open was broken. Fixed now #29
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed May 15, 2021
1 parent 0ec056f commit a2f2b92
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions lua/trouble/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,12 @@ function Trouble.refresh(opts)
util.debug("refresh")
view:update(opts)
end
elseif opts.auto and config.options.auto_open and opts.mode == config.options.mode then
local items = require("trouble.providers").get(
vim.api.nvim_get_current_win(),
vim.api.nvim_get_current_buf(),
config.options
)
if #items > 0 then
Trouble.open(opts)
end
elseif opts.auto and config.options.auto_open and opts.provider == config.options.mode then
require("trouble.providers").get(vim.api.nvim_get_current_win(), vim.api.nvim_get_current_buf(), function(results)
if #results > 0 then
Trouble.open(opts)
end
end, config.options)
end
end

Expand Down

0 comments on commit a2f2b92

Please sign in to comment.