roslyn
roslyn copied to clipboard
Semantic snippets - `propg` and `propi` snippets
Abstracted a lot of logic for property generation. In theory, it now allows to generate any kind of auto property, even with different get accessor.
On top of new abstractions added 2 snippets:
propgis a replacement of an old snippet. It generates property likepublic int MyProperty { get; private set; }. The only thing I changed is that when this snippet is executed in interface, it doesn't generateprivate setaccessor, because it leads to compiler error. If a user executespropgsnippet in interface I am 99% sure he wants just agetaccessorpropiis a new snippet I invented "on the fly". Usage ofinitproperties has grown over years and afterrequiredmodifier from C# 11 I assume it would grow even more. I don't see valid reasons against addinginit-only property snippet then
Abstracted property snippet tests as well. There are now 11 basic cases and an ability to override any special case behaviour like it is done for propg inside an interface.
I got a bit carried away, so unfortunately the first commit is bit large and could be 100% splitted into smaller parts, sorry for that!