Hi,
I am not exactly sure what should and what should not work in Roslyn, what is planned and what not.
I will report issues I have (compared to classic CodeRush) and you can sort it out.
When I invoke XPO template, for instance xpo and tab, object property template is expanded, but type between field and property is not linked.
So, when I change actual type of property, field remains original type created when template was expanded. See image attached.
In classic CodeRush this worked and was very convenient when I needed to change type.
Can this be implemented in Roslyn version as well?
Thanks,
Mario
Forgot the attachment
Hi Mario,
Thank you for your report. I have reproduced this behavior locally. We will research it and fix it in our future releases.
Hi Mario,
We have fixed this issue and the fix will be available in the 16.1.6 release.
Now the xpo template will not contain links to types because the o character points to the object type. Refer to the image below to see all predefined types (for example, xpi will be expanded with the int type):
For custom types, we have added a new "xp. " template and now the type will be linked as you wanted.
Hi,
Thank for the update.
I am not sure if I understand correctly. CodeRush classic had type links regardless of which template was used.
This was rather useful when I wanted to change the type, so both property and field were updated in the same time.
I used that feature frequently.
If I understood correctly, this links will not be available any more?
Regards,
Mario
Hi,
Not exactly so.
Starting from 16.1.6, CodeRush for Roslyn will have two "xp" templates.
One of them will be expanded with a dynamic type, whose mnemonics you typed after "xp":
xpo - object
xpi - int
etc.
In this case, types are already chosen and links will not be created.
As for "xp. ", it will be expanded with linked types and you will be able to change this type as you did this in CodeRush Classic. We already have this behavior for a property generating template (po, pi, ps, etc. and p. ). So, we have changed the xp template so that it has the same behavior.
Hi,
Yes I understand, but I think types should be always linked - as they were in classic CodeRush.
Quite often I had situation where I chose specific type - for instance xpi, but then realized it has to be decimal or in many situations I changed type to nullable and so on.
This was very convenient in classic CR especially because links were kept so I could change type quickly for both property and field at the same time.
So, new xp template link is nice, but having them on type-specific templates would also be great (actually, was great in classic CR).
BTW, I REALLY like the speed and lightwightness of Roslyn version and the fact it is now extension which makes updates much more convenient - keep up the good job.
Regards,
Mario
We have changed the default behavior because links were not always closed after the expansion. Alive links accumulated and could cause some side-effects.
Still you can easily change this behavior. After you install version 16.1.6, follow these steps:
Editor\Code Templates
«:#PersistentPropertyReadWrite#»
to
«:#PersistentPropertyReadWrite#(SelectPropertyType=true)»
These changes will work in releases starting with 16.1.6, which will be published in the near future. However, if you want to try it out right now, we can send you a daily-build.
Also, let me thank you for your positive feedback about our new product. It would be great if you can share it in the Visual Studio Gallery.
Hi,
Thanks for explanation.
I will see how new behavior works for me with new xp template and then decide.
No need for daily build, I am ok waiting for the release.
Regards,
Mario
OK, we will be looking forward to your feedback on v16.1.6.