File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -107,6 +107,15 @@ public static IncrementalValueProvider<StatusOptions> GetStatusOptions(this Incr
107107 => context . GetSponsorAdditionalFiles ( ) . Combine ( context . AnalyzerConfigOptionsProvider )
108108 . Select ( ( source , _ ) => new StatusOptions ( source . Left , source . Right . GlobalOptions ) ) ;
109109
110+ /// <summary>
111+ /// Gets the status options for use within a source generator, to avoid depending on
112+ /// analyzer runs. Used in combination with <see cref="DiagnosticsManager.GetOrSetStatus(StatusOptions)"/>.
113+ /// </summary>
114+ public static StatusOptions GetStatusOptions ( this GeneratorExecutionContext context )
115+ => new StatusOptions (
116+ context . AdditionalFiles . Where ( x => x . IsSponsorManifest ( context . AnalyzerConfigOptions ) || x . IsSponsorableAnalyzer ( context . AnalyzerConfigOptions ) ) . ToImmutableArray ( ) ,
117+ context . AnalyzerConfigOptions . GlobalOptions ) ;
118+
110119 static bool IsSponsorManifest ( this AdditionalText text , AnalyzerConfigOptionsProvider provider )
111120 => provider . GetOptions ( text ) . TryGetValue ( "build_metadata.SponsorManifest.ItemType" , out var itemType ) &&
112121 itemType == "SponsorManifest" &&
You can’t perform that action at this time.
0 commit comments