Skip to content

Conversation

@martskins
Copy link
Collaborator

This PR creates two new function LanguageClient_diagnosticsNext and LanguageClient_diagnosticsPrevious which enable the user to jump to the next or previous diagnostic in the current buffer, relative to the cursor's current position.

Peek 2020-07-13 17-56

@martskins martskins force-pushed the cycle-diagnostics branch from 9ea33b3 to 28dd20f Compare July 13, 2020 17:00
@martskins
Copy link
Collaborator Author

@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.

@autozimu
Copy link
Owner

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?

@martskins
Copy link
Collaborator Author

martskins commented Jul 15, 2020

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.

@autozimu
Copy link
Owner

autozimu commented Jul 15, 2020 via email

@martskins
Copy link
Collaborator Author

I adjusted the doc to make it a little clearer, but not sure if that's what you meant.

@martskins martskins force-pushed the cycle-diagnostics branch from 28dd20f to 23045f3 Compare July 16, 2020 07:23
}
}) {
let target = diagnostic.range.start.line + 1;
let _: String = self.vim()?.rpcclient.call("execute", json!([target]))?;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it convenient to jump to proper column as well? Especially helpful when there are more than one diagnostics reported for the same line.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah good call!

@martskins martskins force-pushed the cycle-diagnostics branch from 23045f3 to 2050e73 Compare July 17, 2020 16:17
@autozimu autozimu merged commit d4d1db7 into autozimu:dev Jul 24, 2020
jez pushed a commit to jez/LanguageClient-neovim that referenced this pull request Feb 26, 2021
* Add function and plug mappings to cycle diagnostics

* Fix lint errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants