trouble.nvim icon indicating copy to clipboard operation
trouble.nvim copied to clipboard

Feature request: possibility of different grouping

Open echasnovski opened this issue 4 years ago • 5 comments

Currently, when using with 'trouble.nvim' all found keyword comments are grouped by file. I often find myself wanting to look only at all TODOs. I can do that by unfolding everything and using built-in search, but it is a bit troublesome. Maybe there is a way to incorporate different grouping? So that folds represent different keywords and not files. Maybe a keymapping inside Trouble window?

Or is it better to open this issue in 'trouble.nvim'?

Command I am currently using: TroubleToggle todo.

echasnovski avatar May 18 '21 12:05 echasnovski

I've thought about this as well. I think I'll add an option to change the grouping like you mention:

  • group by file (default)
  • group by type (diagnostics severity, todo keyword, ,...)

I'll add it to the list

folke avatar May 18 '21 12:05 folke

Maybe it can be not a plugin option but something that can be picked by user in runtime? So by default it opens with file grouping but can be switched to type grouping and back.

echasnovski avatar May 18 '21 12:05 echasnovski

@echasnovski yep, that's what I had in mind

folke avatar May 18 '21 12:05 folke

Any update on this? I'd also find it useful to have nested folds (e.g. First level could be grouped by module/folder, second level by file).

tom-anders avatar Oct 29 '22 09:10 tom-anders

As @tom-anders suggested, I also think that nested folds would be very useful. For example, in the Java/Scala world, we usually have our production code under src/main/scala and tests in src/test/scala. When navigating code, you are often only interested in usages (lsp_references) in the main code. So grouping like this would be ideal:

src/main/scala/
    foo/File1
        <the reference>
    foo/File2
        <the reference>
src/test/scala/
    foo/File1Test
        <the reference>

Depending on the build tool and configuration of the project there might be more directories like src/main/protobuf or src/it/scala for integration tests. It would therefore be great if a pattern could be configured instead of listing these directories manually.

kluen avatar Jan 13 '23 17:01 kluen

With Trouble v3, this is finally possible! :)

The docs on this are still a bit lacking, but you can check out the builtin sources on how to change the groups and formats

folke avatar Mar 29 '24 07:03 folke

Huzzah! Almost three years later!

echasnovski avatar Mar 29 '24 09:03 echasnovski