Closed martskins closed 4 years ago
@autozimu I'm not 100% sure if I missed something and there's already something in place for this or if this is in fact a missing feature, so I'll this for you to comment on and then I'll merge it if there aren't any functions that provide this functionality.
I personally use quickfix to display diagnostics (the default) with :cp
, :cn
to jump between locations. While using location list, I believe :prev
, :lnext
serve similar purpose. Is this actually sufficient?
Not quite. The only bit that I find difficult with that workflow is that the items in the location/quickfix list are (logically) not re-sorted every time you move the cursor, so the "next" item in the location list is not really the next diagnostic based on the position of the cursor, which makes navigation a little difficult if you have many diagnostics. It can also be a little surprising, if you have the location list closed and do :lnext
then you don't really know which diagnostic that is gonna take you too.
Another thing is that diagnostics do not seem to be ordered by line number in the location/quickfix list, maybe that can be solved though, but it still doesn't solve the previous issue.
Ahh, makes sense. Can you add this gist to the function doc? Then let's merge it in.
On Wed, Jul 15, 2020 at 00:15 martskins notifications@github.com wrote:
Not quite. The only bit that I find difficult with that workflow is that the items in the location/quickfix list are (logically) not re-sorted every time you move the cursor, so the "next" item in the location list is not really the next diagnostic based on the position of the cursor, which makes navigation a little difficult if you have many diagnostics.
Another thing is that diagnostics do not seem to be ordered by line number in the location/quickfix list, maybe that can be solved though, but it still doesn't solve the previous issue.
— You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/autozimu/LanguageClient-neovim/pull/1075#issuecomment-658590968, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALC337EAK6MRZ4KUQLS6ILR3VJQLANCNFSM4OYVQM4A .
I adjusted the doc to make it a little clearer, but not sure if that's what you meant.
This PR creates two new function
LanguageClient_diagnosticsNext
andLanguageClient_diagnosticsPrevious
which enable the user to jump to the next or previous diagnostic in the current buffer, relative to the cursor's current position.