Closed LukeFranceschini closed 2 months ago
Does this PR follow the Contribution Guidelines? Following is a partial checklist:
Proper conventional commit scoping:
For example, fix(lsp): some lsp-related bugfix
[x] Pull request title has the appropriate conventional commit prefix.
If applicable:
There were a couple different issues with the search for the next valid diagnostic location, which I've separated out into their own commits.
I used stylua and luacheck directly instead of through nix (because I was too lazy to set it up :see_no_evil: ) but they seemed to be satisfied with what I had. If I've missed anything just let me know. Similarly, I had six tests fail when I ran
luarocks --local test
but the same six tests fail even without my changes so hopefully that's fine.Thanks for all your work on this project by the way! I only recently started in rust and having the inline diagnostics show up as I work has been a huge time saver while I'm learning the ropes : )
To reproduce the issue, turn on the
clippy::shadow_unrelated
lint and try to cycle between the three lints in the following code:Without these changes you should have inconsistent behaviour depending on where your cursor is (A/B/C/D) when you run
RustLsp renderDiagnostic
, sometimes going to the closest diagnostic after the current cursor position, and other times falling back to the first lint in the file (the bool_comparison one).With the changes you should always go to the closest diagnostic after the current cursor position, only wrapping around to the top when you are at the last lint or further.
(Note that there are two spaces between let and blah on the
C
line. This is to demonstrate the hash collisions, but you might need to disable autoformatting if you have that turned on so rustfmt doesn't switch it back to a single space.)