folke / trouble.nvim

🚦 A pretty diagnostics, references, telescope results, quickfix and location list to help you solve all the trouble your code is causing.
Apache License 2.0
5.11k stars 173 forks source link

feature: Single-line item in quickfix/location lists if there is one result per file #466

Closed serhez closed 1 month ago

serhez commented 1 month ago

Did you check the docs?

Is your feature request related to a problem? Please describe.

Currently, if using Telescope to search files (for example) and opening the selected files in a Trouble quickfix list, the results are shown as below:

Screenshot 2024-06-01 at 14 19 48

This is both inefficient in terms of screen space and in terms of traversing the list, as it requires double the lines and keypresses to go to an item than if each file result was in a single line (like it happens in the original quickfix list).

Describe the solution you'd like

Perhaps one way to manage this that seems faithful to this plugin's design would be to collapse two-line results into a single line. This behavior could also be toggleable via a config parameter.

Describe alternatives you've considered

N/A.

Additional context

No response

folke commented 1 month ago

You can fully customize any view. Check the telescope mode config here: https://github.com/folke/trouble.nvim/blob/main/lua/trouble/sources/telescope.lua#L18

Set groups = {} change the section format to your liking

folke commented 3 weeks ago

I just made a change so that when telescope results are just file listings, then mode telescope_files is used instead. So this should now work out of the box

serhez commented 3 weeks ago

@folke Thanks for letting me know! Would it be possible to do this with Trouble's quickfix and location lists too?