Implemented interface member:
666 references to Count
GenerateDocumentationAndConfigFiles (18)
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)
519if (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 (5)
12public int Count => _list1.Count + _list2.Count; 15=> index < _list1.Count ? _list1[index] : _list2[index - _list1.Count]; 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)
508if (trailing.Count >= 1 && isEndOfLineTrivia(trailing.Last()))
Metrics (17)
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)
519if (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 (5)
12public int Count => _list1.Count + _list2.Count; 15=> index < _list1.Count ? _list1[index] : _list2[index - _list1.Count]; 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 &&
Metrics.Legacy (17)
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)
519if (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 (5)
12public int Count => _list1.Count + _list2.Count; 15=> index < _list1.Count ? _list1[index] : _list2[index - _list1.Count]; 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 (22)
Syntax\SyntaxNode.cs (2)
566return this.GetLeadingTrivia().Count > 0; 577return this.GetTrailingTrivia().Count > 0;
Syntax\SyntaxNodeOrToken.cs (2)
353public bool HasLeadingTrivia => this.GetLeadingTrivia().Count > 0; 377public bool HasTrailingTrivia => this.GetTrailingTrivia().Count > 0;
Syntax\SyntaxToken.cs (2)
195public bool HasLeadingTrivia => this.LeadingTrivia.Count > 0; 200public bool HasTrailingTrivia => this.TrailingTrivia.Count > 0;
Syntax\SyntaxTriviaList.cs (11)
123/// <paramref name="index" /> is less than 0.-or-<paramref name="index" /> is equal to or greater than <see cref="Count" />. </exception> 204return this[this.Count - 1]; 234for (int i = 0, n = this.Count; i < n; i++) 248for (int i = 0, n = this.Count; i < n; i++) 265return Insert(this.Count, trivia); 274return InsertRange(this.Count, trivia); 319var thisCount = this.Count; 366if (index < 0 || index >= this.Count) 383if (index >= 0 && index < this.Count) 414if (index >= 0 && index < this.Count) 493if (offset < 0 || count < 0 || this.Count < offset + count)
Syntax\SyntaxTriviaList.Enumerator.cs (1)
32_count = list.Count;
Syntax\SyntaxTriviaList.Reversed.cs (3)
36if (_list.Count == 0) 47if (_list.Count == 0) 90_count = list.Count;
Syntax\SyntaxTriviaListBuilder.cs (1)
107this.Add(list, 0, list.Count);
Microsoft.CodeAnalysis.Analyzers (18)
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)
519if (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 (5)
12public int Count => _list1.Count + _list2.Count; 15=> index < _list1.Count ? _list1[index] : _list2[index - _list1.Count]; 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)
508if (trailing.Count >= 1 && isEndOfLineTrivia(trailing.Last()))
Microsoft.CodeAnalysis.AnalyzerUtilities (17)
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)
519if (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 (5)
12public int Count => _list1.Count + _list2.Count; 15=> index < _list1.Count ? _list1[index] : _list2[index - _list1.Count]; 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.BannedApiAnalyzers (18)
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)
519if (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 (5)
12public int Count => _list1.Count + _list2.Count; 15=> index < _list1.Count ? _list1[index] : _list2[index - _list1.Count]; 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)
508if (trailing.Count >= 1 && isEndOfLineTrivia(trailing.Last()))
Microsoft.CodeAnalysis.CodeStyle (20)
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)
88for (var i = 0; i < leadingTrivia.Count; i++) 129if (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)
519if (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 (5)
12public int Count => _list1.Count + _list2.Count; 15=> index < _list1.Count ? _list1[index] : _list2[index - _list1.Count]; 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)
116for (var i = 0; i < triviaList.Count; i++) 182for (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)
508if (trailing.Count >= 1 && isEndOfLineTrivia(trailing.Last()))
Microsoft.CodeAnalysis.CSharp (8)
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 (3)
124if (syntaxToken.LeadingTrivia.Count < 2) 1040ArrayBuilder<SyntaxTrivia> currentTriviaList = ArrayBuilder<SyntaxTrivia>.GetInstance(triviaList.Count); 1261if (trailing.Count > 0)
Syntax\SyntaxReplacer.cs (1)
553if (index >= 0 && index < list.Count)
Microsoft.CodeAnalysis.CSharp.CodeStyle (10)
src\Analyzers\CSharp\Analyzers\NewLines\ConstructorInitializerPlacement\ConstructorInitializerPlacementDiagnosticAnalyzer.cs (1)
78if (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)
224Contract.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)
84TriviaHelpers.CreateTriviaListFromTo(triviaList, index + 1, triviaList.Count - 1)); 115for (var i = 0; i < triviaList.Count; i++) 130return triviaList.Count - 1;
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (20)
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 (4)
337if (firstMemberTrivia.Count == 0) 351for (var i = 0; i < triviaList.Count; i++) 360if (index < triviaList.Count) 362yield return triviaList.TakeRange(index, triviaList.Count - 1);
src\Analyzers\CSharp\CodeFixes\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionCodeFixProvider.cs (1)
83if (lastIndex < triviaList.Count && triviaList[lastIndex].IsEndOfLine())
src\Analyzers\CSharp\CodeFixes\RemoveUnnecessaryNullableDirective\CSharpRemoveUnnecessaryNullableDirectiveCodeFixProvider.cs (2)
107if (index < leadingTrivia.Count && leadingTrivia[index].IsWhitespace()) 110return 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)
612for (int i = 0, n = token.LeadingTrivia.Count - 1; i < n; i++) 687if (lastLeadingCommentIndex + 1 < leadingTrivia.Count && 855var index = trivia.Count; 859return 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)
126for (var i = leadingTrivia.Count - 1; i >= 0; i--)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpRemoveUnnecessaryImportsService.Rewriter.cs (2)
173if (finalTrivia.Count > 0) 225if (finalTrivia.Count > 0)
Microsoft.CodeAnalysis.CSharp.Features (29)
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)
289&& lastTextToken.TrailingTrivia.Count == 0 342&& firstTextToken.LeadingTrivia.Count == 1 345&& lastTextToken.TrailingTrivia.Count == 0;
DocumentationComments\DocCommentConverter.cs (1)
59if (commentLines.Count > 0)
src\Analyzers\CSharp\Analyzers\NewLines\ConstructorInitializerPlacement\ConstructorInitializerPlacementDiagnosticAnalyzer.cs (1)
78if (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 (4)
337if (firstMemberTrivia.Count == 0) 351for (var i = 0; i < triviaList.Count; i++) 360if (index < triviaList.Count) 362yield return triviaList.TakeRange(index, triviaList.Count - 1);
src\Analyzers\CSharp\CodeFixes\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionCodeFixProvider.cs (1)
83if (lastIndex < triviaList.Count && triviaList[lastIndex].IsEndOfLine())
src\Analyzers\CSharp\CodeFixes\RemoveUnnecessaryNullableDirective\CSharpRemoveUnnecessaryNullableDirectiveCodeFixProvider.cs (2)
107if (index < leadingTrivia.Count && leadingTrivia[index].IsWhitespace()) 110return 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)
612for (int i = 0, n = token.LeadingTrivia.Count - 1; i < n; i++) 687if (lastLeadingCommentIndex + 1 < leadingTrivia.Count && 855var index = trivia.Count; 859return 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)
166if (triviaList.Count > 0)
Structure\Providers\DisabledTextTriviaStructureProvider.cs (1)
88for (var i = index; i < triviaList.Count; i++)
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (174)
LexicalAndXml\LexicalTests.cs (23)
3619Assert.Equal(1, leading.Count); 3625Assert.Equal(1, trailing.Count); 3637Assert.Equal(1, leading.Count); 3643Assert.Equal(1, trailing.Count); 3658Assert.Equal(1, leading.Count); 3664Assert.Equal(1, trailing.Count); 3969Assert.Equal(3, token.LeadingTrivia.Count); 3992Assert.Equal(3, token.LeadingTrivia.Count); 4014Assert.Equal(4, token.LeadingTrivia.Count); 4047Assert.Equal(3, token.LeadingTrivia.Count); 4103Assert.Equal(3, token.LeadingTrivia.Count); 4121Assert.Equal(3, token.LeadingTrivia.Count); 4138Assert.Equal(4, token.LeadingTrivia.Count); 4172Assert.Equal(4, token.LeadingTrivia.Count); 4212Assert.Equal(4, token.LeadingTrivia.Count); 4276Assert.Equal(3, token.LeadingTrivia.Count); 4298Assert.Equal(3, token.LeadingTrivia.Count); 4321Assert.Equal(4, token.LeadingTrivia.Count); 4350Assert.Equal(3, token.LeadingTrivia.Count); 4381Assert.Equal(5, token.LeadingTrivia.Count); 4420Assert.Equal(7, token.LeadingTrivia.Count); 4476Assert.Equal(7, token.LeadingTrivia.Count); 4534Assert.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)
3716for (var i = 0; i < triviaList.Count; i++) 3725if (index < triviaList.Count) 3727yield 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)
224Contract.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)
84TriviaHelpers.CreateTriviaListFromTo(triviaList, index + 1, triviaList.Count - 1)); 115for (var i = 0; i < triviaList.Count; i++) 130return triviaList.Count - 1;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\TypeDeclarationSyntaxExtensions.cs (1)
126for (var i = leadingTrivia.Count - 1; i >= 0; i--)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpRemoveUnnecessaryImportsService.Rewriter.cs (2)
173if (finalTrivia.Count > 0) 225if (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)
88for (var i = 0; i < leadingTrivia.Count; i++) 129if (index >= triviaList.Count)
src\Analyzers\Core\CodeFixes\FileHeaders\AbstractFileHeaderCodeFixProvider.cs (2)
116for (var i = 0; i < triviaList.Count; i++) 182for (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.PerformanceSensitiveAnalyzers (18)
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)
519if (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 (5)
12public int Count => _list1.Count + _list2.Count; 15=> index < _list1.Count ? _list1[index] : _list2[index - _list1.Count]; 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)
508if (trailing.Count >= 1 && isEndOfLineTrivia(trailing.Last()))
Microsoft.CodeAnalysis.PublicApiAnalyzers (17)
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)
519if (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 (5)
12public int Count => _list1.Count + _list2.Count; 15=> index < _list1.Count ? _list1[index] : _list2[index - _list1.Count]; 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.ResxSourceGenerator (17)
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)
519if (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 (5)
12public int Count => _list1.Count + _list2.Count; 15=> index < _list1.Count ? _list1[index] : _list2[index - _list1.Count]; 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.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\Formatting\Engine\Trivia\TriviaDataFactory.Analyzer.vb (1)
35If list.Count = 0 Then
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.TriviaRewriter.vb (2)
97For i As Integer = 0 To triviaList.Count - 1 105Return triviaList.Count - 1
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\VisualBasicTriviaFormatter.vb (1)
296Contract.ThrowIfFalse(singlelineDocCommentTrivia.Count = 1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Helpers\RemoveUnnecessaryImports\VisualBasicRemoveUnnecessaryImportsRewriter.vb (1)
125If remainingTrivia.Count > 0 Then
Microsoft.CodeAnalysis.VisualBasic.Features (4)
CodeFixes\Suppression\VisualBasicSuppressionCodeFixProvider.vb (1)
133Dim 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)
47If triviaList.Count > 0 Then
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (76)
Parser\ParseDirectives.vb (2)
2415Assert.True(tt.Count = 4) 2508Assert.True(tt.Count = 4)
Parser\ParseStatements.vb (2)
2275Assert.Equal(3, leading.Count) 2281Assert.Equal(2, trailing.Count)
Scanner\ScannerTests.vb (5)
817Assert.Equal(3, tk.LeadingTrivia.Count) 826Assert.Equal(3, tk.LeadingTrivia.Count) 835Assert.Equal(3, tk.LeadingTrivia.Count) 848Assert.Equal(3, tk.LeadingTrivia.Count) 857Assert.Equal(5, tk.LeadingTrivia.Count)
Syntax\ManualTests.vb (2)
105Assert.Equal(1, node.GetLeadingTrivia().Count) 115Assert.Equal(1, node.GetLeadingTrivia().Count)
Syntax\SyntaxTokenFactoryTests.vb (33)
16Assert.Equal(keywordToken.LeadingTrivia.Count, 1) 17Assert.Equal(keywordToken.TrailingTrivia.Count, 1) 21Assert.Equal(keywordToken.LeadingTrivia.Count, 1) 22Assert.Equal(keywordToken.TrailingTrivia.Count, 1) 26Assert.Equal(keywordToken.LeadingTrivia.Count, 1) 27Assert.Equal(keywordToken.TrailingTrivia.Count, 1) 30Assert.Equal(keywordToken.LeadingTrivia.Count, 1) 31Assert.Equal(keywordToken.TrailingTrivia.Count, 1) 34Assert.Equal(keywordToken.LeadingTrivia.Count, 1) 35Assert.Equal(keywordToken.TrailingTrivia.Count, 1) 40Assert.Equal(keywordToken.LeadingTrivia.Count, 1) 41Assert.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) 60Assert.Equal(punctuationToken.LeadingTrivia.Count, 1) 61Assert.Equal(punctuationToken.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) 74Assert.Equal(punctuationToken.LeadingTrivia.Count, 1) 75Assert.Equal(punctuationToken.TrailingTrivia.Count, 1) 78Assert.Equal(punctuationToken.LeadingTrivia.Count, 1) 79Assert.Equal(punctuationToken.TrailingTrivia.Count, 1) 84Assert.Equal(punctuationToken.LeadingTrivia.Count, 1) 85Assert.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) 166Assert.Equal(1, id.TrailingTrivia.Count)
TestSyntaxNodes.vb (32)
308If list.Count > 0 Then 311Assert.Equal(expectedFullSpan.End, list(list.Count - 1).FullSpan.End) 313For i = 0 To list.Count - 2 334If precedingTrivia.Count = 0 Then 340If followingTrivia.Count = 0 Then 359If precedingTrivia.Count = 0 Then 365If followingTrivia.Count = 0 Then 683Assert.Equal(1, precTrivia.Count) 685Assert.Equal(1, follTrivia.Count) 699Assert.Equal(0, precTrivia.Count) 701Assert.Equal(2, follTrivia.Count) 737Assert.Equal(3, precTrivia.Count) 758Assert.Equal(1, follTrivia.Count) 774Assert.Equal(1, keyword.LeadingTrivia().Count) 775Assert.Equal(1, keyword.TrailingTrivia().Count) 786Assert.Equal(2, keyword.LeadingTrivia().Count) 788Assert.Equal(0, keyword.TrailingTrivia().Count) 795Assert.Equal(0, keyword.LeadingTrivia().Count) 796Assert.Equal(1, keyword.TrailingTrivia().Count) 806Assert.Equal(2, keyword.LeadingTrivia().Count) 807Assert.Equal(1, keyword.TrailingTrivia().Count) 823Assert.Equal(1, endTry.GetTrailingTrivia().Count) 1594Assert.Equal(2, trivia.Count) 1615Assert.Equal(2, trivia.Count) 1632Assert.True(trivia.Count = 1) 1639Assert.True(trivia.Count = 1) 1646Assert.True(trivia.Count = 2) 1654Assert.True(trivia.Count = 2) 1662Assert.True(trivia.Count = 2) 1670Assert.True(trivia.Count = 2) 1737Assert.Equal(0, tree.GetRoot().FindToken(node.FullSpan.Length - 1).TrailingTrivia.Count) 1738Assert.Equal(1, tree.GetRoot().FindToken(0).LeadingTrivia.Count)
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (3)
ParserTestUtilities.vb (3)
343Assert.InRange(trivia.Count, 1, 2) 345If trivia.Count = 1 Then 347ElseIf 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)
230If Not node.DescendantTokens().Any(Function(token) token = previousToken) AndAlso prevTrailingTrivia.Count > 0 Then 366If 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))
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\Formatting\Engine\Trivia\TriviaDataFactory.Analyzer.vb (1)
35If list.Count = 0 Then
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.TriviaRewriter.vb (2)
97For i As Integer = 0 To triviaList.Count - 1 105Return triviaList.Count - 1
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\VisualBasicTriviaFormatter.vb (1)
296Contract.ThrowIfFalse(singlelineDocCommentTrivia.Count = 1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Helpers\RemoveUnnecessaryImports\VisualBasicRemoveUnnecessaryImportsRewriter.vb (1)
125If remainingTrivia.Count > 0 Then
Microsoft.CodeAnalysis.Workspaces (18)
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)
519if (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 (5)
12public int Count => _list1.Count + _list2.Count; 15=> index < _list1.Count ? _list1[index] : _list2[index - _list1.Count]; 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)
508if (trailing.Count >= 1 && isEndOfLineTrivia(trailing.Last()))
Roslyn.Diagnostics.Analyzers (18)
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)
519if (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 (5)
12public int Count => _list1.Count + _list2.Count; 15=> index < _list1.Count ? _list1[index] : _list2[index - _list1.Count]; 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)
508if (trailing.Count >= 1 && isEndOfLineTrivia(trailing.Last()))
Roslyn.Diagnostics.CSharp.Analyzers (11)
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)
224Contract.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 (2)
115for (var i = 0; i < triviaList.Count; i++) 130return triviaList.Count - 1;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\TypeDeclarationSyntaxExtensions.cs (1)
126for (var i = leadingTrivia.Count - 1; i >= 0; i--)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpRemoveUnnecessaryImportsService.Rewriter.cs (2)
173if (finalTrivia.Count > 0) 225if (finalTrivia.Count > 0)
Roslyn.Diagnostics.VisualBasic.Analyzers (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Helpers\RemoveUnnecessaryImports\VisualBasicRemoveUnnecessaryImportsRewriter.vb (1)
125If remainingTrivia.Count > 0 Then
Test.Utilities (17)
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)
519if (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 (5)
12public int Count => _list1.Count + _list2.Count; 15=> index < _list1.Count ? _list1[index] : _list2[index - _list1.Count]; 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 &&
Text.Analyzers (18)
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)
519if (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 (5)
12public int Count => _list1.Count + _list2.Count; 15=> index < _list1.Count ? _list1[index] : _list2[index - _list1.Count]; 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)
508if (trailing.Count >= 1 && isEndOfLineTrivia(trailing.Last()))