@@ -29,17 +29,19 @@ internal sealed class TaskListDiagnosticSource(Document document, IGlobalOptionS
29
29
30
30
private readonly IGlobalOptionService _globalOptions = globalOptions ;
31
31
32
- public override async Task < ImmutableArray < DiagnosticData > > GetDiagnosticsAsync (
33
- RequestContext context , CancellationToken cancellationToken )
32
+ public override Task < ImmutableArray < DiagnosticData > > GetDiagnosticsAsync ( RequestContext context , CancellationToken cancellationToken )
33
+ => GetTaskListItemsAsync ( this . Document , _globalOptions , cancellationToken ) ;
34
+
35
+ internal static async Task < ImmutableArray < DiagnosticData > > GetTaskListItemsAsync ( Document document , IGlobalOptionService globalOptions , CancellationToken cancellationToken )
34
36
{
35
- var service = this . Document . GetLanguageService < ITaskListService > ( ) ;
37
+ var service = document . GetLanguageService < ITaskListService > ( ) ;
36
38
if ( service == null )
37
39
return [ ] ;
38
40
39
- var options = _globalOptions . GetTaskListOptions ( ) ;
41
+ var options = globalOptions . GetTaskListOptions ( ) ;
40
42
var descriptors = GetAndCacheDescriptors ( options . Descriptors ) ;
41
43
42
- var items = await service . GetTaskListItemsAsync ( this . Document , descriptors , cancellationToken ) . ConfigureAwait ( false ) ;
44
+ var items = await service . GetTaskListItemsAsync ( document , descriptors , cancellationToken ) . ConfigureAwait ( false ) ;
43
45
if ( items . Length == 0 )
44
46
return [ ] ;
45
47
@@ -53,9 +55,9 @@ public override async Task<ImmutableArray<DiagnosticData>> GetDiagnosticsAsync(
53
55
warningLevel : 0 ,
54
56
customTags : s_todoCommentCustomTags ,
55
57
properties : GetProperties ( i . Priority ) ,
56
- projectId : this . Document . Project . Id ,
57
- language : this . Document . Project . Language ,
58
- location : new DiagnosticDataLocation ( i . Span , this . Document . Id , mappedFileSpan : i . MappedSpan ) ) ) ;
58
+ projectId : document . Project . Id ,
59
+ language : document . Project . Language ,
60
+ location : new DiagnosticDataLocation ( i . Span , document . Id , mappedFileSpan : i . MappedSpan ) ) ) ;
59
61
}
60
62
61
63
private static ImmutableDictionary < string , string ? > GetProperties ( TaskListItemPriority priority )
0 commit comments