NeVeSpl / NTypewriter

File/code generator using Scriban text templates populated with C# code metadata from Roslyn API.
https://nevespl.github.io/NTypewriter/
MIT License
122 stars 25 forks source link

Request - Property internal set vs public flag or filter #113

Closed jons-bakerhill closed 6 months ago

jons-bakerhill commented 6 months ago

Is there an equivalent to Symbols.ThatArePublic that could be used to check if a property has a public vs internal or private setter? I didn't see anything on https://github.com/NeVeSpl/NTypewriter/blob/master/NTypewriter.CodeModel/ISymbolBase.cs

NeVeSpl commented 6 months ago

I assume that IPropertySymbol.IsReadOnly is not what you need? I do not know how that happened, but only minimal info about properties is exposed, and even unit tests are missing for what is already exposed. These shortcomings will definitely need to be corrected.

jons-bakerhill commented 6 months ago

Even when setting the setter to private IsReadOnly is still false and ThatArePublic still includes it. E.g. public Guid? ForeignId { get; private set; }

NeVeSpl commented 6 months ago

The next release will contain IProperty.GetMethod, IProperty.SetMethod and all access modifiers available on ISymbolBase.