Is your feature request related to a problem? Please describe.
There is no problem, just a quality of life
Describe the solution you'd like
Currently, using require("trouble.sources.telescope").open only takes the passed buffer number from telescope. After adding the items to the trouble buffer, it opens the window with require("trouble").open("telescope").
It would be a nice quality of life to allow the user to pass additional options to the require("trouble.sources.telescope").open function. This would allow the user to change the auto focus, preview, and other options.
local open_with_trouble = require("trouble.sources.telescope").open
require("telescope").setup({
defaults = {
mappings = {
n = { ["<c-t>"] = open_with_trouble }
}
}
})
-- to something like
local open_with_trouble = function (bufnr)
require("trouble.sources.telescope").open(bufnr, {
focus = true,
-- etc...
})
end
require("telescope").setup({
defaults = {
mappings = {
n = { ["<c-t>"] = open_with_trouble }
}
}
})
Maybe a table merge so that the end of trouble.sources.trouble.add can look something like this
function M.add(prompt_bufnr, opts)
--- ... add items from buffer
opts = vim.tbl_extend("force", {}, opts, { mode = "telescope" })
vim.schedule(function()
require("telescope.actions").close(prompt_bufnr),
require("trouble").open(opts)
end)
end
Describe alternatives you've considered
Alternatively the opening of the window could be pulled out and into the trouble.sources.telescope.open function itself
Did you check the docs?
Is your feature request related to a problem? Please describe.
There is no problem, just a quality of life
Describe the solution you'd like
Currently, using
require("trouble.sources.telescope").open
only takes the passed buffer number from telescope. After adding the items to the trouble buffer, it opens the window withrequire("trouble").open("telescope")
.It would be a nice quality of life to allow the user to pass additional options to the
require("trouble.sources.telescope").open
function. This would allow the user to change the auto focus, preview, and other options.Maybe a table merge so that the end of
trouble.sources.trouble.add
can look something like thisDescribe alternatives you've considered
Alternatively the opening of the window could be pulled out and into the
trouble.sources.telescope.open
function itselfAdditional context
No response