Typing and naming conventions in generated code

I'm using Rider with Unity. When I let Rider generate a variable local to a method, the generated code is not what I'd want or expect. An example is if I let Rider 'Introduce variable' upon flagging that repeated access of a built-in component is inefficient, it will generate something like:

var transform1 = transform;

I have my syntax style set to prefer explicit type in all cases (so 'var' immediately gets flagged with a hint) and I really don't want it to ever generate an autoincrementing variable name like that. Ideally I would like to set it up so that it'd generate something like:

Transform cachedTransform = transform;

How can I accomplish this in Rider?

1 comment
Comment actions Permalink

Hi gewl

If everything in your settings is set for "prefer explicit type", the "introduce variable" refactoring should suggest a choice.  

 

Could you please check and add your screenshots if it looks different? Also what Rider version do you use? 

Thanks! 

0

Please sign in to leave a comment.