Implemented interface member:
433 references to Count
Microsoft.CodeAnalysis (22)
Syntax\SyntaxNode.cs (2)
565return this.GetLeadingTrivia().Count > 0; 576return this.GetTrailingTrivia().Count > 0;
Syntax\SyntaxNodeOrToken.cs (2)
352public bool HasLeadingTrivia => this.GetLeadingTrivia().Count > 0; 376public bool HasTrailingTrivia => this.GetTrailingTrivia().Count > 0;
Syntax\SyntaxToken.cs (2)
194public bool HasLeadingTrivia => this.LeadingTrivia.Count > 0; 199public bool HasTrailingTrivia => this.TrailingTrivia.Count > 0;
Syntax\SyntaxTriviaList.cs (11)
122/// <paramref name="index" /> is less than 0.-or-<paramref name="index" /> is equal to or greater than <see cref="Count" />. </exception> 203return this[this.Count - 1]; 233for (int i = 0, n = this.Count; i < n; i++) 247for (int i = 0, n = this.Count; i < n; i++) 264return Insert(this.Count, trivia); 273return InsertRange(this.Count, trivia); 318var thisCount = this.Count; 365if (index < 0 || index >= this.Count) 382if (index >= 0 && index < this.Count) 413if (index >= 0 && index < this.Count) 492if (offset < 0 || count < 0 || this.Count < offset + count)
Syntax\SyntaxTriviaList.Enumerator.cs (1)
32_count = list.Count;
Syntax\SyntaxTriviaList.Reversed.cs (3)
35if (_list.Count == 0) 46if (_list.Count == 0) 89_count = list.Count;
Syntax\SyntaxTriviaListBuilder.cs (1)
107this.Add(list, 0, list.Count);
Microsoft.CodeAnalysis.CodeStyle (16)
src\Analyzers\Core\Analyzers\FileHeaders\AbstractFileHeaderHelper.cs (1)
49for (var i = firstNonWhitespaceTrivia; i < firstToken.LeadingTrivia.Count; i++)
src\Analyzers\Core\Analyzers\NewLines\MultipleBlankLines\AbstractMultipleBlankLinesDiagnosticAnalyzer.cs (2)
89for (var i = 0; i < leadingTrivia.Count; i++) 130if (index >= triviaList.Count)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (2)
704if (trivia.Count == 0) 738if (trivia.Count == 0)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTokenExtensions.cs (1)
118if (trivia.Count == 0)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (1)
520if (this.Token1.TrailingTrivia.Count > 0 &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\TriviaHelpers.cs (1)
16if (startIndex == 0 && endIndex == triviaList.Count)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\TriviaList.cs (1)
40if (_index == _list1.Count)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (1)
128for (var i = leadingTrivia.Count - 1; i >= 0; i--)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\AbstractDocumentationCommentService.cs (2)
169if (token.LeadingTrivia.Count > 0 || HasLeadingWhitespace(tokenText)) 177if (token.TrailingTrivia.Count > 0 || HasTrailingWhitespace(tokenText))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (4)
355if (resultNode.GetLeadingTrivia().Count == 0) 358if (previousToken.TrailingTrivia.Count == 0 && 366if (resultNode.GetTrailingTrivia().Count == 0) 369if (nextToken.LeadingTrivia.Count == 0 &&
Microsoft.CodeAnalysis.CodeStyle.Fixes (6)
src\Analyzers\Core\CodeFixes\FileHeaders\AbstractFileHeaderCodeFixProvider.cs (2)
117for (var i = 0; i < triviaList.Count; i++) 183for (var i = 0; i < leadingTrivia.Count; i++)
src\Analyzers\Core\CodeFixes\NewLines\MultipleBlankLines\AbstractMultipleBlankLinesCodeFixProvider.cs (3)
69while (currentStart < triviaList.Count) 83while (currentEnd < triviaList.Count && 138if (index >= triviaList.Count)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService.cs (1)
509if (trailing.Count >= 1 && isEndOfLineTrivia(trailing.Last()))
Microsoft.CodeAnalysis.CSharp (7)
Compiler\DocumentationCommentCompiler.IncludeElementExpander.cs (1)
622Debug.Assert(leadingTrivia.Count == 1);
Syntax\CSharpSyntaxRewriter.cs (1)
283var count = list.Count;
Syntax\SyntaxFactory.cs (1)
1623Debug.Assert(leadingTrivia.Count == 1);
Syntax\SyntaxNodeRemover.cs (1)
40if (result != null && residualTrivia.Count > 0)
Syntax\SyntaxNormalizer.cs (2)
1023ArrayBuilder<SyntaxTrivia> currentTriviaList = ArrayBuilder<SyntaxTrivia>.GetInstance(triviaList.Count); 1244if (trailing.Count > 0)
Syntax\SyntaxReplacer.cs (1)
508if (index >= 0 && index < list.Count)
Microsoft.CodeAnalysis.CSharp.CodeStyle (10)
src\Analyzers\CSharp\Analyzers\NewLines\ConstructorInitializerPlacement\ConstructorInitializerPlacementDiagnosticAnalyzer.cs (1)
79if (colonToken.TrailingTrivia.Count == 0)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\BlockSyntaxExtensions.cs (1)
88if (triviaIndex + 1 < parentToken.LeadingTrivia.Count)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.SingleLineRewriter.cs (2)
30else if (token.LeadingTrivia.Count > 0) 42if (token.TrailingTrivia.Count > 0)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTriviaListExtensions.cs (1)
34if (triviaList.Count == 0)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\CSharpTriviaFormatter.cs (1)
225Contract.ThrowIfFalse(multilineCommentTrivia.Count == 1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.Analyzer.cs (1)
94if (list.Count == 0)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaRewriter.cs (3)
85TriviaHelpers.CreateTriviaListFromTo(triviaList, index + 1, triviaList.Count - 1)); 116for (var i = 0; i < triviaList.Count; i++) 131return triviaList.Count - 1;
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (19)
src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (1)
376trailingTrivia.Take(trailingTrivia.Count - 1));
src\Analyzers\CSharp\CodeFixes\FixIncorrectConstraint\CSharpFixIncorrectConstraintCodeFixProvider.cs (1)
48if (trailingTrivia.Count == 0)
src\Analyzers\CSharp\CodeFixes\MisplacedUsingDirectives\MisplacedUsingDirectivesCodeFixProvider.cs (3)
338for (var i = 0; i < triviaList.Count; i++) 347if (index < triviaList.Count) 349yield return triviaList.TakeRange(index, triviaList.Count - 1);
src\Analyzers\CSharp\CodeFixes\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionCodeFixProvider.cs (1)
84if (lastIndex < triviaList.Count && triviaList[lastIndex].IsEndOfLine())
src\Analyzers\CSharp\CodeFixes\RemoveUnnecessaryNullableDirective\CSharpRemoveUnnecessaryNullableDirectiveCodeFixProvider.cs (2)
108if (index < leadingTrivia.Count && leadingTrivia[index].IsWhitespace()) 111return index < leadingTrivia.Count && leadingTrivia[index].IsEndOfLine();
src\Analyzers\CSharp\CodeFixes\TransposeRecordKeyword\CSharpTransposeRecordKeywordCodeFixProvider.cs (1)
62: remainingLeadingTrivia.Count;
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (4)
616for (int i = 0, n = token.LeadingTrivia.Count - 1; i < n; i++) 691if (lastLeadingCommentIndex + 1 < leadingTrivia.Count && 859var index = trivia.Count; 863return index == trivia.Count
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (1)
365leadingTrivia.Take(leadingTrivia.Count - 1).Concat(Whitespace(elementLeadingWhitespace[..^indentation.Length])));
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider_DocComments.cs (2)
133? leadingTrivia.Count - 1 134: leadingTrivia.Count;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\TypeDeclarationSyntaxExtensions.cs (1)
127for (var i = leadingTrivia.Count - 1; i >= 0; i--)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpRemoveUnnecessaryImportsService.Rewriter.cs (2)
174if (finalTrivia.Count > 0) 226if (finalTrivia.Count > 0)
Microsoft.CodeAnalysis.CSharp.Features (28)
CodeRefactorings\EnableNullable\EnableNullableCodeRefactoringProvider.cs (2)
192var insertionPoint = list.Count; 193for (var i = list.Count - 1; i >= 0; i--)
ConvertProgram\ConvertProgramTransform_ProgramMain.cs (3)
138triviaToMove = [.. triviaToMove.Take(triviaToMove.Count - 2)]; 140var commentsToPreserve = TriviaList(statement.GetLeadingTrivia().Skip(triviaToMove.Count)); 165while (commentIndex < leadingTrivia.Count && leadingTrivia[commentIndex].Kind() is SyntaxKind.EndOfLineTrivia)
DocumentationComments\CSharpDocumentationCommentSnippetService.cs (3)
297&& lastTextToken.TrailingTrivia.Count == 0 350&& firstTextToken.LeadingTrivia.Count == 1 353&& lastTextToken.TrailingTrivia.Count == 0;
DocumentationComments\DocCommentConverter.cs (1)
59if (commentLines.Count > 0)
src\Analyzers\CSharp\Analyzers\NewLines\ConstructorInitializerPlacement\ConstructorInitializerPlacementDiagnosticAnalyzer.cs (1)
79if (colonToken.TrailingTrivia.Count == 0)
src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (1)
376trailingTrivia.Take(trailingTrivia.Count - 1));
src\Analyzers\CSharp\CodeFixes\FixIncorrectConstraint\CSharpFixIncorrectConstraintCodeFixProvider.cs (1)
48if (trailingTrivia.Count == 0)
src\Analyzers\CSharp\CodeFixes\MisplacedUsingDirectives\MisplacedUsingDirectivesCodeFixProvider.cs (3)
338for (var i = 0; i < triviaList.Count; i++) 347if (index < triviaList.Count) 349yield return triviaList.TakeRange(index, triviaList.Count - 1);
src\Analyzers\CSharp\CodeFixes\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionCodeFixProvider.cs (1)
84if (lastIndex < triviaList.Count && triviaList[lastIndex].IsEndOfLine())
src\Analyzers\CSharp\CodeFixes\RemoveUnnecessaryNullableDirective\CSharpRemoveUnnecessaryNullableDirectiveCodeFixProvider.cs (2)
108if (index < leadingTrivia.Count && leadingTrivia[index].IsWhitespace()) 111return index < leadingTrivia.Count && leadingTrivia[index].IsEndOfLine();
src\Analyzers\CSharp\CodeFixes\TransposeRecordKeyword\CSharpTransposeRecordKeywordCodeFixProvider.cs (1)
62: remainingLeadingTrivia.Count;
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (4)
616for (int i = 0, n = token.LeadingTrivia.Count - 1; i < n; i++) 691if (lastLeadingCommentIndex + 1 < leadingTrivia.Count && 859var index = trivia.Count; 863return index == trivia.Count
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (1)
365leadingTrivia.Take(leadingTrivia.Count - 1).Concat(Whitespace(elementLeadingWhitespace[..^indentation.Length])));
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider_DocComments.cs (2)
133? leadingTrivia.Count - 1 134: leadingTrivia.Count;
Structure\CSharpStructureHelpers.cs (1)
167if (triviaList.Count > 0)
Structure\Providers\DisabledTextTriviaStructureProvider.cs (1)
89for (var i = index; i < triviaList.Count; i++)
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (174)
LexicalAndXml\LexicalTests.cs (23)
3618Assert.Equal(1, leading.Count); 3624Assert.Equal(1, trailing.Count); 3636Assert.Equal(1, leading.Count); 3642Assert.Equal(1, trailing.Count); 3657Assert.Equal(1, leading.Count); 3663Assert.Equal(1, trailing.Count); 3968Assert.Equal(3, token.LeadingTrivia.Count); 3991Assert.Equal(3, token.LeadingTrivia.Count); 4013Assert.Equal(4, token.LeadingTrivia.Count); 4046Assert.Equal(3, token.LeadingTrivia.Count); 4102Assert.Equal(3, token.LeadingTrivia.Count); 4120Assert.Equal(3, token.LeadingTrivia.Count); 4137Assert.Equal(4, token.LeadingTrivia.Count); 4171Assert.Equal(4, token.LeadingTrivia.Count); 4211Assert.Equal(4, token.LeadingTrivia.Count); 4275Assert.Equal(3, token.LeadingTrivia.Count); 4297Assert.Equal(3, token.LeadingTrivia.Count); 4320Assert.Equal(4, token.LeadingTrivia.Count); 4349Assert.Equal(3, token.LeadingTrivia.Count); 4380Assert.Equal(5, token.LeadingTrivia.Count); 4419Assert.Equal(7, token.LeadingTrivia.Count); 4475Assert.Equal(7, token.LeadingTrivia.Count); 4533Assert.Equal(7, token.LeadingTrivia.Count);
LexicalAndXml\SyntaxTokenParserTests.cs (1)
418Assert.Equal(expectedTrivia.Length, leadingTrivia.Count);
LexicalAndXml\XmlDocCommentTests.cs (78)
81Assert.Equal(1, leading.Count); 101Assert.Equal(1, leading.Count); 118Assert.Equal(3, leading.Count); 133Assert.Equal(1, leading.Count); 150Assert.Equal(1, leading.Count); 171Assert.Equal(1, leading.Count); 196Assert.Equal(2, leading.Count); // a new line follows the comment 218Assert.Equal(1, leading.Count); 241Assert.Equal(1, leading.Count); 264Assert.Equal(1, leading.Count); 291Assert.Equal(1, leading.Count); 319Assert.Equal(1, leading.Count); 343Assert.Equal(1, leading.Count); 368Assert.Equal(1, leading.Count); 394Assert.Equal(2, leading.Count); 421Assert.Equal(1, leading.Count); 448Assert.Equal(1, leading.Count); 476Assert.Equal(1, leading.Count); 505Assert.Equal(1, leading.Count); 535Assert.Equal(1, leading.Count); 564Assert.Equal(1, leading.Count); 594Assert.Equal(1, leading.Count); 625Assert.Equal(1, leading.Count); 648Assert.Equal(1, leading.Count); 670Assert.Equal(1, leading.Count); 692Assert.Equal(1, leading.Count); 714Assert.Equal(1, leading.Count); 736Assert.Equal(1, leading.Count); 756Assert.Equal(1, leading.Count); 790Assert.Equal(1, leading.Count); 823Assert.Equal(1, leading.Count); 854Assert.Equal(1, leading.Count); 882Assert.Equal(1, leading.Count); 907Assert.Equal(1, leading.Count); 933Assert.Equal(1, leading.Count); 958Assert.Equal(1, leading.Count); 985Assert.Equal(1, leading.Count); 1016Assert.Equal(1, leading.Count); 1044Assert.Equal(1, leading.Count); 1069Assert.Equal(1, leading.Count); 1094Assert.Equal(1, leading.Count); 1121Assert.Equal(1, leading.Count); 1154Assert.Equal(1, leading.Count); 1185Assert.Equal(1, leading.Count); 1211Assert.Equal(1, leading.Count); 1238Assert.Equal(1, leading.Count); 1266Assert.Equal(1, leading.Count); 1295Assert.Equal(1, leading.Count); 1311Assert.Equal(1, leading.Count); 1335Assert.Equal(1, leading.Count); 1360Assert.Equal(1, leading.Count); 1384Assert.Equal(1, leading.Count); 1409Assert.Equal(1, leading.Count); 1433Assert.Equal(1, leading.Count); 1458Assert.Equal(1, leading.Count); 1482Assert.Equal(1, leading.Count); 1562Assert.Equal(1, leading.Count); 1590Assert.Equal(1, leading.Count); 1618Assert.Equal(1, leading.Count); 1644Assert.Equal(1, leading.Count); 1715Assert.Equal(5, trivias.Count); 1754Assert.Equal(4, trivias.Count); 1796Assert.Equal(4, trivias.Count); 1839Assert.Equal(2, trivias.Count); 1874Assert.Equal(2, trivias.Count); 1909Assert.Equal(2, trivias.Count); 1944Assert.Equal(2, trivias.Count); 1981Assert.Equal(1, trivias.Count); 2017Assert.Equal(1, trivias.Count); 2054Assert.Equal(2, trivias.Count); 2087Assert.Equal(1, trivias.Count); 2120Assert.Equal(1, trivias.Count); 2152Assert.Equal(3, trivias.Count); 2182Assert.Equal(3, trivias.Count); 2213Assert.Equal(1, trivias.Count); 2261Assert.Equal(1, trivias.Count); 2289Assert.Equal(1, topTrivias.Count); 2366Assert.Equal(1, trivias.Count);
Parsing\ParsingErrorRecoveryTests.cs (1)
7921Assert.Equal(numTokens, eofToken.LeadingTrivia.Count); // Confirm that we built a list.
Parsing\StatementParsingTests.cs (1)
1962Assert.Equal(1, fs.ForEachKeyword.TrailingTrivia.Count);
Syntax\SeparatedSyntaxListTests.cs (1)
321Assert.Equal(1, newList.GetSeparator(1).GetLeadingTrivia().Count);
Syntax\StructuredTriviaTests.cs (1)
194Assert.Equal(1, trivia.Count);
Syntax\SyntaxNodeTests.cs (31)
1488Assert.Equal(2, leadingTriviaWithDuplicate.Count); 1952Assert.Equal(2, someNode.Identifier.TrailingTrivia.Count); 1989Assert.Equal(2, someNode.Identifier.TrailingTrivia.Count); 2416Assert.Equal(2, leadingTrivia.Count); 2438Assert.Equal(2, leadingTrivia.Count); 3533Assert.Equal(1, node.GetLeadingTrivia().Count); 3544Assert.Equal(1, node.GetLeadingTrivia().Count); 3753Assert.Equal(1, idToken.LeadingTrivia.Count); 3756Assert.Equal(1, idToken.TrailingTrivia.Count); 3762Assert.Equal(0, idToken.LeadingTrivia.Count); 3764Assert.Equal(0, idToken.TrailingTrivia.Count); 3769Assert.Equal(1, idToken.LeadingTrivia.Count); 3772Assert.Equal(1, idToken.TrailingTrivia.Count); 3778Assert.Equal(1, namedNode.GetLeadingTrivia().Count); 3781Assert.Equal(1, namedNode.GetTrailingTrivia().Count); 3787Assert.Equal(0, namedNode.GetLeadingTrivia().Count); 3789Assert.Equal(0, namedNode.GetTrailingTrivia().Count); 3794Assert.Equal(1, namedNode.GetLeadingTrivia().Count); 3797Assert.Equal(1, namedNode.GetTrailingTrivia().Count); 3803Assert.Equal(1, nodeOrToken.GetLeadingTrivia().Count); 3806Assert.Equal(1, nodeOrToken.GetTrailingTrivia().Count); 3812Assert.Equal(1, nodeOrToken.GetLeadingTrivia().Count); 3815Assert.Equal(1, nodeOrToken.GetTrailingTrivia().Count); 3821Assert.Equal(0, nodeOrToken.GetLeadingTrivia().Count); 3823Assert.Equal(0, nodeOrToken.GetTrailingTrivia().Count); 3828Assert.Equal(0, nodeOrToken.GetLeadingTrivia().Count); 3830Assert.Equal(0, nodeOrToken.GetTrailingTrivia().Count); 3835Assert.Equal(1, nodeOrToken.GetLeadingTrivia().Count); 3838Assert.Equal(1, nodeOrToken.GetTrailingTrivia().Count); 3844Assert.Equal(1, nodeOrToken.GetLeadingTrivia().Count); 3847Assert.Equal(1, nodeOrToken.GetTrailingTrivia().Count);
Syntax\SyntaxRewriterTests.cs (2)
468Assert.Equal(2, leadingTrivia.Count); 495Assert.Equal(2, leadingTrivia.Count);
Syntax\SyntaxTriviaListTests.cs (35)
55Assert.Equal(3, list.Count); 73Assert.Equal(4, newList.Count); 77Assert.Equal(5, newList.Count); 81Assert.Equal(4, newList.Count); 85Assert.Equal(4, newList.Count); 89Assert.Equal(4, newList.Count); 93Assert.Equal(4, newList.Count); 97Assert.Equal(5, newList.Count); 101Assert.Equal(5, newList.Count); 105Assert.Equal(5, newList.Count); 109Assert.Equal(5, newList.Count); 113Assert.Equal(2, newList.Count); 116newList = list.RemoveAt(list.Count - 1); 117Assert.Equal(2, newList.Count); 121Assert.Equal(2, newList.Count); 125Assert.Equal(2, newList.Count); 129Assert.Equal(2, newList.Count); 133Assert.Equal(3, newList.Count); 137Assert.Equal(3, newList.Count); 141Assert.Equal(3, newList.Count); 145Assert.Equal(4, newList.Count); 149Assert.Equal(4, newList.Count); 153Assert.Equal(4, newList.Count); 157Assert.Equal(2, newList.Count); 161Assert.Equal(2, newList.Count); 165Assert.Equal(2, newList.Count); 170Assert.Throws<ArgumentOutOfRangeException>(() => list.Insert(list.Count + 1, triviaD)); 172Assert.Throws<ArgumentOutOfRangeException>(() => list.InsertRange(list.Count + 1, new[] { triviaD })); 174Assert.Throws<ArgumentOutOfRangeException>(() => list.RemoveAt(list.Count)); 191Assert.Equal(0, list.Count); 197Assert.Equal(1, newList.Count); 201Assert.Equal(2, newList.Count); 205Assert.Equal(1, newList.Count); 209Assert.Equal(2, newList.Count); 213Assert.Equal(0, newList.Count);
Microsoft.CodeAnalysis.CSharp.Workspaces (16)
Classification\Worker.cs (1)
158if (list.Count == 0)
CodeGeneration\CSharpSyntaxGenerator.cs (3)
3537for (var i = 0; i < triviaList.Count; i++) 3546if (index < triviaList.Count) 3548yield return triviaList.TakeRange(index, triviaList.Count - 1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\BlockSyntaxExtensions.cs (1)
88if (triviaIndex + 1 < parentToken.LeadingTrivia.Count)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.SingleLineRewriter.cs (2)
30else if (token.LeadingTrivia.Count > 0) 42if (token.TrailingTrivia.Count > 0)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTriviaListExtensions.cs (1)
34if (triviaList.Count == 0)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\CSharpTriviaFormatter.cs (1)
225Contract.ThrowIfFalse(multilineCommentTrivia.Count == 1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.Analyzer.cs (1)
94if (list.Count == 0)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaRewriter.cs (3)
85TriviaHelpers.CreateTriviaListFromTo(triviaList, index + 1, triviaList.Count - 1)); 116for (var i = 0; i < triviaList.Count; i++) 131return triviaList.Count - 1;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\TypeDeclarationSyntaxExtensions.cs (1)
127for (var i = leadingTrivia.Count - 1; i >= 0; i--)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpRemoveUnnecessaryImportsService.Rewriter.cs (2)
174if (finalTrivia.Count > 0) 226if (finalTrivia.Count > 0)
Microsoft.CodeAnalysis.Features (8)
src\Analyzers\Core\Analyzers\FileHeaders\AbstractFileHeaderHelper.cs (1)
49for (var i = firstNonWhitespaceTrivia; i < firstToken.LeadingTrivia.Count; i++)
src\Analyzers\Core\Analyzers\NewLines\MultipleBlankLines\AbstractMultipleBlankLinesDiagnosticAnalyzer.cs (2)
89for (var i = 0; i < leadingTrivia.Count; i++) 130if (index >= triviaList.Count)
src\Analyzers\Core\CodeFixes\FileHeaders\AbstractFileHeaderCodeFixProvider.cs (2)
117for (var i = 0; i < triviaList.Count; i++) 183for (var i = 0; i < leadingTrivia.Count; i++)
src\Analyzers\Core\CodeFixes\NewLines\MultipleBlankLines\AbstractMultipleBlankLinesCodeFixProvider.cs (3)
69while (currentStart < triviaList.Count) 83while (currentEnd < triviaList.Count && 138if (index >= triviaList.Count)
Microsoft.CodeAnalysis.UnitTests (2)
CommonSyntaxTests.cs (2)
114Assert.Equal(2, csharpTriviaList.Count); 151Assert.Equal(2, vbTriviaList.Count);
Microsoft.CodeAnalysis.VisualBasic (4)
Syntax\SyntaxNodeRemover.vb (1)
23If residualTrivia.Count > 0 Then
Syntax\SyntaxNormalizer.vb (1)
167If newToken.TrailingTrivia.Count = 0 AndAlso IsNewLineChar(newToken.ValueText.Last) Then
Syntax\SyntaxReplacer.vb (1)
390If index >= 0 AndAlso index < list.Count Then
Syntax\VisualBasicSyntaxRewriter.vb (1)
191Dim count = list.Count
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (8)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SingleLineRewriter.vb (2)
23ElseIf token.LeadingTrivia.Count > 0 Then 31If token.TrailingTrivia.Count > 0 Then
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxTreeExtensions.vb (1)
23If trailing.Count = 1 Then
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Helpers\RemoveUnnecessaryImports\VisualBasicRemoveUnnecessaryImportsRewriter.vb (1)
126If remainingTrivia.Count > 0 Then
src\Workspaces\VisualBasic\Portable\Formatting\Engine\Trivia\TriviaDataFactory.Analyzer.vb (1)
35If list.Count = 0 Then
src\Workspaces\VisualBasic\Portable\Formatting\Engine\Trivia\TriviaDataFactory.TriviaRewriter.vb (2)
97For i As Integer = 0 To triviaList.Count - 1 105Return triviaList.Count - 1
src\Workspaces\VisualBasic\Portable\Formatting\Engine\Trivia\VisualBasicTriviaFormatter.vb (1)
296Contract.ThrowIfFalse(singlelineDocCommentTrivia.Count = 1)
Microsoft.CodeAnalysis.VisualBasic.Features (4)
CodeFixes\Suppression\VisualBasicSuppressionCodeFixProvider.vb (1)
134Dim lastTrivia = If(trailingTrivia.IsEmpty, Nothing, trailingTrivia(trailingTrivia.Count - 1))
DocumentationComments\VisualBasicDocumentationCommentSnippetService.vb (2)
176firstTextToken.LeadingTrivia.Count = 1 AndAlso 179lastTextToken.TrailingTrivia.Count = 0
Structure\VisualBasicStructureHelpers.vb (1)
48If triviaList.Count > 0 Then
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (76)
Parser\ParseDirectives.vb (2)
2413Assert.True(tt.Count = 4) 2506Assert.True(tt.Count = 4)
Parser\ParseStatements.vb (2)
2276Assert.Equal(3, leading.Count) 2282Assert.Equal(2, trailing.Count)
Scanner\ScannerTests.vb (5)
816Assert.Equal(3, tk.LeadingTrivia.Count) 825Assert.Equal(3, tk.LeadingTrivia.Count) 834Assert.Equal(3, tk.LeadingTrivia.Count) 847Assert.Equal(3, tk.LeadingTrivia.Count) 856Assert.Equal(5, tk.LeadingTrivia.Count)
Syntax\ManualTests.vb (2)
107Assert.Equal(1, node.GetLeadingTrivia().Count) 117Assert.Equal(1, node.GetLeadingTrivia().Count)
Syntax\SyntaxTokenFactoryTests.vb (33)
21Assert.Equal(keywordToken.LeadingTrivia.Count, 1) 22Assert.Equal(keywordToken.TrailingTrivia.Count, 1) 26Assert.Equal(keywordToken.LeadingTrivia.Count, 1) 27Assert.Equal(keywordToken.TrailingTrivia.Count, 1) 31Assert.Equal(keywordToken.LeadingTrivia.Count, 1) 32Assert.Equal(keywordToken.TrailingTrivia.Count, 1) 35Assert.Equal(keywordToken.LeadingTrivia.Count, 1) 36Assert.Equal(keywordToken.TrailingTrivia.Count, 1) 39Assert.Equal(keywordToken.LeadingTrivia.Count, 1) 40Assert.Equal(keywordToken.TrailingTrivia.Count, 1) 45Assert.Equal(keywordToken.LeadingTrivia.Count, 1) 46Assert.Equal(keywordToken.TrailingTrivia.Count, 1) 50Assert.Equal(keywordToken.LeadingTrivia.Count, 1) 51Assert.Equal(keywordToken.TrailingTrivia.Count, 1) 55Assert.Equal(keywordToken.LeadingTrivia.Count, 1) 56Assert.Equal(keywordToken.TrailingTrivia.Count, 1) 65Assert.Equal(punctuationToken.LeadingTrivia.Count, 1) 66Assert.Equal(punctuationToken.TrailingTrivia.Count, 1) 70Assert.Equal(punctuationToken.LeadingTrivia.Count, 1) 71Assert.Equal(punctuationToken.TrailingTrivia.Count, 1) 75Assert.Equal(punctuationToken.LeadingTrivia.Count, 1) 76Assert.Equal(punctuationToken.TrailingTrivia.Count, 1) 79Assert.Equal(punctuationToken.LeadingTrivia.Count, 1) 80Assert.Equal(punctuationToken.TrailingTrivia.Count, 1) 83Assert.Equal(punctuationToken.LeadingTrivia.Count, 1) 84Assert.Equal(punctuationToken.TrailingTrivia.Count, 1) 89Assert.Equal(punctuationToken.LeadingTrivia.Count, 1) 90Assert.Equal(punctuationToken.TrailingTrivia.Count, 1) 94Assert.Equal(punctuationToken.LeadingTrivia.Count, 1) 95Assert.Equal(punctuationToken.TrailingTrivia.Count, 1) 99Assert.Equal(punctuationToken.LeadingTrivia.Count, 1) 100Assert.Equal(punctuationToken.TrailingTrivia.Count, 1) 171Assert.Equal(1, id.TrailingTrivia.Count)
TestSyntaxNodes.vb (32)
307If list.Count > 0 Then 310Assert.Equal(expectedFullSpan.End, list(list.Count - 1).FullSpan.End) 312For i = 0 To list.Count - 2 333If precedingTrivia.Count = 0 Then 339If followingTrivia.Count = 0 Then 358If precedingTrivia.Count = 0 Then 364If followingTrivia.Count = 0 Then 682Assert.Equal(1, precTrivia.Count) 684Assert.Equal(1, follTrivia.Count) 698Assert.Equal(0, precTrivia.Count) 700Assert.Equal(2, follTrivia.Count) 736Assert.Equal(3, precTrivia.Count) 757Assert.Equal(1, follTrivia.Count) 773Assert.Equal(1, keyword.LeadingTrivia().Count) 774Assert.Equal(1, keyword.TrailingTrivia().Count) 785Assert.Equal(2, keyword.LeadingTrivia().Count) 787Assert.Equal(0, keyword.TrailingTrivia().Count) 794Assert.Equal(0, keyword.LeadingTrivia().Count) 795Assert.Equal(1, keyword.TrailingTrivia().Count) 805Assert.Equal(2, keyword.LeadingTrivia().Count) 806Assert.Equal(1, keyword.TrailingTrivia().Count) 822Assert.Equal(1, endTry.GetTrailingTrivia().Count) 1593Assert.Equal(2, trivia.Count) 1614Assert.Equal(2, trivia.Count) 1631Assert.True(trivia.Count = 1) 1638Assert.True(trivia.Count = 1) 1645Assert.True(trivia.Count = 2) 1653Assert.True(trivia.Count = 2) 1661Assert.True(trivia.Count = 2) 1669Assert.True(trivia.Count = 2) 1736Assert.Equal(0, tree.GetRoot().FindToken(node.FullSpan.Length - 1).TrailingTrivia.Count) 1737Assert.Equal(1, tree.GetRoot().FindToken(0).LeadingTrivia.Count)
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (3)
ParserTestUtilities.vb (3)
346Assert.InRange(trivia.Count, 1, 2) 348If trivia.Count = 1 Then 350ElseIf trivia.Count = 2 Then
Microsoft.CodeAnalysis.VisualBasic.Workspaces (16)
CodeCleanup\Providers\AbstractTokensCodeCleanupProvider.vb (4)
81Dim leading = If(token.LeadingTrivia.Count > 0, token.LeadingTrivia, SyntaxTriviaList.Create(SyntaxFactory.ElasticMarker)) 82Dim trailing = If(token.TrailingTrivia.Count > 0, token.TrailingTrivia, SyntaxTriviaList.Create(SyntaxFactory.ElasticMarker)) 92Dim leading = If(token.LeadingTrivia.Count > 0, token.LeadingTrivia, SyntaxTriviaList.Create(SyntaxFactory.ElasticMarker)) 93Dim trailing = If(token.TrailingTrivia.Count > 0, token.TrailingTrivia, SyntaxTriviaList.Create(SyntaxFactory.ElasticMarker))
CodeCleanup\Providers\AddMissingTokensCodeCleanupProvider.vb (2)
229If Not node.DescendantTokens().Any(Function(token) token = previousToken) AndAlso prevTrailingTrivia.Count > 0 Then 365If lastToken.TrailingTrivia.Count = 0 Then
CodeCleanup\Providers\ReduceTokensCodeCleanupProvider.vb (2)
296Dim leading = If(token.LeadingTrivia.Count > 0, token.LeadingTrivia, SyntaxTriviaList.Create(SyntaxFactory.ElasticMarker)) 297Dim trailing = If(token.TrailingTrivia.Count > 0, token.TrailingTrivia, SyntaxTriviaList.Create(SyntaxFactory.ElasticMarker))
Formatting\Engine\Trivia\TriviaDataFactory.Analyzer.vb (1)
35If list.Count = 0 Then
Formatting\Engine\Trivia\TriviaDataFactory.TriviaRewriter.vb (2)
97For i As Integer = 0 To triviaList.Count - 1 105Return triviaList.Count - 1
Formatting\Engine\Trivia\VisualBasicTriviaFormatter.vb (1)
296Contract.ThrowIfFalse(singlelineDocCommentTrivia.Count = 1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SingleLineRewriter.vb (2)
23ElseIf token.LeadingTrivia.Count > 0 Then 31If token.TrailingTrivia.Count > 0 Then
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxTreeExtensions.vb (1)
23If trailing.Count = 1 Then
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Helpers\RemoveUnnecessaryImports\VisualBasicRemoveUnnecessaryImportsRewriter.vb (1)
126If remainingTrivia.Count > 0 Then
Microsoft.CodeAnalysis.Workspaces (14)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (2)
704if (trivia.Count == 0) 738if (trivia.Count == 0)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTokenExtensions.cs (1)
118if (trivia.Count == 0)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (1)
520if (this.Token1.TrailingTrivia.Count > 0 &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\TriviaHelpers.cs (1)
16if (startIndex == 0 && endIndex == triviaList.Count)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\TriviaList.cs (1)
40if (_index == _list1.Count)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (1)
128for (var i = leadingTrivia.Count - 1; i >= 0; i--)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\AbstractDocumentationCommentService.cs (2)
169if (token.LeadingTrivia.Count > 0 || HasLeadingWhitespace(tokenText)) 177if (token.TrailingTrivia.Count > 0 || HasTrailingWhitespace(tokenText))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (4)
355if (resultNode.GetLeadingTrivia().Count == 0) 358if (previousToken.TrailingTrivia.Count == 0 && 366if (resultNode.GetTrailingTrivia().Count == 0) 369if (nextToken.LeadingTrivia.Count == 0 &&
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService.cs (1)
509if (trailing.Count >= 1 && isEndOfLineTrivia(trailing.Last()))