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.44k stars 177 forks source link

feature: Edit trouble windows "top parts" #446

Closed simonmandlik closed 4 months ago

simonmandlik commented 4 months ago

Did you check the docs?

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

It would be great to be able to modify how are tops of trouble windows displayed.

For example, I would like to get rid of "Document Symbols" and filename in :Trouble lsp_document_symbols, because it adds very little information (there is always only one file) at the expense of two additional indentations, which is especially unneeded with win.position = right:

image

On the other hand, I would find it handy to e.g. display Quickfix list and Location list on top of Trouble qflist and Trouble loclist, since I always forget, which I'm currently having opened.

folke commented 4 months ago

You can fully customize all of that, but docs are a bit lacking for that. Check the src code for the sources. It contains all the defaults for differernt modes. You can override those modes in your own config.

folke commented 4 months ago

Check this https://github.com/folke/trouble.nvim/blob/f248c6941ba5a48be531cbb25aac32e1042c65ad/lua/trouble/sources/lsp.lua#L25

Those are the same options you can put in your config.

simonmandlik commented 4 months ago

For reference, this works for qflist and loclist in config

qflist = { title = "{hl:Title}Quickfix List{hl} {count}" },
loclist = { title = "{hl:Title}Location List{hl} {count}" }

However, I can't get rid of the title row and indent in the lsp_document_symbols case:

lsp_document_symbols = {
    title = "",
    groups = {},
}
image

File is gone, but title row remained and is empty. Setting title to nil seems to have no effect.