In C#, when I type the word 'and' within a comment, it gets converted to '&&' when I press the space. Same for 'not' which gets converted to '!'. How can I prevent this.
I remember there was a setting in the old CodeRush to prevent template expansions in comments, but I cannot find anything similar in CodeRush for Roslyn.
I guess I could modify the template definition, but it seems to be correct. 'Transitional/Visual Basic/and' has
C#Context: ([InCodeBlock] && [CharLeftIsWhitespace]) && ![InPreprocessorDirective]
But it's still firing within comments.
Hi Robert,
I tried to reproduce this problem locally, but without success (see the attached video). It would be great if you can record a small video illustrating the problem. Also, please send us your settings from the %appdata%\CodeRush\Settings folder. It can be helpful to determine the cause of this problem.
I'm looking forward your reply.
Ok I played around some more. It's related to triple slash comments, but it also seems to be context sensitive too. Outside of methods it seems ok.
namespace ConsoleApplication2 { /// <summary> /// Works ok here. and not or /// </summary> class Program { /// <summary> /// Works ok here. and not or /// </summary> static void Main(string[] args) { /// Fails here. && ! || // but not here. and not or } } public class MyClass { public MyClass() { /// && ! || /// Definitely related to triple slash comments. // Ok here. and not or } } }
I've attached my settings.
Thank you for the additional information. I have reproduced this issue inside xml comments. We will fix this issue in our future builds.
As a workaround you can change the context to