Identifying something with an attribute with IIncrementalSourceGenerator
I am currently using
ForAttributeWithMetadataName
. According to the documentation, it has a chance of generating false positives. What I am currently doing is checking the identifier and seeing if it matches the attribute name. This doesn't work in the case where an alias is used, however. Is there a consisstent way to detect an attribute?2 Replies
I'm not sure what you mean by generating false positives
This index is cheap to maintain and, importantly, can only have false positives, not false negatives.This is not referring to what's called back in
transform
. It's referring to the cache that avoids needing to do semantic work on 99% of compilations
You don't need to do work to avoid false positivesperfect
thanks!