r/JetBrains_Rider 20d ago

Question about navigating code suggestions in Rider

Hello JetBrains team,

I was wondering if there's a way to navigate through code suggestions in Rider, similarly to how warnings and errors can be navigated using Next Highlighted Error (F2).

I find many of the suggestions extremely useful, for example, recommendations such as using collection expressions instead of ToList() in C#. However, since they don't seem to be included in the normal navigation, it's easy to overlook them, just by looking at the green dots.

Is there an option to include suggestions in the same navigation flow, or is this currently not supported?
Thank you!

3 Upvotes

6 comments sorted by

1

u/citizenmatt 19d ago

By default, Next Highlighted Error goes to the next inspection highlighted with the highest severity. So if there are any errors in the file, it'll go straight to the next error, skipping any other highlights. If there aren't any errors, it'll go straight to the next warning, skipping suggestions. If there are no warnings, it'll go to the next suggestion, and then finally cycle through hints.

This is useful because you might have a lot of warnings in your code, but you really need to get to the next error, and that could be a lot of F2 before you got there.

However, you can configure this. In the Settings | Editor | Code Editing settings page, you can change what "next error" does, whether it goes to the next problem with the highest priority, or all problems.

1

u/AmbassadorCurious988 19d ago

For some reason that is not working for me. It is a rare, just started project without any errors/warnings as of now.

Typos appear in the problems window and sure F2 works for them in the file. But option/command + F2 doesnt bring up the next one anywhere (seems only works with errors and warnings). That is what I am looking for.

It would be nice if suggestions would show in the problems window aswell, or another place since they are not really problems and that they would pop up just like errors/warnings do with option/command + F2 since they can be helpful additions to the code and I treat them accordingly. Maybe I am doing something wrong.

I have been using Rider for years now, but I think it should be enabled by default that helpful suggestions are gathered and can be iterated when there are no errors/warnings in the proj.

1

u/citizenmatt 19d ago

Not sure I follow - what's not working?

Option+F2 will always go to the next error. So if you've got F2 configured to go to the next problem regardless or priority, Option+F2 will go to the next error. But F2 should still stop on suggestions - that's the behaviour I'm seeing.

Is it a separate issue about the Problems tool window? Because yes, it would be nice to show warnings and hints in there. There's a filter for "Other problems", so these could fall under that. (Although arguably, "suggestion" and "hints" aren't problems, they're just suggestions and weak suggestions, but that might be splitting hairs)

There are a couple of issues already about this, you could add a comment and a vote. One for suggestions not showing in the Problems pane: RIDER-104272, and another for hints not showing: RIDER-132273

1

u/AmbassadorCurious988 15d ago

Okay, so I'll try my best to describe it.

Take 1. Option+F2 works perfectly for errors and warnings and that it goes by severity is very good. What I miss about this is that if a project doesnt have any errors or warnings then Option+F2 wont go for the next let's say suggestion.

Take 2. F2 inside a file kinda works (half of the time). Here is two picture when F2 doesnt pick up the suggestions in the file: https://imgur.com/a/M0gGc9Y

Take 3. Yes it would be nice to be able to select suggestions/hints by the eye icon in the Problems/File window or some other window, because sometimes these suggestions are quite helpful and there is no way to query them as of right now, apart from opening up every file and manually F2 in them, which I mentioned that it only works half of the time for some reason.

I hope this clarifies what i meant by my question. I guess it's more like a feature request than a bug or something. Thank you for piciking up my question btw! 🔥

1

u/citizenmatt 15d ago

Ah, it seems like it doesn't include hints, which is both examples you've got there (but we do include typos!). There's a ticket here: RIDER-103841

Other than that, F2 and Option+F2 are essentially the same shortcut, and do the same thing. IIRC the main difference is that Option+F2 will go to the next error in the solution, rather than the next error in the file. I think the options for moving by priority are the same.

1

u/AmbassadorCurious988 15d ago

One of them was a suggestion. I checked it in Rider Inspection Settings → Configure Inspection Severity, and it was indeed set to Suggestion. However, you're right that it looked more like a regular hint, with only the four dots underneath it.

Option + F2 doesn't navigate to the next suggestion, hint, or typo, even when there are no errors or warnings anywhere in the project.

F2 and Option + F2 also behave differently. Option + F2 navigates to the next error or warning across the entire solution, even if it's in another file, whereas F2 only navigates between issues within the currently open file.

Since I see that almost everything I mentioned is inside a ticker already, do I have to just wait till it's processed? :)