issues with "prop" live template
VS 2022 17.7.6, R# 2023.2.1
I have issues when using ReSharper's Live Template named "prop" in Visual Studio 2022 in a C# project.
When Visual Studio is restarted with the "prop" template turned off in Resharper -> Tools -> Live Templates, everything is fine. After typing "prop" and pressing "Tab" the cursor enables me to type "string", then press "Tab" again and type "Name", then type "Enter" to finish and go to end of line. This is the default VS behavior I believe.
However, when Visual Studio is restarted with the "prop" Live Template turned on, strange things happen.
Below are screenshots from trying to use the "prop" template to create a property of type "string".
1) Finished typing the string "prop"
2) Pressed "Tab" after "prop". A template appears. The cursor jumps to the end of red "TYPE" and the word "TYPE" seems to be selected, because pressing any letteer will overwrite it. It's ok. One thing that is unclear to me is why the next word is gray "Type" instead of gray e.g. "Name" (because it should be a placeholder of variable name)
3) Finished typing the string "string" (the property type) inside red box. So far so good. The cursor is at the end of "string". At this point I should be able to press "Tab" and enter variable name. Notice that there is something strange, the Tab to accept
tooltip seems to suggest that pressing Tab will accept what appears on the screenshot to the right, i.e. → public TYPE Type
, which is exactly what happens..
4) Pressed "Tab". Instead of cursor jumping to the next field, the current red field becomes "TYPE" again. So my typing of "string" is undone. The cursor is at the end of "TYPE", but contrary to point 2), it seems not to be selected, because now typing any letter appends the letter after "TYPE" instead of overwriting. E.g. typing letter "s" results in "TYPEs".
There is no way out of it except pressing Esc a few times and deleting the line. As you can see, it is not possible to use the "prop" template.
However, things are different with e.g. the "propg" template. There are no issues with it. The "TYPE" with red outline appears after pressing "Tab" and when I fill it with e.g. "string" and press "Tab" again, I can type the variable name and press "Tab" again to finish.
I noticed difference in Template Explorer settings (visible on attached screenshot), the "propg" has "Imported Visual C# Snippets" comment while "prop" has no comment.
The current workaround for me is turning the "prop" template off in ReSharper and just using the default VS behavior. But if this template is problematic, other might be as well in the future. So I'd like to at least know what is happening and why I must turn the feature off.
Please sign in to leave a comment.
Hello bea mar , thank you for your question. We've already fixed this issue in ReSharper 2023.2.3. Does it help?
Yes, it seems to be working after update, thanks!
Thanks for the update, great to hear that!