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

Configurable diagnostics sorting

Open WhyNotHugo opened this issue 4 years ago • 3 comments

I'd like to sort diagnostics by line number. I see that right now diagnostics are sorted by severity here:

https://github.com/folke/trouble.nvim/blob/a2a7dbfefc5ebdf1a9c1d37e9df1d26a3b13c1cd/lua/trouble/providers/init.lua#L37-L47

That's done in an anonymous function. Do you think it would be reasonable to make this function configurable (so I can pass in my custom sorter)?

WhyNotHugo avatar Jul 20 '21 09:07 WhyNotHugo

I'd also be interested in configurable sorting!

elkowar avatar Jul 31 '21 16:07 elkowar

I patch the sorting like this:

https://git.sr.ht/~whynothugo/dotfiles/tree/main/item/home/.config/nvim/lua/_trouble.lua#L1-34

Making this function a config option would probably be the cleanest way to address that.

WhyNotHugo avatar Jul 31 '21 17:07 WhyNotHugo

I've published a potential solution in https://github.com/folke/trouble.nvim/pull/190

Please give it a shot and let me know if it also works for your sorting criteria.

WhyNotHugo avatar Jun 13 '22 22:06 WhyNotHugo