Rider changes variable types violating codestyle
I am working on a codebase which has the convention of using CLR types over the keywords (so "String" instead of "string" etc..). When performing refactoring options with Rider it changes types to keywords. It is quite a hassle to keep fixing these after every refactor.
I tried to fix that by setting up the codestyle so it recognizes the CLR preference, which works as it underlines when it does not match.
However refactor options (like adding an additional parameter to a method) still changes everything to the non-CLR types (which then get flagged as inconsistent)
Is there a way to avoid this behaviour?
Please sign in to leave a comment.
Hello Michel,
Thank you for contacting Rider support.
Would you mind checking if you setting the following two options help?
If it doesn't help, would you mind describing the problematic scenario in more detail? (adding an additional parameter to a method)
Have a nice day!
Sorry for the very long delay, I got distracted :(
These options are set although it looks a bit different because it is set from a .editorconfig file.
As for an example I made this method calling the not yet existing "SomeMethod".
When I then choose the option to generate a local function and start using Tab to navigate through the fields e.g. to rename the generated "b" it replaces the generated "Byte" by the proposed "byte". So it seems to generate correctly, but when trying to navigate it proposes the wrong type which replaces the existing correct Byte.
And more another confusing scenario. After generating SomeMethod I have:
When I click on SomeMethod and select the `Refactor >> Change Signature...` option it shows the window below.
Note that it shows the type of b as "byte" in the parameters list and the preview. This is super confusing, since in the end when pressing Next it does seem to generate b as "Byte" (also when adding additional parameters). So while it generates according to settings it is showing something different which is inconsistent.
Thank you for the details shared. I reproduced these issues and reported it to our tracker:
- https://youtrack.jetbrains.com/issue/RSRP-491608
- https://youtrack.jetbrains.com/issue/RSRP-491607
We would appreciate it if you could upvote these issues to demonstrate your interest.
Should you have any other questions or difficulties, please let us know.
Have a nice day!
Thanks for submitting the issues. I upvoted them