@@ -36,9 +36,7 @@ public static ImmutableArray<LspDiagnostic> GetTaskListDiagnostics(RazorCodeDocu
36
36
37
37
foreach ( var token in taskListDescriptors )
38
38
{
39
- if ( i + token . Length + 2 > comment . EndCommentStar . SpanStart || // Enough room in the comment for the token and some content?
40
- ! Matches ( source , i , token ) || // Does the prefix match?
41
- char . IsLetter ( source [ i + token . Length + 1 ] ) ) // Is there something after the prefix, so we don't match "TODOLOL"
39
+ if ( ! CommentMatchesToken ( source , comment , i , token ) )
42
40
{
43
41
continue ;
44
42
}
@@ -61,8 +59,14 @@ public static ImmutableArray<LspDiagnostic> GetTaskListDiagnostics(RazorCodeDocu
61
59
return diagnostics . ToImmutable ( ) ;
62
60
}
63
61
64
- private static bool Matches ( SourceText source , int i , string token )
62
+ private static bool CommentMatchesToken ( SourceText source , RazorCommentBlockSyntax comment , int i , string token )
65
63
{
64
+ if ( i + token . Length + 2 > comment . EndCommentStar . SpanStart )
65
+ {
66
+ // Not enough room in the comment for the token and some content
67
+ return false ;
68
+ }
69
+
66
70
for ( var j = 0 ; j < token . Length ; j ++ )
67
71
{
68
72
if ( source . Length < i + j )
@@ -76,6 +80,12 @@ private static bool Matches(SourceText source, int i, string token)
76
80
}
77
81
}
78
82
83
+ if ( char . IsLetter ( source [ i + token . Length + 1 ] ) )
84
+ {
85
+ // The comment starts with the token, but the next character is a letter, which means it is something like "TODONT"
86
+ return false ;
87
+ }
88
+
79
89
return true ;
80
90
}
81
91
}
0 commit comments