59 instantiations of SyntaxTriviaList
Microsoft.AspNetCore.App.CodeFixes (1)
Authorization\AddAuthorizationBuilderFixer.cs (1)
121var newInvocationTrivia = new SyntaxTriviaList(
Microsoft.CodeAnalysis (11)
Syntax\SyntaxToken.cs (2)
410? new SyntaxTriviaList(this, Node.GetLeadingTriviaCore(), this.Position) 442return new SyntaxTriviaList(this,
Syntax\SyntaxTriviaList.cs (4)
75return new SyntaxTriviaList(token: default, CreateNodeFromSpan(trivias), position: 0, index: 0); 372return new SyntaxTriviaList(default(SyntaxToken), GreenNode.CreateList(list, static n => n.RequiredUnderlyingNode), 0, 0); 418return new SyntaxTriviaList(default(SyntaxToken), GreenNode.CreateList(list, static n => n.RequiredUnderlyingNode), 0, 0); 531return new SyntaxTriviaList(trivia);
Syntax\SyntaxTriviaListBuilder.cs (5)
30return new SyntaxTriviaList(); 140return new SyntaxTriviaList(default(SyntaxToken), _nodes[0].UnderlyingNode, position: 0, index: 0); 142return new SyntaxTriviaList(default(SyntaxToken), 147return new SyntaxTriviaList(default(SyntaxToken), 161return new SyntaxTriviaList(default(SyntaxToken),
Microsoft.CodeAnalysis.CodeStyle (6)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (2)
716var list = new SyntaxTriviaList(); 750var list = new SyntaxTriviaList();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTokenExtensions.cs (1)
141var list = new SyntaxTriviaList();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
250return new SyntaxTriviaList(triviaList); 257return new SyntaxTriviaList(triviaList);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\TriviaHelpers.cs (1)
23return new SyntaxTriviaList(builder);
Microsoft.CodeAnalysis.CSharp (3)
Syntax\SyntaxFactory.cs (3)
1312return new SyntaxTriviaList(trivia); 1320=> new SyntaxTriviaList(trivias); 1327=> new SyntaxTriviaList(trivias);
Microsoft.CodeAnalysis.CSharp.CodeStyle (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTriviaListExtensions.cs (1)
72return new SyntaxTriviaList(triviaList.Skip(triviaInLeadingBlankLines.Count()));
Microsoft.CodeAnalysis.CSharp.Features (2)
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.cs (2)
446var newLeadingTrivia = new SyntaxTriviaList(); 494var identifierLeadingTrivia = new SyntaxTriviaList();
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (1)
Syntax\StructuredTriviaTests.cs (1)
210var trl = new SyntaxTriviaList();
Microsoft.CodeAnalysis.CSharp.Workspaces (2)
CodeGeneration\CSharpSyntaxGenerator.cs (1)
3668return new SyntaxTriviaList(syntaxWithoutComments);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTriviaListExtensions.cs (1)
72return new SyntaxTriviaList(triviaList.Skip(triviaInLeadingBlankLines.Count()));
Microsoft.CodeAnalysis.Features (8)
AddFileBanner\AbstractAddFileBannerCodeRefactoringProvider.cs (2)
134var newRoot = root.WithPrependedLeadingTrivia(new SyntaxTriviaList(banner)); 205var newRoot = root.WithPrependedLeadingTrivia(new SyntaxTriviaList(banner));
Wrapping\AbstractCodeActionComputer.cs (1)
77SingleWhitespaceTrivia = new SyntaxTriviaList(generator.Whitespace(" "));
Wrapping\BinaryExpression\BinaryExpressionCodeActionComputer.cs (2)
61_indentAndAlignTrivia = new SyntaxTriviaList(generator.Whitespace( 65_smartIndentTrivia = AsyncLazy.Create(async cancellationToken => new SyntaxTriviaList(generator.Whitespace(
Wrapping\ChainedExpression\ChainedExpressionCodeActionComputer.cs (2)
84_firstPeriodIndentationTrivia = new SyntaxTriviaList(generator.Whitespace( 87_smartIndentTrivia = AsyncLazy.Create(async cancellationToken => new SyntaxTriviaList(generator.Whitespace(
Wrapping\Edit.cs (1)
61return UpdateBetween(left, leftTrailingTrivia, new SyntaxTriviaList(rightLeadingTrivia), right);
Microsoft.CodeAnalysis.VisualBasic (2)
Syntax\SyntaxNodeFactories.vb (2)
829Return New SyntaxTriviaList() 845Return New SyntaxTriviaList(trivias)
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (16)
Syntax\SyntaxTokenFactoryTests.vb (16)
30keywordToken = SyntaxFactory.Token(New SyntaxTriviaList(SyntaxFactory.WhitespaceTrivia(" ")), SyntaxKind.AddHandlerKeyword) 34keywordToken = SyntaxFactory.Token(SyntaxKind.AddHandlerKeyword, trailing:=New SyntaxTriviaList(SyntaxFactory.WhitespaceTrivia(" "))) 38keywordToken = SyntaxFactory.Token(New SyntaxTriviaList(SyntaxFactory.WhitespaceTrivia(" ")), SyntaxKind.AddHandlerKeyword, trailing:=New SyntaxTriviaList(SyntaxFactory.WhitespaceTrivia(" "))) 43keywordToken = SyntaxFactory.Token(New SyntaxTriviaList(SyntaxFactory.WhitespaceTrivia(" ")), SyntaxKind.AddHandlerKeyword, SyntaxFacts.GetText(SyntaxKind.AddHandlerKeyword).ToUpperInvariant) 48keywordToken = SyntaxFactory.Token(SyntaxKind.AddHandlerKeyword, New SyntaxTriviaList(SyntaxFactory.WhitespaceTrivia(" ")), SyntaxFacts.GetText(SyntaxKind.AddHandlerKeyword).ToUpperInvariant) 53keywordToken = SyntaxFactory.Token(New SyntaxTriviaList(SyntaxFactory.WhitespaceTrivia(" ")), SyntaxKind.AddHandlerKeyword, New SyntaxTriviaList(SyntaxFactory.WhitespaceTrivia(" ")), SyntaxFacts.GetText(SyntaxKind.AddHandlerKeyword).ToUpperInvariant) 74punctuationToken = SyntaxFactory.Token(New SyntaxTriviaList(SyntaxFactory.WhitespaceTrivia(" ")), SyntaxKind.ExclamationToken) 78punctuationToken = SyntaxFactory.Token(SyntaxKind.ExclamationToken, trailing:=New SyntaxTriviaList(SyntaxFactory.WhitespaceTrivia(" "))) 82punctuationToken = SyntaxFactory.Token(New SyntaxTriviaList(SyntaxFactory.WhitespaceTrivia(" ")), SyntaxKind.ExclamationToken, trailing:=New SyntaxTriviaList(SyntaxFactory.WhitespaceTrivia(" "))) 87punctuationToken = SyntaxFactory.Token(New SyntaxTriviaList(SyntaxFactory.WhitespaceTrivia(" ")), SyntaxKind.ExclamationToken, SyntaxFacts.GetText(SyntaxKind.ExclamationToken).ToUpperInvariant) 92punctuationToken = SyntaxFactory.Token(SyntaxKind.ExclamationToken, New SyntaxTriviaList(SyntaxFactory.WhitespaceTrivia(" ")), SyntaxFacts.GetText(SyntaxKind.ExclamationToken).ToUpperInvariant) 97punctuationToken = SyntaxFactory.Token(New SyntaxTriviaList(SyntaxFactory.WhitespaceTrivia(" ")), SyntaxKind.ExclamationToken, New SyntaxTriviaList(SyntaxFactory.WhitespaceTrivia(" ")), SyntaxFacts.GetText(SyntaxKind.ExclamationToken).ToUpperInvariant)
Microsoft.CodeAnalysis.Workspaces (6)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (2)
716var list = new SyntaxTriviaList(); 750var list = new SyntaxTriviaList();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTokenExtensions.cs (1)
141var list = new SyntaxTriviaList();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
250return new SyntaxTriviaList(triviaList); 257return new SyntaxTriviaList(triviaList);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\TriviaHelpers.cs (1)
23return new SyntaxTriviaList(builder);
1066 references to SyntaxTriviaList
Microsoft.Analyzers.Extra (1)
CallAnalysis\Fixers\LegacyLoggingFixer.cs (1)
603var line = SyntaxFactory.ParseLeadingTrivia($@"
Microsoft.AspNetCore.App.Analyzers (3)
RouteEmbeddedLanguage\Infrastructure\RouteStringSyntaxDetector.cs (1)
183SyntaxTriviaList list,
RouteEmbeddedLanguage\Infrastructure\SyntaxNodeExtensions.cs (2)
18private static readonly Func<SyntaxTriviaList, int, SyntaxToken> FindSkippedTokenBackwardFunc = FindSkippedTokenBackward; 128private static SyntaxToken FindSkippedTokenBackward(SyntaxTriviaList triviaList, int position)
Microsoft.AspNetCore.App.CodeFixes (2)
Authorization\AddAuthorizationBuilderFixer.cs (1)
121var newInvocationTrivia = new SyntaxTriviaList(
WebApplicationBuilderFixer.cs (1)
106var indentation = hostBasedInvocationMethodExpr.GetLeadingTrivia();
Microsoft.CodeAnalysis (70)
SourceGeneration\GeneratedCodeUtilities.cs (2)
92var leadingTrivia = root.GetLeadingTrivia(); 123var leadingTrivia = root.GetLeadingTrivia();
Syntax\CommonSyntaxNodeRemover.cs (1)
50private static bool ContainsEndOfLine(SyntaxTriviaList triviaList, int endOfLineKind)
Syntax\SyntaxNavigator.cs (4)
186SyntaxTriviaList triviaList, 207SyntaxTriviaList list, 377SyntaxTriviaList list, 406SyntaxTriviaList list,
Syntax\SyntaxNode.cs (3)
1064public SyntaxTriviaList GetLeadingTrivia() 1073public SyntaxTriviaList GetTrailingTrivia() 1547internal static SyntaxTrivia GetTriviaThatContainsPosition(in SyntaxTriviaList list, int position)
Syntax\SyntaxNode.Iterators.cs (4)
133private static readonly ObjectPool<SyntaxTriviaList.Enumerator[]> s_stackPool = new ObjectPool<SyntaxTriviaList.Enumerator[]>(() => new SyntaxTriviaList.Enumerator[16]); 135private SyntaxTriviaList.Enumerator[] _stack;
Syntax\SyntaxNodeExtensions.cs (4)
341=> token.WithTrailingTrivia(default(SyntaxTriviaList)) 342.WithLeadingTrivia(default(SyntaxTriviaList)); 349SyntaxTriviaList trivia) where TSyntax : SyntaxNode 393SyntaxTriviaList trivia) where TSyntax : SyntaxNode
Syntax\SyntaxNodeOrToken.cs (4)
358public SyntaxTriviaList GetLeadingTrivia() 370return default(SyntaxTriviaList); 382public SyntaxTriviaList GetTrailingTrivia() 394return default(SyntaxTriviaList);
Syntax\SyntaxToken.cs (6)
405public SyntaxTriviaList LeadingTrivia 411: default(SyntaxTriviaList); 419public SyntaxTriviaList TrailingTrivia 425return default(SyntaxTriviaList); 460public SyntaxToken WithLeadingTrivia(SyntaxTriviaList trivia) 486public SyntaxToken WithTrailingTrivia(SyntaxTriviaList trivia)
Syntax\SyntaxTriviaList.cs (30)
23[CollectionBuilder(typeof(SyntaxTriviaList), methodName: "Create")] 24public readonly partial struct SyntaxTriviaList : IEquatable<SyntaxTriviaList>, IReadOnlyList<SyntaxTrivia> 26public static SyntaxTriviaList Empty => default(SyntaxTriviaList); 70public static SyntaxTriviaList Create(ReadOnlySpan<SyntaxTrivia> trivias) 218/// Returns a list which contains all elements of <see cref="SyntaxTriviaList"/> in reversed order. 220/// <returns><see cref="Reversed"/> which contains all elements of <see cref="SyntaxTriviaList"/> in reversed order</returns> 259/// Creates a new <see cref="SyntaxTriviaList"/> with the specified trivia added to the end. 262public SyntaxTriviaList Add(SyntaxTrivia trivia) 268/// Creates a new <see cref="SyntaxTriviaList"/> with the specified trivia added to the end. 271public SyntaxTriviaList AddRange(IEnumerable<SyntaxTrivia> trivia) 277/// Creates a new <see cref="SyntaxTriviaList"/> with the specified trivia inserted at the index. 281public SyntaxTriviaList Insert(int index, SyntaxTrivia trivia) 312/// Creates a new <see cref="SyntaxTriviaList"/> with the specified trivia inserted at the index. 316public SyntaxTriviaList InsertRange(int index, IEnumerable<SyntaxTrivia> trivia) 360/// Creates a new <see cref="SyntaxTriviaList"/> with the element at the specified index removed. 363public SyntaxTriviaList RemoveAt(int index) 376/// Creates a new <see cref="SyntaxTriviaList"/> with the specified element removed. 379public SyntaxTriviaList Remove(SyntaxTrivia triviaInList) 391/// Creates a new <see cref="SyntaxTriviaList"/> with the specified element replaced with new trivia. 395public SyntaxTriviaList Replace(SyntaxTrivia triviaInList, SyntaxTrivia newTrivia) 406/// Creates a new <see cref="SyntaxTriviaList"/> with the specified element replaced with new trivia. 410public SyntaxTriviaList ReplaceRange(SyntaxTrivia triviaInList, IEnumerable<SyntaxTrivia> newTrivia) 462public bool Equals(SyntaxTriviaList other) 467public static bool operator ==(SyntaxTriviaList left, SyntaxTriviaList right) 472public static bool operator !=(SyntaxTriviaList left, SyntaxTriviaList right) 479return (obj is SyntaxTriviaList list) && Equals(list); 529public static SyntaxTriviaList Create(SyntaxTrivia trivia)
Syntax\SyntaxTriviaList.Enumerator.cs (2)
27internal Enumerator(in SyntaxTriviaList list) 140internal EnumeratorImpl(in SyntaxTriviaList list)
Syntax\SyntaxTriviaList.Reversed.cs (4)
21private readonly SyntaxTriviaList _list; 23public Reversed(SyntaxTriviaList list) 81internal Enumerator(in SyntaxTriviaList list) 136internal ReversedEnumeratorImpl(in SyntaxTriviaList list)
Syntax\SyntaxTriviaListBuilder.cs (6)
26public static SyntaxTriviaList Create(IEnumerable<SyntaxTrivia>? trivia) 105public void Add(in SyntaxTriviaList list) 110public void Add(in SyntaxTriviaList list, int offset, int length) 128public static implicit operator SyntaxTriviaList(SyntaxTriviaListBuilder builder) 133public SyntaxTriviaList ToList() 168return default(SyntaxTriviaList);
Microsoft.CodeAnalysis.CodeStyle (41)
src\Analyzers\Core\Analyzers\NewLines\MultipleBlankLines\AbstractMultipleBlankLinesDiagnosticAnalyzer.cs (2)
88var leadingTrivia = token.LeadingTrivia; 128private bool IsEndOfLine(SyntaxTriviaList triviaList, int index)
src\Analyzers\Core\Analyzers\UseConditionalExpression\UseConditionalExpressionHelpers.cs (1)
68public static bool HasRegularCommentTrivia(ISyntaxFacts syntaxFacts, SyntaxTriviaList triviaList)
src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (2)
92var leadingTrivia = root.GetLeadingTrivia(); 123var leadingTrivia = root.GetLeadingTrivia();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (10)
540private static readonly Func<SyntaxTriviaList, int, SyntaxToken> s_findSkippedTokenForward = FindSkippedTokenForward; 545private static SyntaxToken FindSkippedTokenForward(SyntaxTriviaList triviaList, int position) 570private static readonly Func<SyntaxTriviaList, int, SyntaxToken> s_findSkippedTokenBackward = FindSkippedTokenBackward; 575private static SyntaxToken FindSkippedTokenBackward(SyntaxTriviaList triviaList, int position) 702SyntaxTriviaList trivia) where T : SyntaxNode 716var list = new SyntaxTriviaList(); 736SyntaxTriviaList trivia) where T : SyntaxNode 750var list = new SyntaxTriviaList(); 769return token.WithLeadingTrivia(default(SyntaxTriviaList)); 777return token.WithTrailingTrivia(default(SyntaxTriviaList));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTokenExtensions.cs (4)
110public static SyntaxToken With(this SyntaxToken token, SyntaxTriviaList leading, SyntaxTriviaList trailing) 127SyntaxTriviaList trivia) 141var list = new SyntaxTriviaList();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs (1)
146var triviaList = compilationUnit.EndOfFileToken.LeadingTrivia;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTriviaListExtensions.cs (2)
11public static SyntaxTrivia? FirstOrNull(this SyntaxTriviaList triviaList, Func<SyntaxTrivia, bool> predicate) 24public static SyntaxTrivia LastOrDefault(this SyntaxTriviaList triviaList)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaDataWithList.cs (1)
11public abstract SyntaxTriviaList GetTriviaList(CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
61public static bool HasAnyWhitespaceElasticTrivia(this SyntaxTriviaList list)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
238public SyntaxTriviaList FormatToSyntaxTrivia(CancellationToken cancellationToken) 260private static void AddRange(ArrayBuilder<SyntaxTrivia> result, SyntaxTriviaList triviaList)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\TriviaHelpers.cs (2)
11public static SyntaxTriviaList CreateTriviaListFromTo(SyntaxTriviaList triviaList, int startIndex, int endIndex)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\TriviaList.cs (7)
7internal readonly struct TriviaList(SyntaxTriviaList list1, SyntaxTriviaList list2) 9private readonly SyntaxTriviaList _list1 = list1; 10private readonly SyntaxTriviaList _list2 = list2; 22private readonly SyntaxTriviaList _list1; 23private readonly SyntaxTriviaList _list2; 25private SyntaxTriviaList.Enumerator _enumerator;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (2)
112var leadingTrivia = node.GetLeadingTrivia(); 174var leadingTrivia = firstToken.LeadingTrivia;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\AbstractDocumentationCommentService.cs (1)
54var leadingTrivia = documentationComment.GetLeadingTrivia();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFacts.cs (1)
106SyntaxTriviaList ParseLeadingTrivia(string text);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (2)
119private static bool IsOnSingleLine(ISyntaxFacts syntaxFacts, SyntaxTriviaList triviaList, bool checkTrivia) 246private static bool SpansPreprocessorDirective(this ISyntaxFacts syntaxFacts, SyntaxTriviaList list)
Microsoft.CodeAnalysis.CodeStyle.Fixes (23)
src\Analyzers\Core\CodeFixes\DocumentationComments\AbstractAddDocCommentNodesCodeFixProvider.cs (1)
53protected abstract SyntaxNode? TryGetDocCommentNode(SyntaxTriviaList parameter);
src\Analyzers\Core\CodeFixes\DocumentationComments\AbstractRemoveDocCommentNodeCodeFixProvider.cs (1)
28protected abstract SyntaxTriviaList GetRevisedDocCommentTrivia(string docCommentText);
src\Analyzers\Core\CodeFixes\FileHeaders\AbstractFileHeaderCodeFixProvider.cs (5)
97var triviaList = root.GetLeadingTrivia(); 167var newHeaderTrivia = CreateNewHeader(syntaxFacts, leadingSpaces + fileHeaderHelper.CommentPrefix, expectedFileHeader, newLineTrivia.ToFullString()); 178var newTrivia = CreateNewHeader(syntaxFacts, fileHeaderHelper.CommentPrefix, expectedFileHeader, newLineTrivia.ToFullString()).Add(newLineTrivia).Add(newLineTrivia); 181var leadingTrivia = root.GetLeadingTrivia(); 200private static SyntaxTriviaList CreateNewHeader(ISyntaxFacts syntaxFacts, string prefixWithLeadingSpaces, string expectedFileHeader, string newLineText)
src\Analyzers\Core\CodeFixes\ImplementInterface\AbstractImplementInterfaceService.cs (2)
33protected abstract SyntaxNode AddCommentInsideIfStatement(SyntaxNode ifDisposingStatement, SyntaxTriviaList trivia); 72protected SyntaxTriviaList CreateCommentTrivia(
src\Analyzers\Core\CodeFixes\NewLines\MultipleBlankLines\AbstractMultipleBlankLinesCodeFixProvider.cs (3)
63private static SyntaxTriviaList UpdateLeadingTrivia(ISyntaxKindsService syntaxKinds, SyntaxTriviaList triviaList) 136private static bool IsEndOfLine(ISyntaxKindsService syntaxKinds, SyntaxTriviaList triviaList, int index)
src\Analyzers\Core\CodeFixes\RemoveUnusedParametersAndValues\AbstractRemoveUnusedValuesCodeFixProvider.cs (1)
713var leadingTrivia = insertionNode.GetLeadingTrivia();
src\Analyzers\Core\CodeFixes\UseCompoundAssignment\AbstractUseCompoundAssignmentCodeFixProvider.cs (2)
44protected abstract SyntaxTriviaList PrepareRightExpressionLeadingTrivia(SyntaxTriviaList initialTrivia);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService.cs (5)
507var leading = attributeList.GetLeadingTrivia(); 508var trailing = attributeList.GetTrailingTrivia(); 529var leading = isComma(previousToken) ? previousToken.LeadingTrivia : attributeToRemove.GetLeadingTrivia(); 531var trailing = isComma(nextToken) ? nextToken.TrailingTrivia : attributeToRemove.GetTrailingTrivia(); 535protected static T AppendTriviaAtPosition<T>(T node, int position, SyntaxTriviaList trivia)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\AddImports\AddImportHelpers.cs (3)
51var trailingTrivia = newImports[i].GetTrailingTrivia(); 65var originalFirstUsingTrailingTrivia = originalFirstUsing.GetTrailingTrivia(); 88var trailingTrivia = newImports[i].GetTrailingTrivia();
Microsoft.CodeAnalysis.CSharp (82)
Compiler\DocumentationCommentCompiler.IncludeElementExpander.cs (1)
621SyntaxTriviaList leadingTrivia = SyntaxFactory.ParseLeadingTrivia(commentText, CSharpParseOptions.Default.WithDocumentationMode(DocumentationMode.Diagnose));
CSharpExtensions.cs (2)
125public static int IndexOf(this SyntaxTriviaList list, SyntaxKind kind) 133public static bool Any(this SyntaxTriviaList list, SyntaxKind kind)
Parser\Lexer.cs (2)
322internal SyntaxTriviaList LexSyntaxLeadingTrivia() 330internal SyntaxTriviaList LexSyntaxTrailingTrivia()
Syntax\CSharpSyntaxNode.cs (2)
166public new SyntaxTriviaList GetLeadingTrivia() 175public new SyntaxTriviaList GetTrailingTrivia()
Syntax\CSharpSyntaxRewriter.cs (5)
78var leading = this.VisitList(new SyntaxTriviaList(token, leadingTrivia)); 87var trailing = this.VisitList(new SyntaxTriviaList(token, trailingTrivia, token.Position + node.FullWidth - trailingTrivia.FullWidth, index)); 107var trailing = this.VisitList(new SyntaxTriviaList(token, trailingTrivia, token.Position + node.FullWidth - trailingTrivia.FullWidth, index: 0)); 281public virtual SyntaxTriviaList VisitList(SyntaxTriviaList list)
Syntax\SyntaxExtensions.cs (5)
104public static SyntaxTriviaList NormalizeWhitespace(this SyntaxTriviaList list, string indentation, bool elasticTrivia) 118public static SyntaxTriviaList NormalizeWhitespace(this SyntaxTriviaList list, 126public static SyntaxTriviaList ToSyntaxTriviaList(this IEnumerable<SyntaxTrivia> sequence)
Syntax\SyntaxFactory.cs (48)
230public static SyntaxToken Token(SyntaxTriviaList leading, SyntaxKind kind, SyntaxTriviaList trailing) 247public static SyntaxToken Token(SyntaxTriviaList leading, SyntaxKind kind, string text, string valueText, SyntaxTriviaList trailing) 287public static SyntaxToken MissingToken(SyntaxTriviaList leading, SyntaxKind kind, SyntaxTriviaList trailing) 308public static SyntaxToken Identifier(SyntaxTriviaList leading, string text, SyntaxTriviaList trailing) 321public static SyntaxToken VerbatimIdentifier(SyntaxTriviaList leading, string text, string valueText, SyntaxTriviaList trailing) 342public static SyntaxToken Identifier(SyntaxTriviaList leading, SyntaxKind contextualKind, string text, string valueText, SyntaxTriviaList trailing) 373public static SyntaxToken Literal(SyntaxTriviaList leading, string text, int value, SyntaxTriviaList trailing) 404public static SyntaxToken Literal(SyntaxTriviaList leading, string text, uint value, SyntaxTriviaList trailing) 435public static SyntaxToken Literal(SyntaxTriviaList leading, string text, long value, SyntaxTriviaList trailing) 466public static SyntaxToken Literal(SyntaxTriviaList leading, string text, ulong value, SyntaxTriviaList trailing) 497public static SyntaxToken Literal(SyntaxTriviaList leading, string text, float value, SyntaxTriviaList trailing) 528public static SyntaxToken Literal(SyntaxTriviaList leading, string text, double value, SyntaxTriviaList trailing) 559public static SyntaxToken Literal(SyntaxTriviaList leading, string text, decimal value, SyntaxTriviaList trailing) 590public static SyntaxToken Literal(SyntaxTriviaList leading, string text, string value, SyntaxTriviaList trailing) 621public static SyntaxToken Literal(SyntaxTriviaList leading, string text, char value, SyntaxTriviaList trailing) 632public static SyntaxToken BadToken(SyntaxTriviaList leading, string text, SyntaxTriviaList trailing) 644public static SyntaxToken XmlTextLiteral(SyntaxTriviaList leading, string text, string value, SyntaxTriviaList trailing) 656public static SyntaxToken XmlEntity(SyntaxTriviaList leading, string text, string value, SyntaxTriviaList trailing) 1120public static SyntaxToken XmlTextNewLine(SyntaxTriviaList leading, string text, string value, SyntaxTriviaList trailing) 1301public static SyntaxTriviaList TriviaList() 1303return default(SyntaxTriviaList); 1310public static SyntaxTriviaList TriviaList(SyntaxTrivia trivia) 1319public static SyntaxTriviaList TriviaList(params SyntaxTrivia[] trivias) 1326public static SyntaxTriviaList TriviaList(IEnumerable<SyntaxTrivia> trivias) 1582public static SyntaxTriviaList ParseLeadingTrivia(string text, int offset = 0) 1590internal static SyntaxTriviaList ParseLeadingTrivia(string text, CSharpParseOptions options, int offset = 0) 1601public static SyntaxTriviaList ParseTrailingTrivia(string text, int offset = 0) 1622SyntaxTriviaList leadingTrivia = ParseLeadingTrivia(commentText, CSharpParseOptions.Default.WithDocumentationMode(DocumentationMode.Diagnose)); 2413private static bool HasUnterminatedMultiLineComment(SyntaxTriviaList triviaList)
Syntax\SyntaxNodeRemover.cs (6)
37var residualTrivia = remover.ResidualTrivia; 83internal SyntaxTriviaList ResidualTrivia 93return default(SyntaxTriviaList); 98private void AddResidualTrivia(SyntaxTriviaList trivia, bool requiresNewLine = false) 134/// Returns the first end of line found in a <see cref="SyntaxTriviaList"/>. 136private static SyntaxTrivia? GetEndOfLine(SyntaxTriviaList list)
Syntax\SyntaxNormalizer.cs (7)
62internal static SyntaxTriviaList Normalize(SyntaxTriviaList trivia, string indentWhitespace, string eolWhitespace, bool useElasticTrivia = false) 65var result = normalizer.RewriteTrivia( 1015private SyntaxTriviaList RewriteTrivia( 1016SyntaxTriviaList triviaList, 1117return default(SyntaxTriviaList); 1243var trailing = node.GetTrailingTrivia();
Syntax\SyntaxReplacer.cs (2)
505public override SyntaxTriviaList VisitList(SyntaxTriviaList list)
Syntax\SyntaxTokenParser.cs (2)
69var leadingTrivia = _lexer.LexSyntaxLeadingTrivia(); 84var trailingTrivia = _lexer.LexSyntaxTrailingTrivia();
Microsoft.CodeAnalysis.CSharp.CodeStyle (34)
src\Analyzers\CSharp\Analyzers\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementDiagnosticAnalyzer.cs (1)
129private static bool ContainsEndOfLine(SyntaxTriviaList triviaList)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\MemberAccessExpressionSyntaxExtensions.cs (1)
21private static SyntaxTriviaList GetLeadingTriviaForSimplifiedMemberAccess(MemberAccessExpressionSyntax memberAccess)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (1)
529SyntaxTriviaList list,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTriviaExtensions.cs (1)
141public static SyntaxTriviaList AsTrivia(this string s)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTriviaListExtensions.cs (7)
18public static SyntaxTrivia? GetFirstNewLine(this SyntaxTriviaList triviaList) 25public static SyntaxTrivia? GetLastComment(this SyntaxTriviaList triviaList) 32public static SyntaxTrivia? GetLastCommentOrWhitespace(this SyntaxTriviaList triviaList) 45private static ImmutableArray<ImmutableArray<SyntaxTrivia>> GetLeadingBlankLines(SyntaxTriviaList triviaList) 69public static SyntaxTriviaList WithoutLeadingBlankLines(this SyntaxTriviaList triviaList) 78public static IEnumerable<SyntaxTrivia> TakeRange(this SyntaxTriviaList triviaList, int start, int end)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\CSharpTriviaFormatter.cs (1)
224var multilineCommentTrivia = SyntaxFactory.ParseLeadingTrivia(multiLineComment);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.Analyzer.cs (1)
92private static void Analyze(SyntaxTriviaList list, ref AnalysisResult result)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.ComplexTrivia.cs (1)
103public override SyntaxTriviaList GetTriviaList(CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.FormattedComplexTrivia.cs (1)
61public override SyntaxTriviaList GetTriviaList(CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.ModifiedComplexTrivia.cs (1)
101public override SyntaxTriviaList GetTriviaList(CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaRewriter.cs (14)
25private readonly Dictionary<SyntaxToken, SyntaxTriviaList> _trailingTriviaMap = []; 26private readonly Dictionary<SyntaxToken, SyntaxTriviaList> _leadingTriviaMap = []; 69private (SyntaxTriviaList trailingTrivia, SyntaxTriviaList leadingTrivia) GetTrailingAndLeadingTrivia( 76return (default(SyntaxTriviaList), GetLeadingTriviaAtBeginningOfTree(pair.Key, pair.Value, cancellationToken)); 81var triviaList = csharpTriviaData.GetTriviaList(cancellationToken); 91var trailingTrivia = SyntaxFactory.ParseTrailingTrivia(text); 94var leadingTrivia = SyntaxFactory.ParseLeadingTrivia(text[width..]); 114private static int GetFirstEndOfLineIndexOrRightBeforeComment(SyntaxTriviaList triviaList) 134private SyntaxTriviaList GetLeadingTriviaAtBeginningOfTree( 177if (_trailingTriviaMap.TryGetValue(token, out var trailingTrivia)) 188if (_leadingTriviaMap.TryGetValue(token, out var leadingTrivia)) 208private static SyntaxToken CreateNewToken(SyntaxTriviaList leadingTrivia, SyntaxToken token, SyntaxTriviaList trailingTrivia)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\ElasticTriviaFormattingRule.cs (1)
254var triviaList = currentToken.LeadingTrivia;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (1)
297static void ProcessTriviaList(ArrayBuilder<SuppressOperation> list, SyntaxTriviaList triviaList)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (1)
78public SyntaxTriviaList ParseLeadingTrivia(string text)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\UsingsAndExternAliasesOrganizer.cs (1)
157var trailingTrivia = node.GetTrailingTrivia();
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (80)
src\Analyzers\CSharp\CodeFixes\AddInheritdoc\AddInheritdocCodeFixProvider.cs (1)
117var newLeadingTrivia = TriviaList(
src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (2)
305var leadingTrivia = token.LeadingTrivia; 355var trailingTrivia = fileScopedNamespace.GetTrailingTrivia();
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.Rewriter.cs (2)
66SyntaxTriviaList leadingTrivia, 93private ExpressionStatementSyntax GenerateAssignment(ExpressionSyntax switchExpression, SyntaxKind assignmentKind, SyntaxTriviaList leadingTrivia)
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (8)
273var constructorTrivia = typeDeclaration.TypeParameterList?.GetTrailingTrivia() ?? 310var baseTrailingTrivia = baseRecord.Type.GetTrailingTrivia(); 378SyntaxTriviaList modifiedClassTrivia, 381SyntaxTriviaList constructorTrivia, 573private static SyntaxTriviaList GetModifiedClassTrivia( 693private static SyntaxTriviaList? GetExteriorTrivia(SyntaxNode declaration) 717private static SyntaxTriviaList? SearchInNodes(SyntaxList<XmlNodeSyntax> nodes) 751SyntaxTriviaList exteriorTrivia,
src\Analyzers\CSharp\CodeFixes\DocumentationComments\CSharpAddDocCommentNodesCodeFixProvider.cs (1)
40protected override SyntaxNode? TryGetDocCommentNode(SyntaxTriviaList leadingTrivia)
src\Analyzers\CSharp\CodeFixes\DocumentationComments\CSharpRemoveDocCommentNodeCodeFixProvider.cs (1)
40protected override SyntaxTriviaList GetRevisedDocCommentTrivia(string docCommentText)
src\Analyzers\CSharp\CodeFixes\FixIncorrectConstraint\CSharpFixIncorrectConstraintCodeFixProvider.cs (1)
47var trailingTrivia = type.GetTrailingTrivia();
src\Analyzers\CSharp\CodeFixes\ImplementInterface\CSharpImplementInterfaceService.cs (1)
85protected override SyntaxNode AddCommentInsideIfStatement(SyntaxNode ifStatement, SyntaxTriviaList trivia)
src\Analyzers\CSharp\CodeFixes\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessCodeFixProvider.cs (2)
160var expressionTrivia = newStatement.GetTrailingTrivia(); 162var ifStatementTrivia = ifStatement.GetTrailingTrivia();
src\Analyzers\CSharp\CodeFixes\MisplacedUsingDirectives\MisplacedUsingDirectivesCodeFixProvider.cs (4)
286var leadingTrivia = usingDirective.GetLeadingTrivia(); 335private static IEnumerable<IEnumerable<SyntaxTrivia>> SplitIntoLines(SyntaxTriviaList triviaList) 411var leadingTrivia = syntaxRoot.GetLeadingTrivia(); 432var newLeadingTrivia = firstToken.LeadingTrivia.InsertRange(0, fileHeader);
src\Analyzers\CSharp\CodeFixes\NewLines\ConstructorInitializerPlacement\ConstructorInitializerPlacementCodeFixProvider.cs (1)
104var allColonTrivia = colonToken.LeadingTrivia.AddRange(colonToken.TrailingTrivia);
src\Analyzers\CSharp\CodeFixes\RemoveAsyncModifier\RemoveAsyncModifierHelpers.cs (1)
40var asyncLeadingTrivia = modifiers[0].LeadingTrivia;
src\Analyzers\CSharp\CodeFixes\RemoveUnnecessaryNullableDirective\CSharpRemoveUnnecessaryNullableDirectiveCodeFixProvider.cs (2)
98private static bool HasPrecedingBlankLine(SyntaxTriviaList leadingTrivia, int index) 106private static bool HasFollowingBlankLine(SyntaxTriviaList leadingTrivia, int index)
src\Analyzers\CSharp\CodeFixes\RemoveUnusedParametersAndValues\CSharpRemoveUnusedValuesCodeFixProvider.cs (2)
96var triviaToAppend = newNameNode.GetLeadingTrivia().AddRange(newNameNode.GetTrailingTrivia()); 103var trailingTrivia = declarationPattern.Type.GetTrailingTrivia().AddRange(triviaToAppend);
src\Analyzers\CSharp\CodeFixes\TransposeRecordKeyword\CSharpTransposeRecordKeywordCodeFixProvider.cs (2)
44var leadingTrivia = recordKeyword.LeadingTrivia; 59var remainingLeadingTrivia = SyntaxFactory.TriviaList(leadingTrivia.Skip(skippedTriviaIndex + 1));
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (4)
411var trailingTrivia = default(SyntaxTriviaList); 664var leadingTrivia = parentStatement.GetLeadingTrivia(); 858var trivia = nodeOrToken.GetTrailingTrivia();
src\Analyzers\CSharp\CodeFixes\UseCollectionInitializer\CSharpUseCollectionInitializerCodeFixProvider_CollectionInitializer.cs (2)
47var trivia = statement.GetLeadingTrivia(); 50var trailingTrivia = statement.SemicolonToken.TrailingTrivia.Contains(static t => t.IsSingleOrMultiLineComment())
src\Analyzers\CSharp\CodeFixes\UseCompoundAssignment\CSharpUseCompoundAssignmentCodeFixProvider.cs (2)
47protected override SyntaxTriviaList PrepareRightExpressionLeadingTrivia(SyntaxTriviaList initialTrivia) => initialTrivia.SkipWhile(el => el.Kind() is SyntaxKind.WhitespaceTrivia or SyntaxKind.EndOfLineTrivia).ToSyntaxTriviaList();
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (2)
320var leadingTrivia = p.GetLeadingTrivia(); 444var newLeadingTrivia = assignmentExpression.Left.GetTrailingTrivia();
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider_DocComments.cs (11)
37private static SyntaxTrivia GetDocComment(SyntaxTriviaList trivia) 43private static DocumentationCommentTriviaSyntax? GetDocCommentStructure(SyntaxTriviaList trivia) 64private static SyntaxTriviaList CreateFinalTypeDeclarationLeadingTrivia( 74var typeDeclarationLeadingTrivia = MergeTypeDeclarationAndConstructorDocComments(typeDeclaration, constructorDeclaration); 75var finalLeadingTrivia = MergeTypeDeclarationAndRemovedMembersDocComments(constructor, properties, removedMembers, typeDeclarationLeadingTrivia); 99static SyntaxTriviaList MergeTypeDeclarationAndConstructorDocComments( 103var typeDeclarationLeadingTrivia = typeDeclaration.GetLeadingTrivia(); 121static SyntaxTriviaList InsertOrReplaceDocComments(SyntaxTriviaList leadingTrivia, SyntaxTrivia newDocComment) 164static SyntaxTriviaList MergeTypeDeclarationAndRemovedMembersDocComments( 168SyntaxTriviaList typeDeclarationLeadingTrivia)
src\Analyzers\CSharp\CodeFixes\UseSimpleUsingStatement\UseSimpleUsingStatementCodeFixProvider.cs (4)
136private static SyntaxTriviaList Expand(ArrayBuilder<StatementSyntax> result, UsingStatementSyntax usingStatement) 149var openBraceLeadingTrivia = blockSyntax.OpenBraceToken.LeadingTrivia; 150var openBraceTrailingTrivia = blockSyntax.OpenBraceToken.TrailingTrivia; 174var closeBraceTrailingTrivia = blockSyntax.CloseBraceToken.TrailingTrivia;
src\Analyzers\CSharp\CodeFixes\UseUtf8StringLiteral\UseUtf8StringLiteralCodeFixProvider.cs (4)
172var stringLiteral = CreateUtf8String(SyntaxTriviaList.Empty, stringValue, argumentList.Arguments.Last().GetTrailingTrivia(), isConvertedToReadOnlySpan); 188private static ExpressionSyntax CreateUtf8String(SyntaxTriviaList leadingTrivia, string stringValue, SyntaxTriviaList trailingTrivia, bool isConvertedToReadOnlySpan) 196trailing: SyntaxTriviaList.Empty));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (2)
392SyntaxTriviaList triviaOfRemovedNode; 443out SyntaxTriviaList triviaOfRemovedNode)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EnumMemberGenerator.cs (1)
43var trailingTrivia = lastMember.GetTrailingTrivia();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ExpressionSyntaxExtensions.cs (8)
62Token(SyntaxTriviaList.Empty, SyntaxKind.OpenParenToken, SyntaxTriviaList.Empty), 64Token(SyntaxTriviaList.Empty, SyntaxKind.CloseParenToken, SyntaxTriviaList.Empty)); 76Token(SyntaxTriviaList.Empty, SyntaxKind.OpenParenToken, SyntaxTriviaList.Empty), 78Token(SyntaxTriviaList.Empty, SyntaxKind.CloseParenToken, SyntaxTriviaList.Empty));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\TypeDeclarationSyntaxExtensions.cs (3)
102var leadingTrivia = prependNewLineIfMissing ? token.LeadingTrivia.Insert(0, SyntaxFactory.ElasticCarriageReturnLineFeed) : token.LeadingTrivia; 103var trailingTrivia = appendNewLineIfMissing ? token.TrailingTrivia.Insert(0, SyntaxFactory.ElasticCarriageReturnLineFeed) : token.TrailingTrivia; 126var leadingTrivia = closeBrace.LeadingTrivia;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpRemoveUnnecessaryImportsService.Rewriter.cs (6)
47out SyntaxTriviaList finalTrivia) 61var leadingTrivia = currentUsing.GetLeadingTrivia(); 115var currentUsingLeadingTrivia = currentUsing.GetLeadingTrivia(); 126private static bool ShouldPreserveTrivia(SyntaxTriviaList trivia) 157ProcessUsings(compilationUnit.Usings, usingsToRemove, out var finalUsings, out var finalTrivia); 209ProcessUsings(namespaceDeclaration.Usings, usingsToRemove, out var finalUsings, out var finalTrivia);
Microsoft.CodeAnalysis.CSharp.EditorFeatures (4)
AutomaticCompletion\AutomaticLineEnderCommandHandler_Helpers.cs (4)
850leading: SyntaxTriviaList.Empty, 857leading: SyntaxTriviaList.Empty, 1032Token(SyntaxTriviaList.Empty, SyntaxKind.SemicolonToken, SyntaxTriviaList.Empty));
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (2)
Diagnostics\FixAllProvider\BatchFixerTests.cs (1)
76var leadingTrivia = node.GetLeadingTrivia();
Structure\CommentStructureTests.cs (1)
27SyntaxTriviaList triviaList)
Microsoft.CodeAnalysis.CSharp.Features (110)
BraceMatching\BlockCommentBraceMatcher.cs (1)
41BraceMatchingResult? FindBraces(SyntaxTriviaList triviaList)
ChangeSignature\CSharpChangeSignatureService.cs (1)
676var oldTrivia = oldArgument.GetLeadingTrivia();
CodeFixes\Suppression\CSharpSuppressionCodeFixProvider.cs (6)
37protected override SyntaxTriviaList CreatePragmaRestoreDirectiveTrivia(Diagnostic diagnostic, Func<SyntaxNode, CancellationToken, SyntaxNode> formatNode, bool needsLeadingEndOfLine, bool needsTrailingEndOfLine, CancellationToken cancellationToken) 43protected override SyntaxTriviaList CreatePragmaDisableDirectiveTrivia( 50private static SyntaxTriviaList CreatePragmaDirectiveTrivia( 60var triviaList = TriviaList(pragmaDirectiveTrivia); 134SyntaxTriviaList leadingTriviaForAttributeList; 156SyntaxTriviaList leadingTrivia)
CodeRefactorings\EnableNullable\EnableNullableCodeRefactoringProvider.cs (2)
171var existingTriviaList = firstToken.LeadingTrivia; 190private static int GetInsertionPoint(SyntaxTriviaList list)
CodeRefactorings\InlineTemporary\InlineTemporaryCodeRefactoringProvider.cs (2)
322var leadingTrivia = localDeclaration 329var trailingTrivia = localDeclaration
ConvertCast\CSharpConvertDirectCastToTryCastCodeRefactoringProvider.cs (1)
58var newLeadingTrivia = castExpression.GetLeadingTrivia().AddRange(middleTrivia);
ConvertCast\CSharpConvertTryCastToDirectCastCodeRefactoringProvider.cs (2)
54var newTrailingTrivia = asExpression.Left.GetTrailingTrivia().SkipInitialWhitespace().ToSyntaxTriviaList().AddRange(asExpression.GetTrailingTrivia()); 55var newLeadingTrivia = asExpression.GetLeadingTrivia().AddRange(asExpression.OperatorToken.TrailingTrivia.SkipInitialWhitespace());
ConvertIfToSwitch\CSharpConvertIfToSwitchCodeRefactoringProvider.cs (1)
41protected override SyntaxTriviaList GetLeadingTriviaToTransfer(SyntaxNode syntaxToRemove)
ConvertPrimaryToRegularConstructor\ConvertPrimaryToRegularConstructorCodeRefactoringProvider_DocumentationComments.cs (4)
19private static SyntaxTrivia GetDocComment(SyntaxTriviaList trivia) 35var triviaList = typeDeclaration.GetLeadingTrivia(); 63var updatedTriviaList = triviaList.RemoveAt(triviaIndex); 112var triviaList = typeDeclaration.GetLeadingTrivia();
ConvertProgram\ConvertProgramTransform_ProgramMain.cs (4)
89GenerateProgramMainStatements(root, out var leadingTrivia)); 121CompilationUnitSyntax root, out SyntaxTriviaList triviaToMove) 140var commentsToPreserve = TriviaList(statement.GetLeadingTrivia().Skip(triviaToMove.Count)); 156var leadingTrivia = node.GetLeadingTrivia();
DocumentationComments\DocCommentConverter.cs (1)
57var commentLines = ConvertDocCommentToRegularComment(structuredTrivia).ToSyntaxTriviaList();
EmbeddedLanguages\EmbeddedLanguageUtilities.cs (1)
14var triviaList = SyntaxFactory.TriviaList(
ExtractMethod\CSharpMethodExtractor.cs (1)
177var leadingTrivia = methodDefinition.GetLeadingTrivia();
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.cs (2)
446var newLeadingTrivia = new SyntaxTriviaList(); 494var identifierLeadingTrivia = new SyntaxTriviaList();
FullyQualify\CSharpFullyQualifyService.cs (2)
45var leadingTrivia = simpleName.GetLeadingTrivia(); 46var newName = simpleName.WithLeadingTrivia(SyntaxTriviaList.Empty);
IntroduceVariable\CSharpIntroduceVariableService_IntroduceLocal.cs (2)
230var leadingTrivia = oldBody.GetLeadingTrivia() 427var nextStatementLeading = nextStatement.GetLeadingTrivia();
Organizing\Organizers\ModifiersOrganizer.cs (1)
22var leadingTrivia = initialList.First().LeadingTrivia;
QuickInfo\CSharpSyntacticQuickInfoProvider.cs (1)
110var searchListBelow = nextToken.LeadingTrivia;
ReplacePropertyWithMethods\CSharpReplacePropertyWithMethodsService.cs (1)
233var leadingTrivia = propertyDeclaration.GetLeadingTrivia();
src\Analyzers\CSharp\Analyzers\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementDiagnosticAnalyzer.cs (1)
129private static bool ContainsEndOfLine(SyntaxTriviaList triviaList)
src\Analyzers\CSharp\CodeFixes\AddInheritdoc\AddInheritdocCodeFixProvider.cs (1)
117var newLeadingTrivia = TriviaList(
src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (2)
305var leadingTrivia = token.LeadingTrivia; 355var trailingTrivia = fileScopedNamespace.GetTrailingTrivia();
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.Rewriter.cs (2)
66SyntaxTriviaList leadingTrivia, 93private ExpressionStatementSyntax GenerateAssignment(ExpressionSyntax switchExpression, SyntaxKind assignmentKind, SyntaxTriviaList leadingTrivia)
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (8)
273var constructorTrivia = typeDeclaration.TypeParameterList?.GetTrailingTrivia() ?? 310var baseTrailingTrivia = baseRecord.Type.GetTrailingTrivia(); 378SyntaxTriviaList modifiedClassTrivia, 381SyntaxTriviaList constructorTrivia, 573private static SyntaxTriviaList GetModifiedClassTrivia( 693private static SyntaxTriviaList? GetExteriorTrivia(SyntaxNode declaration) 717private static SyntaxTriviaList? SearchInNodes(SyntaxList<XmlNodeSyntax> nodes) 751SyntaxTriviaList exteriorTrivia,
src\Analyzers\CSharp\CodeFixes\DocumentationComments\CSharpAddDocCommentNodesCodeFixProvider.cs (1)
40protected override SyntaxNode? TryGetDocCommentNode(SyntaxTriviaList leadingTrivia)
src\Analyzers\CSharp\CodeFixes\DocumentationComments\CSharpRemoveDocCommentNodeCodeFixProvider.cs (1)
40protected override SyntaxTriviaList GetRevisedDocCommentTrivia(string docCommentText)
src\Analyzers\CSharp\CodeFixes\FixIncorrectConstraint\CSharpFixIncorrectConstraintCodeFixProvider.cs (1)
47var trailingTrivia = type.GetTrailingTrivia();
src\Analyzers\CSharp\CodeFixes\ImplementInterface\CSharpImplementInterfaceService.cs (1)
85protected override SyntaxNode AddCommentInsideIfStatement(SyntaxNode ifStatement, SyntaxTriviaList trivia)
src\Analyzers\CSharp\CodeFixes\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessCodeFixProvider.cs (2)
160var expressionTrivia = newStatement.GetTrailingTrivia(); 162var ifStatementTrivia = ifStatement.GetTrailingTrivia();
src\Analyzers\CSharp\CodeFixes\MisplacedUsingDirectives\MisplacedUsingDirectivesCodeFixProvider.cs (4)
286var leadingTrivia = usingDirective.GetLeadingTrivia(); 335private static IEnumerable<IEnumerable<SyntaxTrivia>> SplitIntoLines(SyntaxTriviaList triviaList) 411var leadingTrivia = syntaxRoot.GetLeadingTrivia(); 432var newLeadingTrivia = firstToken.LeadingTrivia.InsertRange(0, fileHeader);
src\Analyzers\CSharp\CodeFixes\NewLines\ConstructorInitializerPlacement\ConstructorInitializerPlacementCodeFixProvider.cs (1)
104var allColonTrivia = colonToken.LeadingTrivia.AddRange(colonToken.TrailingTrivia);
src\Analyzers\CSharp\CodeFixes\RemoveAsyncModifier\RemoveAsyncModifierHelpers.cs (1)
40var asyncLeadingTrivia = modifiers[0].LeadingTrivia;
src\Analyzers\CSharp\CodeFixes\RemoveUnnecessaryNullableDirective\CSharpRemoveUnnecessaryNullableDirectiveCodeFixProvider.cs (2)
98private static bool HasPrecedingBlankLine(SyntaxTriviaList leadingTrivia, int index) 106private static bool HasFollowingBlankLine(SyntaxTriviaList leadingTrivia, int index)
src\Analyzers\CSharp\CodeFixes\RemoveUnusedParametersAndValues\CSharpRemoveUnusedValuesCodeFixProvider.cs (2)
96var triviaToAppend = newNameNode.GetLeadingTrivia().AddRange(newNameNode.GetTrailingTrivia()); 103var trailingTrivia = declarationPattern.Type.GetTrailingTrivia().AddRange(triviaToAppend);
src\Analyzers\CSharp\CodeFixes\TransposeRecordKeyword\CSharpTransposeRecordKeywordCodeFixProvider.cs (2)
44var leadingTrivia = recordKeyword.LeadingTrivia; 59var remainingLeadingTrivia = SyntaxFactory.TriviaList(leadingTrivia.Skip(skippedTriviaIndex + 1));
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (4)
411var trailingTrivia = default(SyntaxTriviaList); 664var leadingTrivia = parentStatement.GetLeadingTrivia(); 858var trivia = nodeOrToken.GetTrailingTrivia();
src\Analyzers\CSharp\CodeFixes\UseCollectionInitializer\CSharpUseCollectionInitializerCodeFixProvider_CollectionInitializer.cs (2)
47var trivia = statement.GetLeadingTrivia(); 50var trailingTrivia = statement.SemicolonToken.TrailingTrivia.Contains(static t => t.IsSingleOrMultiLineComment())
src\Analyzers\CSharp\CodeFixes\UseCompoundAssignment\CSharpUseCompoundAssignmentCodeFixProvider.cs (2)
47protected override SyntaxTriviaList PrepareRightExpressionLeadingTrivia(SyntaxTriviaList initialTrivia) => initialTrivia.SkipWhile(el => el.Kind() is SyntaxKind.WhitespaceTrivia or SyntaxKind.EndOfLineTrivia).ToSyntaxTriviaList();
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (2)
320var leadingTrivia = p.GetLeadingTrivia(); 444var newLeadingTrivia = assignmentExpression.Left.GetTrailingTrivia();
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider_DocComments.cs (11)
37private static SyntaxTrivia GetDocComment(SyntaxTriviaList trivia) 43private static DocumentationCommentTriviaSyntax? GetDocCommentStructure(SyntaxTriviaList trivia) 64private static SyntaxTriviaList CreateFinalTypeDeclarationLeadingTrivia( 74var typeDeclarationLeadingTrivia = MergeTypeDeclarationAndConstructorDocComments(typeDeclaration, constructorDeclaration); 75var finalLeadingTrivia = MergeTypeDeclarationAndRemovedMembersDocComments(constructor, properties, removedMembers, typeDeclarationLeadingTrivia); 99static SyntaxTriviaList MergeTypeDeclarationAndConstructorDocComments( 103var typeDeclarationLeadingTrivia = typeDeclaration.GetLeadingTrivia(); 121static SyntaxTriviaList InsertOrReplaceDocComments(SyntaxTriviaList leadingTrivia, SyntaxTrivia newDocComment) 164static SyntaxTriviaList MergeTypeDeclarationAndRemovedMembersDocComments( 168SyntaxTriviaList typeDeclarationLeadingTrivia)
src\Analyzers\CSharp\CodeFixes\UseSimpleUsingStatement\UseSimpleUsingStatementCodeFixProvider.cs (4)
136private static SyntaxTriviaList Expand(ArrayBuilder<StatementSyntax> result, UsingStatementSyntax usingStatement) 149var openBraceLeadingTrivia = blockSyntax.OpenBraceToken.LeadingTrivia; 150var openBraceTrailingTrivia = blockSyntax.OpenBraceToken.TrailingTrivia; 174var closeBraceTrailingTrivia = blockSyntax.CloseBraceToken.TrailingTrivia;
src\Analyzers\CSharp\CodeFixes\UseUtf8StringLiteral\UseUtf8StringLiteralCodeFixProvider.cs (4)
172var stringLiteral = CreateUtf8String(SyntaxTriviaList.Empty, stringValue, argumentList.Arguments.Last().GetTrailingTrivia(), isConvertedToReadOnlySpan); 188private static ExpressionSyntax CreateUtf8String(SyntaxTriviaList leadingTrivia, string stringValue, SyntaxTriviaList trailingTrivia, bool isConvertedToReadOnlySpan) 196trailing: SyntaxTriviaList.Empty));
Structure\CSharpStructureHelpers.cs (4)
44var trailingTrivia = lastToken.TrailingTrivia; 45var nextLeadingTrivia = compressEmptyLines ? lastToken.GetNextToken(includeZeroWidth: true, includeSkipped: true).LeadingTrivia : default; 165SyntaxTriviaList triviaList, ArrayBuilder<BlockSpan> spans) 226var triviaList = node.GetLeadingTrivia();
Structure\Providers\DisabledTextTriviaStructureProvider.cs (2)
32var parentTriviaList = trivia.Token.LeadingTrivia; 77SyntaxTrivia trivia, SyntaxTriviaList triviaList, int index)
Structure\Providers\EnumDeclarationStructureProvider.cs (1)
47var leadingTrivia = enumDeclaration.CloseBraceToken.LeadingTrivia;
Structure\Providers\TypeDeclarationStructureProvider.cs (1)
55var leadingTrivia = typeDeclaration.CloseBraceToken.LeadingTrivia;
UseAutoProperty\CSharpUseAutoPropertyCodeFixProvider.cs (1)
152var leadingTrivia = property.GetLeadingTrivia();
Wrapping\BinaryExpression\CSharpBinaryExpressionWrapper.cs (2)
22protected override SyntaxTriviaList GetNewLineBeforeOperatorTrivia(SyntaxTriviaList newLine)
Wrapping\ChainedExpression\CSharpChainedExpressionWrapper.cs (2)
22protected override SyntaxTriviaList GetNewLineBeforeOperatorTrivia(SyntaxTriviaList newLine)
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (2)
DocumentationComments\DocumentationCommentCompilerTests.cs (2)
3226var existingLeadingTrivia = token.LeadingTrivia; 3227var newLeadingTrivia = SyntaxFactory.ParseToken("/** " + (_count++) + " */1)").LeadingTrivia;
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (151)
Diagnostics\LocationsTests.cs (1)
554var node = SyntaxFactory.IdentifierName(SyntaxFactory.Identifier(SyntaxFactory.TriviaList(SyntaxFactory.Whitespace(" ")), "x", default(SyntaxTriviaList)));
LexicalAndXml\LexicalTests.cs (2)
3617var leading = token.GetLeadingTrivia(); 3623var trailing = token.GetTrailingTrivia();
LexicalAndXml\SyntaxTokenParserTests.cs (1)
416private static void AssertTrivia(SyntaxTriviaList leadingTrivia, params (SyntaxKind kind, string text)[] expectedTrivia)
LexicalAndXml\XmlDocCommentTests.cs (87)
80var leading = tree.GetCompilationUnitRoot().EndOfFileToken.LeadingTrivia; 100var leading = tree.GetCompilationUnitRoot().EndOfFileToken.LeadingTrivia; 117var leading = tree.GetCompilationUnitRoot().EndOfFileToken.LeadingTrivia; 132var leading = tree.GetCompilationUnitRoot().EndOfFileToken.LeadingTrivia; 149var leading = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia(); 170var leading = tree.GetCompilationUnitRoot().EndOfFileToken.LeadingTrivia; 195var leading = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia(); 217var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 240var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 263var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 290var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 318var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 342var leading = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia(); 367var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 393var leading = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia(); 420var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 447var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 475var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 504var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 534var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 563var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 593var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 624var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 647var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 669var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 691var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 713var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 735var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 755var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 789var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 822var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 853var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 881var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 906var leading = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia(); 932var leading = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia(); 957var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 984var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1015var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1043var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1068var leading = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia(); 1093var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1120var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1153var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1184var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1210var leading = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia(); 1237var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1265var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1294var leading = classdecl.GetLeadingTrivia(); 1310var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1334var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1359var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1383var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1408var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1432var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1457var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1481var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1561var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1589var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1617var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1643var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1712var trivias = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1751var trivias = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1793var trivias = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1836var trivias = keyword.GetLeadingTrivia(); 1871var trivias = keyword.GetLeadingTrivia(); 1906var trivias = keyword.GetLeadingTrivia(); 1941var trivias = keyword.GetLeadingTrivia(); 1978var trivias = typeParameter.GetLeadingTrivia(); 2014var trivias = typeParameter.GetLeadingTrivia(); 2051var trivias = keyword.GetLeadingTrivia(); 2084var trivias = bracket.GetLeadingTrivia(); 2117var trivias = bracket.GetLeadingTrivia(); 2149var trivias = bracket.GetLeadingTrivia(); 2179var trivias = bracket.GetLeadingTrivia(); 2210var trivias = bracket.GetLeadingTrivia(); 2259var trivias = classKeyword.GetLeadingTrivia(); 2288var topTrivias = eofToken.GetLeadingTrivia(); 2329var trivias = eofToken.GetLeadingTrivia(); 2363var trivias = eofToken.GetLeadingTrivia(); 2443var trivias = classKeyword.GetLeadingTrivia(); 2469var trivias = classKeyword.GetLeadingTrivia(); 2496var trivias = classKeyword.GetLeadingTrivia(); 2521var trivias = classKeyword.GetLeadingTrivia(); 2543var trivias = classKeyword.LeadingTrivia; 2569var trivias = classKeyword.GetLeadingTrivia(); 2746var trivias = classKeyword.GetLeadingTrivia(); 2770var trivias = classKeyword.GetLeadingTrivia();
Parsing\SyntaxExtensions.cs (4)
17public static SyntaxTriviaList GetLeadingTrivia(this SyntaxNode node) 22public static SyntaxTriviaList GetTrailingTrivia(this SyntaxNode node) 44public static SyntaxTriviaList GetLeadingTrivia(this SyntaxToken token) 49public static SyntaxTriviaList GetTrailingTrivia(this SyntaxToken token)
Syntax\StructuredTriviaTests.cs (6)
40SyntaxFactory.Token(spaceTrivia, SyntaxKind.LessThanToken, default(SyntaxTriviaList)), 44SyntaxFactory.Token(default(SyntaxTriviaList), SyntaxKind.GreaterThanToken, spaceTrivia)); 50SyntaxFactory.Token(default(SyntaxTriviaList), SyntaxKind.GreaterThanToken, spaceTrivia)); 67var ident = SyntaxFactory.Identifier(SyntaxTriviaList.Create(sTrivia), "banana", spaceTrivia); 192var trivia = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia(); 210var trl = new SyntaxTriviaList();
Syntax\SyntaxDiffingTests.cs (2)
312var leadingTrivia = node.GetLeadingTrivia(); 377var leadingTrivia = node.GetLeadingTrivia();
Syntax\SyntaxFactoryTests.cs (18)
134Assert.Throws(exceptionType, () => SyntaxFactory.Token(default(SyntaxTriviaList), SyntaxKind.IdentifierName, "text", "valueText", default(SyntaxTriviaList))); 141Assert.Throws<ArgumentException>(() => SyntaxFactory.Token(default(SyntaxTriviaList), SyntaxKind.IdentifierToken, "text", "valueText", default(SyntaxTriviaList))); 142Assert.Throws<ArgumentException>(() => SyntaxFactory.Token(default(SyntaxTriviaList), SyntaxKind.CharacterLiteralToken, "text", "valueText", default(SyntaxTriviaList))); 143Assert.Throws<ArgumentException>(() => SyntaxFactory.Token(default(SyntaxTriviaList), SyntaxKind.NumericLiteralToken, "text", "valueText", default(SyntaxTriviaList))); 150SyntaxFactory.Token(default(SyntaxTriviaList), SyntaxKind.IdentifierToken, "text", "valueText", default(SyntaxTriviaList)); 161SyntaxFactory.Token(default(SyntaxTriviaList), SyntaxKind.CharacterLiteralToken, "text", "valueText", default(SyntaxTriviaList)); 172SyntaxFactory.Token(default(SyntaxTriviaList), SyntaxKind.NumericLiteralToken, "text", "valueText", default(SyntaxTriviaList)); 196var actualRed = SyntaxFactory.Token(SyntaxTriviaList.Create(SyntaxFactory.ElasticMarker), kind, defaultText, defaultText, SyntaxTriviaList.Create(SyntaxFactory.ElasticMarker)); 216var token = SyntaxFactory.Token(SyntaxTriviaList.Create(SyntaxFactory.ElasticMarker), kind, text, valueText, SyntaxTriviaList.Create(SyntaxFactory.ElasticMarker));
Syntax\SyntaxNodeTests.cs (13)
1389var token = SyntaxFactory.Identifier(default(SyntaxTriviaList), "x", SyntaxTriviaList.Create(trivia)); 1487var leadingTriviaWithDuplicate = c.GetLeadingTrivia(); 1943default(SyntaxTriviaList), 1984var someToken = SyntaxFactory.Identifier(default(SyntaxTriviaList), "", SyntaxFactory.TriviaList(SyntaxFactory.Trivia(zeroWidth), SyntaxFactory.Trivia(zeroWidth))); 2357var expr2 = expr.ReplaceToken(token, SyntaxFactory.Token(SyntaxTriviaList.Create(SyntaxFactory.Whitespace("garbage")), token.Kind(), default(SyntaxTriviaList))); 2370var cu2 = cu.ReplaceToken(token, SyntaxFactory.Token(SyntaxTriviaList.Create(SyntaxFactory.Whitespace(" ")), token.Kind(), default(SyntaxTriviaList))); 2415var leadingTrivia = ex.GetLeadingTrivia(); 2437var leadingTrivia = ex.GetLeadingTrivia(); 3466var newModifiers = method.Modifiers.Add(SyntaxFactory.Token(default(SyntaxTriviaList), SyntaxKind.UnsafeKeyword, SyntaxFactory.TriviaList(SyntaxFactory.Space))); 3572var emptyTriviaList = SyntaxFactory.TriviaList(emptyWhitespace, emptyWhitespace);
Syntax\SyntaxNormalizerTests.cs (3)
3646default(SyntaxTriviaList))))), """ 3986var list = SyntaxFactory.ParseLeadingTrivia(text.NormalizeLineEndings()); 3990private static void TestNormalize(SyntaxTriviaList trivia, string expected)
Syntax\SyntaxRewriterTests.cs (4)
467var leadingTrivia = root.GetLeadingTrivia(); 494var leadingTrivia = root.GetLeadingTrivia(); 567var trivia = SyntaxFactory.ParseTrailingTrivia(" "); 613var trivia = SyntaxFactory.ParseTrailingTrivia(" ");
Syntax\SyntaxTriviaListTests.cs (10)
24EqualityTesting.AssertEqual(default(SyntaxTriviaList), default(SyntaxTriviaList)); 40EqualityTesting.AssertEqual(default(SyntaxTriviaList.Reversed), default(SyntaxTriviaList.Reversed)); 53var list = SyntaxFactory.ParseLeadingTrivia("/*A*//*B*//*C*/"); 72var newList = list.Add(triviaD); 186DoTestAddInsertRemoveReplaceOnEmptyList(default(SyntaxTriviaList)); 189private void DoTestAddInsertRemoveReplaceOnEmptyList(SyntaxTriviaList list) 196var newList = list.Add(triviaD); 232var list = SyntaxFactory.ParseLeadingTrivia("/*A*//*B*//*C*/");
Microsoft.CodeAnalysis.CSharp.Workspaces (70)
Classification\Worker.cs (3)
156private void ClassifyTriviaList(SyntaxTriviaList list) 205private void ClassifyTrivia(SyntaxTrivia trivia, SyntaxTriviaList triviaList) 276private void ClassifyDisabledText(SyntaxTrivia trivia, SyntaxTriviaList triviaList)
Classification\Worker_DocumentationComments.cs (1)
66private void ClassifyXmlTrivia(SyntaxTriviaList triviaList)
CodeGeneration\CSharpSyntaxGenerator.cs (5)
78internal override SyntaxNode DocumentationCommentTrivia(IEnumerable<SyntaxNode> nodes, SyntaxTriviaList trailingTrivia, string endOfLineString) 3078var newPreviousToken = previousToken.WithTrailingTrivia(default(SyntaxTriviaList)); 3644internal override SyntaxTriviaList RemoveCommentLines(SyntaxTriviaList syntaxTriviaList) 3646static IEnumerable<IEnumerable<SyntaxTrivia>> splitIntoLines(SyntaxTriviaList triviaList)
Rename\CSharpRenameRewriterLanguageService.cs (2)
640private SyntaxToken RenameInStringLiteral(SyntaxToken oldToken, SyntaxToken newToken, ImmutableSortedSet<TextSpan>? subSpansToReplace, Func<SyntaxTriviaList, string, string, SyntaxTriviaList, SyntaxToken> createNewStringLiteral)
Simplification\CSharpSimplificationService.Expander.cs (6)
330var identifier = Identifier(SyntaxTriviaList.Empty, inferredName, SyntaxTriviaList.Empty); 403.WithLeadingTrivia(SyntaxTriviaList.Empty)) 700var identifiersLeadingTrivia = newNode.GetLeadingTrivia(); 951var leadingTrivia = rewrittenNode.GetLeadingTrivia(); 1114var thisArgument = Argument(thisExpression).WithLeadingTrivia(SyntaxTriviaList.Empty);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\MemberAccessExpressionSyntaxExtensions.cs (1)
21private static SyntaxTriviaList GetLeadingTriviaForSimplifiedMemberAccess(MemberAccessExpressionSyntax memberAccess)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (1)
529SyntaxTriviaList list,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTriviaExtensions.cs (1)
141public static SyntaxTriviaList AsTrivia(this string s)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTriviaListExtensions.cs (7)
18public static SyntaxTrivia? GetFirstNewLine(this SyntaxTriviaList triviaList) 25public static SyntaxTrivia? GetLastComment(this SyntaxTriviaList triviaList) 32public static SyntaxTrivia? GetLastCommentOrWhitespace(this SyntaxTriviaList triviaList) 45private static ImmutableArray<ImmutableArray<SyntaxTrivia>> GetLeadingBlankLines(SyntaxTriviaList triviaList) 69public static SyntaxTriviaList WithoutLeadingBlankLines(this SyntaxTriviaList triviaList) 78public static IEnumerable<SyntaxTrivia> TakeRange(this SyntaxTriviaList triviaList, int start, int end)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\CSharpTriviaFormatter.cs (1)
224var multilineCommentTrivia = SyntaxFactory.ParseLeadingTrivia(multiLineComment);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.Analyzer.cs (1)
92private static void Analyze(SyntaxTriviaList list, ref AnalysisResult result)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.ComplexTrivia.cs (1)
103public override SyntaxTriviaList GetTriviaList(CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.FormattedComplexTrivia.cs (1)
61public override SyntaxTriviaList GetTriviaList(CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.ModifiedComplexTrivia.cs (1)
101public override SyntaxTriviaList GetTriviaList(CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaRewriter.cs (14)
25private readonly Dictionary<SyntaxToken, SyntaxTriviaList> _trailingTriviaMap = []; 26private readonly Dictionary<SyntaxToken, SyntaxTriviaList> _leadingTriviaMap = []; 69private (SyntaxTriviaList trailingTrivia, SyntaxTriviaList leadingTrivia) GetTrailingAndLeadingTrivia( 76return (default(SyntaxTriviaList), GetLeadingTriviaAtBeginningOfTree(pair.Key, pair.Value, cancellationToken)); 81var triviaList = csharpTriviaData.GetTriviaList(cancellationToken); 91var trailingTrivia = SyntaxFactory.ParseTrailingTrivia(text); 94var leadingTrivia = SyntaxFactory.ParseLeadingTrivia(text[width..]); 114private static int GetFirstEndOfLineIndexOrRightBeforeComment(SyntaxTriviaList triviaList) 134private SyntaxTriviaList GetLeadingTriviaAtBeginningOfTree( 177if (_trailingTriviaMap.TryGetValue(token, out var trailingTrivia)) 188if (_leadingTriviaMap.TryGetValue(token, out var leadingTrivia)) 208private static SyntaxToken CreateNewToken(SyntaxTriviaList leadingTrivia, SyntaxToken token, SyntaxTriviaList trailingTrivia)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\ElasticTriviaFormattingRule.cs (1)
254var triviaList = currentToken.LeadingTrivia;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (1)
297static void ProcessTriviaList(ArrayBuilder<SuppressOperation> list, SyntaxTriviaList triviaList)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (1)
78public SyntaxTriviaList ParseLeadingTrivia(string text)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\UsingsAndExternAliasesOrganizer.cs (1)
157var trailingTrivia = node.GetTrailingTrivia();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (2)
392SyntaxTriviaList triviaOfRemovedNode; 443out SyntaxTriviaList triviaOfRemovedNode)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EnumMemberGenerator.cs (1)
43var trailingTrivia = lastMember.GetTrailingTrivia();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ExpressionSyntaxExtensions.cs (8)
62Token(SyntaxTriviaList.Empty, SyntaxKind.OpenParenToken, SyntaxTriviaList.Empty), 64Token(SyntaxTriviaList.Empty, SyntaxKind.CloseParenToken, SyntaxTriviaList.Empty)); 76Token(SyntaxTriviaList.Empty, SyntaxKind.OpenParenToken, SyntaxTriviaList.Empty), 78Token(SyntaxTriviaList.Empty, SyntaxKind.CloseParenToken, SyntaxTriviaList.Empty));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\TypeDeclarationSyntaxExtensions.cs (3)
102var leadingTrivia = prependNewLineIfMissing ? token.LeadingTrivia.Insert(0, SyntaxFactory.ElasticCarriageReturnLineFeed) : token.LeadingTrivia; 103var trailingTrivia = appendNewLineIfMissing ? token.TrailingTrivia.Insert(0, SyntaxFactory.ElasticCarriageReturnLineFeed) : token.TrailingTrivia; 126var leadingTrivia = closeBrace.LeadingTrivia;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpRemoveUnnecessaryImportsService.Rewriter.cs (6)
47out SyntaxTriviaList finalTrivia) 61var leadingTrivia = currentUsing.GetLeadingTrivia(); 115var currentUsingLeadingTrivia = currentUsing.GetLeadingTrivia(); 126private static bool ShouldPreserveTrivia(SyntaxTriviaList trivia) 157ProcessUsings(compilationUnit.Usings, usingsToRemove, out var finalUsings, out var finalTrivia); 209ProcessUsings(namespaceDeclaration.Usings, usingsToRemove, out var finalUsings, out var finalTrivia);
Microsoft.CodeAnalysis.Features (64)
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.cs (2)
47protected abstract SyntaxTriviaList CreatePragmaDisableDirectiveTrivia(Diagnostic diagnostic, Func<SyntaxNode, CancellationToken, SyntaxNode> formatNode, bool needsLeadingEndOfLine, bool needsTrailingEndOfLine, CancellationToken cancellationToken); 48protected abstract SyntaxTriviaList CreatePragmaRestoreDirectiveTrivia(Diagnostic diagnostic, Func<SyntaxNode, CancellationToken, SyntaxNode> formatNode, bool needsLeadingEndOfLine, bool needsTrailingEndOfLine, CancellationToken cancellationToken);
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.PragmaHelpers.cs (2)
129var pragmaTrivia = !isRemoveSuppression 190var pragmaTrivia = !isRemoveSuppression
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.RemoveSuppressionCodeAction_Pragma.cs (4)
104private static SyntaxTriviaList GetTriviaListForSuppression(SyntaxToken token, bool isStartToken, AbstractSuppressionCodeFixProvider fixer) 111private static SyntaxToken UpdateTriviaList(SyntaxToken token, bool isStartToken, SyntaxTriviaList triviaList, AbstractSuppressionCodeFixProvider fixer) 122var triviaList = GetTriviaListForSuppression(token, isStartToken, fixer); 184var triviaList = GetTriviaListForSuppression(token, isStartToken, fixer);
ConvertIfToSwitch\AbstractConvertIfToSwitchCodeRefactoringProvider.Rewriting.cs (1)
26protected abstract SyntaxTriviaList GetLeadingTriviaToTransfer(SyntaxNode syntaxToRemove);
EmbeddedLanguages\Classification\AbstractEmbeddedLanguageClassificationService.cs (1)
147private void ProcessTriviaList(SyntaxTriviaList triviaList)
EmbeddedLanguages\EmbeddedLanguageDetector.cs (1)
118SyntaxTriviaList list,
ExtractMethod\MethodExtractor.VariableSymbol.cs (1)
303private bool ContainsNoisyTrivia(SyntaxTriviaList list)
PullMemberUp\MembersPuller.cs (3)
365var destinationTrivia = GetLeadingTriviaBeforeFirstMember(destinationEditor.OriginalRoot, syntaxFacts); 403private static SyntaxTriviaList GetLeadingTriviaBeforeFirstMember(SyntaxNode root, ISyntaxFactsService syntaxFacts) 419private static SyntaxNode AddLeadingTriviaBeforeFirstMember(SyntaxNode root, ISyntaxFactsService syntaxFacts, SyntaxTriviaList trivia)
ReplaceMethodWithProperty\AbstractReplaceMethodWithPropertyService.cs (1)
80var trailingTrivia = paramList.GetTrailingTrivia();
SpellCheck\AbstractSpellCheckSpanService.cs (1)
241private void ProcessTriviaList(SyntaxTriviaList triviaList, CancellationToken cancellationToken)
src\Analyzers\Core\Analyzers\NewLines\MultipleBlankLines\AbstractMultipleBlankLinesDiagnosticAnalyzer.cs (2)
88var leadingTrivia = token.LeadingTrivia; 128private bool IsEndOfLine(SyntaxTriviaList triviaList, int index)
src\Analyzers\Core\Analyzers\UseConditionalExpression\UseConditionalExpressionHelpers.cs (1)
68public static bool HasRegularCommentTrivia(ISyntaxFacts syntaxFacts, SyntaxTriviaList triviaList)
src\Analyzers\Core\CodeFixes\DocumentationComments\AbstractAddDocCommentNodesCodeFixProvider.cs (1)
53protected abstract SyntaxNode? TryGetDocCommentNode(SyntaxTriviaList parameter);
src\Analyzers\Core\CodeFixes\DocumentationComments\AbstractRemoveDocCommentNodeCodeFixProvider.cs (1)
28protected abstract SyntaxTriviaList GetRevisedDocCommentTrivia(string docCommentText);
src\Analyzers\Core\CodeFixes\FileHeaders\AbstractFileHeaderCodeFixProvider.cs (5)
97var triviaList = root.GetLeadingTrivia(); 167var newHeaderTrivia = CreateNewHeader(syntaxFacts, leadingSpaces + fileHeaderHelper.CommentPrefix, expectedFileHeader, newLineTrivia.ToFullString()); 178var newTrivia = CreateNewHeader(syntaxFacts, fileHeaderHelper.CommentPrefix, expectedFileHeader, newLineTrivia.ToFullString()).Add(newLineTrivia).Add(newLineTrivia); 181var leadingTrivia = root.GetLeadingTrivia(); 200private static SyntaxTriviaList CreateNewHeader(ISyntaxFacts syntaxFacts, string prefixWithLeadingSpaces, string expectedFileHeader, string newLineText)
src\Analyzers\Core\CodeFixes\ImplementInterface\AbstractImplementInterfaceService.cs (2)
33protected abstract SyntaxNode AddCommentInsideIfStatement(SyntaxNode ifDisposingStatement, SyntaxTriviaList trivia); 72protected SyntaxTriviaList CreateCommentTrivia(
src\Analyzers\Core\CodeFixes\NewLines\MultipleBlankLines\AbstractMultipleBlankLinesCodeFixProvider.cs (3)
63private static SyntaxTriviaList UpdateLeadingTrivia(ISyntaxKindsService syntaxKinds, SyntaxTriviaList triviaList) 136private static bool IsEndOfLine(ISyntaxKindsService syntaxKinds, SyntaxTriviaList triviaList, int index)
src\Analyzers\Core\CodeFixes\RemoveUnusedParametersAndValues\AbstractRemoveUnusedValuesCodeFixProvider.cs (1)
713var leadingTrivia = insertionNode.GetLeadingTrivia();
src\Analyzers\Core\CodeFixes\UseCompoundAssignment\AbstractUseCompoundAssignmentCodeFixProvider.cs (2)
44protected abstract SyntaxTriviaList PrepareRightExpressionLeadingTrivia(SyntaxTriviaList initialTrivia);
Structure\Syntax\BlockSpanCollector.cs (1)
82private void GetOutliningSpans(SyntaxTriviaList triviaList, ArrayBuilder<BlockSpan> spans)
Wrapping\AbstractCodeActionComputer.cs (9)
53protected readonly SyntaxTriviaList NewLineTrivia; 54protected readonly SyntaxTriviaList SingleWhitespaceTrivia; 55protected readonly SyntaxTriviaList NoTrivia; 174using var _1 = PooledDictionary<SyntaxToken, SyntaxTriviaList>.GetInstance(out var leftTokenToTrailingTrivia); 175using var _2 = PooledDictionary<SyntaxToken, SyntaxTriviaList>.GetInstance(out var rightTokenToLeadingTrivia); 221Dictionary<SyntaxToken, SyntaxTriviaList> leftTokenToTrailingTrivia, 222Dictionary<SyntaxToken, SyntaxTriviaList> rightTokenToLeadingTrivia, 249if (leftTokenToTrailingTrivia.TryGetValue(oldToken, out var trailingTrivia)) 254if (rightTokenToLeadingTrivia.TryGetValue(oldToken, out var leadingTrivia))
Wrapping\BinaryExpression\AbstractBinaryExpressionWrapper.cs (2)
41protected abstract SyntaxTriviaList GetNewLineBeforeOperatorTrivia(SyntaxTriviaList newLine);
Wrapping\BinaryExpression\BinaryExpressionCodeActionComputer.cs (3)
32private readonly SyntaxTriviaList _newlineBeforeOperatorTrivia; 38private readonly SyntaxTriviaList _indentAndAlignTrivia; 44private readonly AsyncLazy<SyntaxTriviaList> _smartIndentTrivia;
Wrapping\ChainedExpression\AbstractChainedExpressionWrapper.cs (2)
71protected abstract SyntaxTriviaList GetNewLineBeforeOperatorTrivia(SyntaxTriviaList newLine);
Wrapping\ChainedExpression\ChainedExpressionCodeActionComputer.cs (3)
53private readonly SyntaxTriviaList _newlineBeforeOperatorTrivia; 59private readonly SyntaxTriviaList _firstPeriodIndentationTrivia; 65private readonly AsyncLazy<SyntaxTriviaList> _smartIndentTrivia;
Wrapping\Edit.cs (9)
19public readonly SyntaxTriviaList NewLeftTrailingTrivia; 20public readonly SyntaxTriviaList NewRightLeadingTrivia; 23SyntaxToken left, SyntaxTriviaList newLeftTrailingTrivia, 24SyntaxToken right, SyntaxTriviaList newRightLeadingTrivia) 43private static void AppendTrivia(PooledStringBuilder result, SyntaxTriviaList triviaList) 55=> UpdateBetween(left, default, default(SyntaxTriviaList), right); 58SyntaxNodeOrToken left, SyntaxTriviaList leftTrailingTrivia, 65SyntaxNodeOrToken left, SyntaxTriviaList leftTrailingTrivia, 66SyntaxTriviaList rightLeadingTrivia, SyntaxNodeOrToken right)
Microsoft.CodeAnalysis.UnitTests (13)
CommonSyntaxTests.cs (13)
113var csharpTriviaList = csharpToken.TrailingTrivia; 126var commonTriviaList = (SyntaxTriviaList)csharpTriviaList; 132var commonTriviaList2 = commonToken.TrailingTrivia; 140var csharpTriviaList2 = (SyntaxTriviaList)commonTriviaList; 150var vbTriviaList = (SyntaxTriviaList)vbToken.TrailingTrivia; 163var commonTriviaList = (SyntaxTriviaList)vbTriviaList; 169var commonTriviaList2 = commonToken.TrailingTrivia; 177var vbTriviaList2 = (SyntaxTriviaList)commonTriviaList;
Microsoft.CodeAnalysis.VisualBasic (92)
Binding\DocumentationCommentCrefBinder.vb (1)
44Dim triviaList As SyntaxTriviaList = reference.GetTrailingTrivia()
Generated\Syntax.xml.Main.Generated.vb (20)
41709Public Shared Function XmlNameToken(leadingTrivia As SyntaxTriviaList, text as String, possibleKeywordKind As SyntaxKind, trailingTrivia As SyntaxTriviaList) As SyntaxToken 41736Public Shared Function XmlTextLiteralToken(leadingTrivia As SyntaxTriviaList, text as String, value As String, trailingTrivia As SyntaxTriviaList) As SyntaxToken 41765Public Shared Function XmlEntityLiteralToken(leadingTrivia As SyntaxTriviaList, text as String, value As String, trailingTrivia As SyntaxTriviaList) As SyntaxToken 41794Public Shared Function DocumentationCommentLineBreakToken(leadingTrivia As SyntaxTriviaList, text as String, value As String, trailingTrivia As SyntaxTriviaList) As SyntaxToken 41828Public Shared Function XmlTextToken(leadingTrivia As SyntaxTriviaList, ByVal kind As SyntaxKind, text as String, value As String, trailingTrivia As SyntaxTriviaList) As SyntaxToken 41863Public Shared Function InterpolatedStringTextToken(leadingTrivia As SyntaxTriviaList, text as String, value As String, trailingTrivia As SyntaxTriviaList) As SyntaxToken 41888Public Shared Function DecimalLiteralToken(leadingTrivia As SyntaxTriviaList, text as String, typeSuffix As TypeCharacter, value As System.Decimal, trailingTrivia As SyntaxTriviaList) As SyntaxToken 41913Public Shared Function DateLiteralToken(leadingTrivia As SyntaxTriviaList, text as String, value As DateTime, trailingTrivia As SyntaxTriviaList) As SyntaxToken 41938Public Shared Function StringLiteralToken(leadingTrivia As SyntaxTriviaList, text as String, value As String, trailingTrivia As SyntaxTriviaList) As SyntaxToken 41963Public Shared Function CharacterLiteralToken(leadingTrivia As SyntaxTriviaList, text as String, value As Char, trailingTrivia As SyntaxTriviaList) As SyntaxToken
Syntax\SyntaxExtensions.vb (3)
19Public Function ToSyntaxTriviaList(sequence As IEnumerable(Of SyntaxTrivia)) As SyntaxTriviaList 44Public Function NormalizeWhitespace(trivia As SyntaxTriviaList, Optional indentation As String = Microsoft.CodeAnalysis.SyntaxNodeExtensions.DefaultIndentation, Optional eol As String = Microsoft.CodeAnalysis.SyntaxNodeExtensions.DefaultEOL, Optional elasticTrivia As Boolean = False, Optional useDefaultCasing As Boolean = False) As SyntaxTriviaList
Syntax\SyntaxFactory.vb (28)
78Private Shared ReadOnly s_elasticMarkerList As SyntaxTriviaList = SyntaxFactory.TriviaList(CType(InternalSyntax.SyntaxFactory.ElasticZeroSpace, SyntaxTrivia)) 190Return Token(kind, SyntaxTriviaList.Create(trailing), text) 193Public Shared Function Token(kind As SyntaxKind, trailing As SyntaxTriviaList, Optional text As String = Nothing) As SyntaxToken 198Public Shared Function Token(leading As SyntaxTriviaList, kind As SyntaxKind, Optional text As String = Nothing) As SyntaxToken 204Return Token(SyntaxTriviaList.Create(leading), kind, SyntaxTriviaList.Create(trailing), text) 207Public Shared Function Token(leading As SyntaxTriviaList, kind As SyntaxKind, trailing As SyntaxTriviaList, Optional text As String = Nothing) As SyntaxToken 229Public Shared Function Literal(leading As SyntaxTriviaList, text As String, value As Integer, trailing As SyntaxTriviaList) As SyntaxToken 253Public Shared Function Literal(leading As SyntaxTriviaList, text As String, value As UInteger, trailing As SyntaxTriviaList) As SyntaxToken 276Public Shared Function Literal(leading As SyntaxTriviaList, text As String, value As Long, trailing As SyntaxTriviaList) As SyntaxToken 299Public Shared Function Literal(leading As SyntaxTriviaList, text As String, value As ULong, trailing As SyntaxTriviaList) As SyntaxToken 322Public Shared Function Literal(leading As SyntaxTriviaList, text As String, value As Single, trailing As SyntaxTriviaList) As SyntaxToken 345Public Shared Function Literal(leading As SyntaxTriviaList, text As String, value As Double, trailing As SyntaxTriviaList) As SyntaxToken 368Public Shared Function Literal(leading As SyntaxTriviaList, text As String, value As Decimal, trailing As SyntaxTriviaList) As SyntaxToken 391Public Shared Function Literal(leading As SyntaxTriviaList, text As String, value As String, trailing As SyntaxTriviaList) As SyntaxToken 414Public Shared Function Literal(leading As SyntaxTriviaList, text As String, value As Char, trailing As SyntaxTriviaList) As SyntaxToken 847Public Shared Function XmlTextNewLine(text As String, value As String, leading As SyntaxTriviaList, trailing As SyntaxTriviaList) As SyntaxToken
Syntax\SyntaxFacts.vb (1)
207Dim trailingTrivia As SyntaxTriviaList = node.GetTrailingTrivia()
Syntax\SyntaxNodeFactories.vb (22)
103Public Shared Function ParseLeadingTrivia(text As String, Optional offset As Integer = 0) As SyntaxTriviaList 115Public Shared Function ParseTrailingTrivia(text As String, Optional offset As Integer = 0) As SyntaxTriviaList 316Public Shared Function IntegerLiteralToken(leadingTrivia As SyntaxTriviaList, text As String, base As LiteralBase, typeSuffix As TypeCharacter, value As ULong, trailingTrivia As SyntaxTriviaList) As SyntaxToken 328Public Shared Function FloatingLiteralToken(leadingTrivia As SyntaxTriviaList, text As String, typeSuffix As TypeCharacter, value As Double, trailingTrivia As SyntaxTriviaList) As SyntaxToken 341Return Identifier(SyntaxTriviaList.Create(leadingTrivia), text, isBracketed, identifierText, typeCharacter, SyntaxTriviaList.Create(trailingTrivia)) 344Public Shared Function Identifier(leadingTrivia As SyntaxTriviaList, text As String, isBracketed As Boolean, identifierText As String, typeCharacter As TypeCharacter, trailingTrivia As SyntaxTriviaList) As SyntaxToken 357Return Identifier(SyntaxTriviaList.Create(leadingTrivia), text, SyntaxTriviaList.Create(trailingTrivia)) 360Public Shared Function Identifier(leadingTrivia As SyntaxTriviaList, text As String, trailingTrivia As SyntaxTriviaList) As SyntaxToken 378Public Shared Function BracketedIdentifier(leadingTrivia As SyntaxTriviaList, text As String, trailingTrivia As SyntaxTriviaList) As SyntaxToken 748Public Shared Function BadToken(leadingTrivia As SyntaxTriviaList, text As String, trailingTrivia As SyntaxTriviaList) As SyntaxToken 828Public Shared Function TriviaList() As SyntaxTriviaList 836Public Shared Function TriviaList(trivia As SyntaxTrivia) As SyntaxTriviaList 844Public Shared Function TriviaList(ParamArray trivias As SyntaxTrivia()) As SyntaxTriviaList 852Public Shared Function TriviaList(trivias As IEnumerable(Of SyntaxTrivia)) As SyntaxTriviaList
Syntax\SyntaxNodeRemover.vb (3)
68Friend ReadOnly Property ResidualTrivia As SyntaxTriviaList 78Private Sub AddResidualTrivia(trivia As SyntaxTriviaList, Optional requiresNewLine As Boolean = False) 95Private Shared Function HasEndOfLine(trivia As SyntaxTriviaList) As Boolean
Syntax\SyntaxNormalizer.vb (5)
70Friend Shared Function Normalize(trivia As SyntaxTriviaList, indentWhitespace As String, eolWhitespace As String, useElasticTrivia As Boolean, useDefaultCasing As Boolean) As SyntaxTriviaList 72Dim result As SyntaxTriviaList = normalizer.RewriteTrivia(trivia, 182triviaList As SyntaxTriviaList, 188lineBreaksBefore As Integer) As SyntaxTriviaList
Syntax\SyntaxReplacer.vb (2)
388Public Overrides Function VisitList(list As SyntaxTriviaList) As SyntaxTriviaList
Syntax\VisualBasicSyntaxNode.vb (3)
165Public Shadows Function GetLeadingTrivia() As SyntaxTriviaList 177Public Shadows Function GetTrailingTrivia() As SyntaxTriviaList 247nodes As SyntaxTriviaList)
Syntax\VisualBasicSyntaxRewriter.vb (2)
190Public Overridable Function VisitList(list As SyntaxTriviaList) As SyntaxTriviaList
VisualBasicExtensions.vb (2)
121Public Function IndexOf(list As SyntaxTriviaList, kind As SyntaxKind) As Integer 131Public Function Any(list As SyntaxTriviaList, kind As SyntaxKind) As Boolean
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (25)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxNodeExtensions.vb (1)
389list As SyntaxTriviaList,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxTriviaListExtensions.vb (2)
12Public Function ContainsPreprocessorDirective(list As SyntaxTriviaList) As Boolean 17Public Function WithoutLeadingWhitespaceOrEndOfLine(list As IEnumerable(Of SyntaxTrivia)) As SyntaxTriviaList
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Helpers\RemoveUnnecessaryImports\VisualBasicRemoveUnnecessaryImportsRewriter.vb (2)
52Dim remainingTrivia As SyntaxTriviaList = Nothing 134Private Shared Function ShouldPreserveTrivia(trivia As SyntaxTriviaList) As Boolean
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Services\SyntaxFacts\VisualBasicSyntaxFacts.vb (1)
102Public Function ParseLeadingTrivia(text As String) As SyntaxTriviaList Implements ISyntaxFacts.ParseLeadingTrivia
src\Workspaces\VisualBasic\Portable\Formatting\DefaultOperationProvider.vb (2)
161Private Shared Function LastOrDefaultTrivia(triviaListPair As (SyntaxTriviaList, SyntaxTriviaList), predicate As Func(Of SyntaxTrivia, Boolean)) As SyntaxTrivia
src\Workspaces\VisualBasic\Portable\Formatting\Engine\Trivia\TriviaDataFactory.Analyzer.vb (1)
34Private Shared Sub Analyze(list As SyntaxTriviaList, ByRef result As AnalysisResult)
src\Workspaces\VisualBasic\Portable\Formatting\Engine\Trivia\TriviaDataFactory.ComplexTrivia.vb (1)
102Public Overrides Function GetTriviaList(cancellationToken As CancellationToken) As SyntaxTriviaList
src\Workspaces\VisualBasic\Portable\Formatting\Engine\Trivia\TriviaDataFactory.FormattedComplexTrivia.vb (1)
62Public Overrides Function GetTriviaList(cancellationToken As CancellationToken) As SyntaxTriviaList
src\Workspaces\VisualBasic\Portable\Formatting\Engine\Trivia\TriviaDataFactory.ModifiedComplexTrivia.vb (1)
93Public Overrides Function GetTriviaList(cancellationToken As CancellationToken) As SyntaxTriviaList
src\Workspaces\VisualBasic\Portable\Formatting\Engine\Trivia\TriviaDataFactory.TriviaRewriter.vb (12)
20Private ReadOnly _trailingTriviaMap As Dictionary(Of SyntaxToken, SyntaxTriviaList) 21Private ReadOnly _leadingTriviaMap As Dictionary(Of SyntaxToken, SyntaxTriviaList) 32_trailingTriviaMap = New Dictionary(Of SyntaxToken, SyntaxTriviaList)() 33_leadingTriviaMap = New Dictionary(Of SyntaxToken, SyntaxTriviaList)() 58Private Function GetTrailingAndLeadingTrivia(pair As KeyValuePair(Of ValueTuple(Of SyntaxToken, SyntaxToken), TriviaData)) As (SyntaxTriviaList, SyntaxTriviaList) 60Return (SyntaxTriviaList.Empty, 96Private Shared Function GetIndexForEndOfLeadingTrivia(triviaList As SyntaxTriviaList) As Integer 108Private Shared Function GetSyntaxTriviaList(textSpan As TextSpan, triviaData As TriviaData, cancellationToken As CancellationToken) As SyntaxTriviaList 142Dim triviaList As SyntaxTriviaList = Nothing 165Private Shared Function CreateNewToken(leadingTrivia As SyntaxTriviaList, token As SyntaxToken, trailingTrivia As SyntaxTriviaList) As SyntaxToken
src\Workspaces\VisualBasic\Portable\Formatting\Rules\AdjustSpaceFormattingRule.vb (1)
366Private Shared Function ContainsLineBreak(triviaList As SyntaxTriviaList) As Boolean
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (10)
src\Analyzers\VisualBasic\CodeFixes\DocumentationComments\VisualBasicRemoveDocCommentNodeCodeFixProvider.vb (1)
67Protected Overrides Function GetRevisedDocCommentTrivia(docCommentText As String) As SyntaxTriviaList
src\Analyzers\VisualBasic\CodeFixes\ImplementInterface\VisualBasicImplementInterfaceService.vb (1)
101Protected Overrides Function AddCommentInsideIfStatement(ifStatement As SyntaxNode, trivia As SyntaxTriviaList) As SyntaxNode
src\Analyzers\VisualBasic\CodeFixes\Iterator\VisualBasicConvertToIteratorCodeFixProvider.vb (1)
121newFunctionNode = methodStatementNode.WithLeadingTrivia(CType(Nothing, SyntaxTriviaList))
src\Analyzers\VisualBasic\CodeFixes\UseCompoundAssignment\VisualBasicUseCompoundAssignmentCodeFixProvider.vb (2)
41Protected Overrides Function PrepareRightExpressionLeadingTrivia(initialTrivia As SyntaxTriviaList) As SyntaxTriviaList
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\VisualBasicCodeGenerationService.vb (3)
376Dim triviaOfRemovedNode As SyntaxTriviaList = Nothing 410<Out> ByRef attributeRemoved As Boolean, <Out> ByRef positionOfRemovedNode As Integer, <Out> ByRef triviaOfRemovedNode As SyntaxTriviaList) As SyntaxList(Of AttributeListSyntax) 439<Out> ByRef attributeRemoved As Boolean, <Out> ByRef positionOfRemovedNode As Integer, <Out> ByRef triviaOfRemovedNode As SyntaxTriviaList) As SyntaxList(Of AttributesStatementSyntax)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ContextQuery\SyntaxTokenExtensions.vb (1)
24Private Function CheckTrivia(triviaList As SyntaxTriviaList, position As Integer, ByRef checkForSecondEol As Boolean, ByRef allowsImplicitLineContinuation As Boolean) As Boolean
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\MemberAccessExpressionSyntaxExtensions.vb (1)
23Private Function GetLeadingTriviaForSimplifiedMemberAccess(memberAccess As MemberAccessExpressionSyntax) As SyntaxTriviaList
Microsoft.CodeAnalysis.VisualBasic.Features (20)
CodeFixes\OverloadBase\OverloadBaseCodeFixProvider.AddKeywordAction.vb (1)
55Dim trivia As SyntaxTriviaList = node.GetLeadingTrivia()
CodeFixes\Suppression\VisualBasicSuppressionCodeFixProvider.vb (3)
28Protected Overrides Function CreatePragmaRestoreDirectiveTrivia(diagnostic As Diagnostic, formatNode As Func(Of SyntaxNode, CancellationToken, SyntaxNode), needsLeadingEndOfLine As Boolean, needsTrailingEndOfLine As Boolean, cancellationToken As CancellationToken) As SyntaxTriviaList 35Protected Overrides Function CreatePragmaDisableDirectiveTrivia(diagnostic As Diagnostic, formatNode As Func(Of SyntaxNode, CancellationToken, SyntaxNode), needsLeadingEndOfLine As Boolean, needsTrailingEndOfLine As Boolean, cancellationToken As CancellationToken) As SyntaxTriviaList 58cancellationToken As CancellationToken) As SyntaxTriviaList
CodeRefactorings\InlineTemporary\VisualBasicInlineTemporaryCodeRefactoringProvider.vb (2)
358expression:=expression.WithTrailingTrivia(CType(Nothing, SyntaxTriviaList)), 385explicitInitializer = explicitInitializer.ReplaceToken(lastToken, lastToken.WithTrailingTrivia(SyntaxTriviaList.Empty))
ConvertIfToSwitch\VisualBasicConvertIfToSwitchCodeRefactoringProvider.vb (1)
31Protected Overrides Function GetLeadingTriviaToTransfer(syntaxToRemove As SyntaxNode) As SyntaxTriviaList
FullyQualify\VisualBasicFullyQualifyService.vb (1)
63Dim newName = simpleName.WithLeadingTrivia(CType(Nothing, SyntaxTriviaList))
MetadataAsSource\VisualBasicMetadataAsSourceService.vb (1)
39SyntaxTriviaList.Create(SyntaxFactory.CarriageReturnLineFeed)))
src\Analyzers\VisualBasic\CodeFixes\DocumentationComments\VisualBasicRemoveDocCommentNodeCodeFixProvider.vb (1)
67Protected Overrides Function GetRevisedDocCommentTrivia(docCommentText As String) As SyntaxTriviaList
src\Analyzers\VisualBasic\CodeFixes\ImplementInterface\VisualBasicImplementInterfaceService.vb (1)
101Protected Overrides Function AddCommentInsideIfStatement(ifStatement As SyntaxNode, trivia As SyntaxTriviaList) As SyntaxNode
src\Analyzers\VisualBasic\CodeFixes\Iterator\VisualBasicConvertToIteratorCodeFixProvider.vb (1)
121newFunctionNode = methodStatementNode.WithLeadingTrivia(CType(Nothing, SyntaxTriviaList))
src\Analyzers\VisualBasic\CodeFixes\UseCompoundAssignment\VisualBasicUseCompoundAssignmentCodeFixProvider.vb (2)
41Protected Overrides Function PrepareRightExpressionLeadingTrivia(initialTrivia As SyntaxTriviaList) As SyntaxTriviaList
Structure\VisualBasicStructureHelpers.vb (2)
40Friend Function CreateCommentsRegions(triviaList As SyntaxTriviaList) As ImmutableArray(Of BlockSpan) 46Friend Sub CollectCommentsRegions(triviaList As SyntaxTriviaList,
Wrapping\BinaryExpression\VisualBasicBinaryExpressionWrapper.vb (2)
24Protected Overrides Function GetNewLineBeforeOperatorTrivia(newLine As SyntaxTriviaList) As SyntaxTriviaList
Wrapping\ChainedExpression\VisualBasicChainedExpressionWrapper.vb (2)
18Protected Overrides Function GetNewLineBeforeOperatorTrivia(newLine As SyntaxTriviaList) As SyntaxTriviaList
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (7)
Parser\ParseDirectives.vb (2)
2412Dim tt As SyntaxTriviaList = enableNode.GetTrailingTrivia 2505Dim tt As SyntaxTriviaList = enableNode.GetTrailingTrivia
TestSyntaxNodes.vb (5)
19Private ReadOnly _newlineTrivia As SyntaxTriviaList = SyntaxTriviaListBuilder.Create.Add(SyntaxFactory.WhitespaceTrivia(Environment.NewLine)).ToList 306Private Sub VerifyListSpans(list As SyntaxTriviaList, expectedFullSpan As TextSpan) 725tok = SyntaxFactory.Token(bldr.ToList, SyntaxKind.PlusToken, trailing:=SyntaxTriviaList.Create(white_b)) 801keyword = SyntaxFactory.Token(bldr.ToList, SyntaxKind.AndAlsoKeyword, SyntaxTriviaList.Create(SyntaxFactory.WhitespaceTrivia(" ")), "andalso") 1784SyntaxFactory.Token(Nothing, SyntaxKind.GreaterThanToken, trailing:=SyntaxTriviaList.Create(_spaceTrivia).Concat(_spaceTrivia).ToSyntaxTriviaList()))
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (2)
ParserTestUtilities.vb (2)
751Private Function TryFindNodeOrTokenInTrivia(triviaList As SyntaxTriviaList, kind As SyntaxKind, ByRef occurrence As Integer, ByRef foundNode As SyntaxNodeOrToken) As Boolean 832Private Sub InternalVerifyNoAdjacentTriviaHaveSameKind(node As SyntaxNodeOrToken, triviaList As SyntaxTriviaList)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (64)
Classification\Worker.DocumentationCommentClassifier.vb (1)
60Private Sub ClassifyXmlTrivia(trivialList As SyntaxTriviaList, Optional whitespaceClassificationType As String = Nothing)
Classification\Worker.vb (3)
109Public Sub ClassifyTrivia(triviaList As SyntaxTriviaList) 116Private Sub ClassifyTrivia(trivia As SyntaxTrivia, triviaList As SyntaxTriviaList) 157Private Sub ClassifyDisabledText(trivia As SyntaxTrivia, triviaList As SyntaxTriviaList)
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\NormalizeModifiersOrOperatorsCodeCleanupProvider.vb (1)
341triviaListGetter As Func(Of SyntaxToken, SyntaxTriviaList),
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))
CodeCleanup\Providers\RemoveUnnecessaryLineContinuationCodeCleanupProvider.vb (15)
50Private ReadOnly _leading As New Dictionary(Of SyntaxToken, SyntaxTriviaList) 51Private ReadOnly _trailing As New Dictionary(Of SyntaxToken, SyntaxTriviaList) 86Dim triviaList As SyntaxTriviaList = Nothing 273Private Shared Iterator Function RemoveConsecutiveColons(trivia As SyntaxTriviaList) As IEnumerable(Of SyntaxTrivia) 331Private Shared Function ContainsInapplicableTrivia(trivia As SyntaxTriviaList) As Boolean 341Private Function GetLeadingTrivia(token As SyntaxToken) As SyntaxTriviaList 345Private Function GetTrailingTrivia(token As SyntaxToken) As SyntaxTriviaList 350map As Dictionary(Of SyntaxToken, SyntaxTriviaList), 351defaultTrivia As SyntaxTriviaList) As SyntaxTriviaList 352Dim value As SyntaxTriviaList = Nothing 360Private Sub ReplaceTrailingTrivia(token As SyntaxToken, trivia As SyntaxTriviaList) 364Private Sub ReplaceLeadingTrivia(token As SyntaxToken, trivia As SyntaxTriviaList) 369map As Dictionary(Of SyntaxToken, SyntaxTriviaList), 370trivia As SyntaxTriviaList)
CodeGeneration\VisualBasicSyntaxGenerator.vb (3)
61Friend Overrides Function DocumentationCommentTrivia(nodes As IEnumerable(Of SyntaxNode), trailingTrivia As SyntaxTriviaList, endOfLineString As String) As SyntaxNode 3692Friend Overrides Function RemoveCommentLines(syntaxList As SyntaxTriviaList) As SyntaxTriviaList
Formatting\DefaultOperationProvider.vb (2)
161Private Shared Function LastOrDefaultTrivia(triviaListPair As (SyntaxTriviaList, SyntaxTriviaList), predicate As Func(Of SyntaxTrivia, Boolean)) As SyntaxTrivia
Formatting\Engine\Trivia\TriviaDataFactory.Analyzer.vb (1)
34Private Shared Sub Analyze(list As SyntaxTriviaList, ByRef result As AnalysisResult)
Formatting\Engine\Trivia\TriviaDataFactory.ComplexTrivia.vb (1)
102Public Overrides Function GetTriviaList(cancellationToken As CancellationToken) As SyntaxTriviaList
Formatting\Engine\Trivia\TriviaDataFactory.FormattedComplexTrivia.vb (1)
62Public Overrides Function GetTriviaList(cancellationToken As CancellationToken) As SyntaxTriviaList
Formatting\Engine\Trivia\TriviaDataFactory.ModifiedComplexTrivia.vb (1)
93Public Overrides Function GetTriviaList(cancellationToken As CancellationToken) As SyntaxTriviaList
Formatting\Engine\Trivia\TriviaDataFactory.TriviaRewriter.vb (12)
20Private ReadOnly _trailingTriviaMap As Dictionary(Of SyntaxToken, SyntaxTriviaList) 21Private ReadOnly _leadingTriviaMap As Dictionary(Of SyntaxToken, SyntaxTriviaList) 32_trailingTriviaMap = New Dictionary(Of SyntaxToken, SyntaxTriviaList)() 33_leadingTriviaMap = New Dictionary(Of SyntaxToken, SyntaxTriviaList)() 58Private Function GetTrailingAndLeadingTrivia(pair As KeyValuePair(Of ValueTuple(Of SyntaxToken, SyntaxToken), TriviaData)) As (SyntaxTriviaList, SyntaxTriviaList) 60Return (SyntaxTriviaList.Empty, 96Private Shared Function GetIndexForEndOfLeadingTrivia(triviaList As SyntaxTriviaList) As Integer 108Private Shared Function GetSyntaxTriviaList(textSpan As TextSpan, triviaData As TriviaData, cancellationToken As CancellationToken) As SyntaxTriviaList 142Dim triviaList As SyntaxTriviaList = Nothing 165Private Shared Function CreateNewToken(leadingTrivia As SyntaxTriviaList, token As SyntaxToken, trailingTrivia As SyntaxTriviaList) As SyntaxToken
Formatting\Rules\AdjustSpaceFormattingRule.vb (1)
366Private Shared Function ContainsLineBreak(triviaList As SyntaxTriviaList) As Boolean
Rename\VisualBasicRenameRewriterLanguageService.vb (2)
590Private Function RenameInStringLiteral(oldToken As SyntaxToken, newToken As SyntaxToken, subSpansToReplace As ImmutableSortedSet(Of TextSpan), createNewStringLiteral As Func(Of SyntaxTriviaList, String, String, SyntaxTriviaList, SyntaxToken)) As SyntaxToken
Simplification\VisualBasicSimplificationService.Expander.vb (3)
202.WithTrailingTrivia(SyntaxTriviaList.Empty) _ 266.WithLeadingTrivia(SyntaxTriviaList.Empty) _ 287.WithType(newObjectCreationExpression.Type.WithTrailingTrivia(SyntaxTriviaList.Empty)) _
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxNodeExtensions.vb (1)
389list As SyntaxTriviaList,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxTriviaListExtensions.vb (2)
12Public Function ContainsPreprocessorDirective(list As SyntaxTriviaList) As Boolean 17Public Function WithoutLeadingWhitespaceOrEndOfLine(list As IEnumerable(Of SyntaxTrivia)) As SyntaxTriviaList
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Helpers\RemoveUnnecessaryImports\VisualBasicRemoveUnnecessaryImportsRewriter.vb (2)
52Dim remainingTrivia As SyntaxTriviaList = Nothing 134Private Shared Function ShouldPreserveTrivia(trivia As SyntaxTriviaList) As Boolean
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Services\SyntaxFacts\VisualBasicSyntaxFacts.vb (1)
102Public Function ParseLeadingTrivia(text As String) As SyntaxTriviaList Implements ISyntaxFacts.ParseLeadingTrivia
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\VisualBasicCodeGenerationService.vb (3)
376Dim triviaOfRemovedNode As SyntaxTriviaList = Nothing 410<Out> ByRef attributeRemoved As Boolean, <Out> ByRef positionOfRemovedNode As Integer, <Out> ByRef triviaOfRemovedNode As SyntaxTriviaList) As SyntaxList(Of AttributeListSyntax) 439<Out> ByRef attributeRemoved As Boolean, <Out> ByRef positionOfRemovedNode As Integer, <Out> ByRef triviaOfRemovedNode As SyntaxTriviaList) As SyntaxList(Of AttributesStatementSyntax)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ContextQuery\SyntaxTokenExtensions.vb (1)
24Private Function CheckTrivia(triviaList As SyntaxTriviaList, position As Integer, ByRef checkForSecondEol As Boolean, ByRef allowsImplicitLineContinuation As Boolean) As Boolean
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\MemberAccessExpressionSyntaxExtensions.vb (1)
23Private Function GetLeadingTriviaForSimplifiedMemberAccess(memberAccess As MemberAccessExpressionSyntax) As SyntaxTriviaList
Microsoft.CodeAnalysis.Workspaces (51)
Classification\SyntaxClassification\AbstractSyntaxClassificationService.Worker.cs (1)
169private void ClassifyStructuredTrivia(SyntaxTriviaList triviaList)
Editing\SyntaxGenerator.cs (3)
1077internal abstract SyntaxTriviaList RemoveCommentLines(SyntaxTriviaList syntaxTriviaList); 2415internal abstract SyntaxNode DocumentationCommentTrivia(IEnumerable<SyntaxNode> nodes, SyntaxTriviaList trailingTrivia, string endOfLineString);
ObsoleteSymbol\AbstractObsoleteSymbolService.cs (1)
92static void ExtractStructureFromTrivia(ArrayBuilder<SyntaxNode> stack, SyntaxTriviaList triviaList)
src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (2)
92var leadingTrivia = root.GetLeadingTrivia(); 123var leadingTrivia = root.GetLeadingTrivia();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (10)
540private static readonly Func<SyntaxTriviaList, int, SyntaxToken> s_findSkippedTokenForward = FindSkippedTokenForward; 545private static SyntaxToken FindSkippedTokenForward(SyntaxTriviaList triviaList, int position) 570private static readonly Func<SyntaxTriviaList, int, SyntaxToken> s_findSkippedTokenBackward = FindSkippedTokenBackward; 575private static SyntaxToken FindSkippedTokenBackward(SyntaxTriviaList triviaList, int position) 702SyntaxTriviaList trivia) where T : SyntaxNode 716var list = new SyntaxTriviaList(); 736SyntaxTriviaList trivia) where T : SyntaxNode 750var list = new SyntaxTriviaList(); 769return token.WithLeadingTrivia(default(SyntaxTriviaList)); 777return token.WithTrailingTrivia(default(SyntaxTriviaList));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTokenExtensions.cs (4)
110public static SyntaxToken With(this SyntaxToken token, SyntaxTriviaList leading, SyntaxTriviaList trailing) 127SyntaxTriviaList trivia) 141var list = new SyntaxTriviaList();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs (1)
146var triviaList = compilationUnit.EndOfFileToken.LeadingTrivia;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTriviaListExtensions.cs (2)
11public static SyntaxTrivia? FirstOrNull(this SyntaxTriviaList triviaList, Func<SyntaxTrivia, bool> predicate) 24public static SyntaxTrivia LastOrDefault(this SyntaxTriviaList triviaList)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaDataWithList.cs (1)
11public abstract SyntaxTriviaList GetTriviaList(CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
61public static bool HasAnyWhitespaceElasticTrivia(this SyntaxTriviaList list)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
238public SyntaxTriviaList FormatToSyntaxTrivia(CancellationToken cancellationToken) 260private static void AddRange(ArrayBuilder<SyntaxTrivia> result, SyntaxTriviaList triviaList)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\TriviaHelpers.cs (2)
11public static SyntaxTriviaList CreateTriviaListFromTo(SyntaxTriviaList triviaList, int startIndex, int endIndex)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\TriviaList.cs (7)
7internal readonly struct TriviaList(SyntaxTriviaList list1, SyntaxTriviaList list2) 9private readonly SyntaxTriviaList _list1 = list1; 10private readonly SyntaxTriviaList _list2 = list2; 22private readonly SyntaxTriviaList _list1; 23private readonly SyntaxTriviaList _list2; 25private SyntaxTriviaList.Enumerator _enumerator;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (2)
112var leadingTrivia = node.GetLeadingTrivia(); 174var leadingTrivia = firstToken.LeadingTrivia;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\AbstractDocumentationCommentService.cs (1)
54var leadingTrivia = documentationComment.GetLeadingTrivia();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFacts.cs (1)
106SyntaxTriviaList ParseLeadingTrivia(string text);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (2)
119private static bool IsOnSingleLine(ISyntaxFacts syntaxFacts, SyntaxTriviaList triviaList, bool checkTrivia) 246private static bool SpansPreprocessorDirective(this ISyntaxFacts syntaxFacts, SyntaxTriviaList list)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService.cs (5)
507var leading = attributeList.GetLeadingTrivia(); 508var trailing = attributeList.GetTrailingTrivia(); 529var leading = isComma(previousToken) ? previousToken.LeadingTrivia : attributeToRemove.GetLeadingTrivia(); 531var trailing = isComma(nextToken) ? nextToken.TrailingTrivia : attributeToRemove.GetTrailingTrivia(); 535protected static T AppendTriviaAtPosition<T>(T node, int position, SyntaxTriviaList trivia)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\AddImports\AddImportHelpers.cs (3)
51var trailingTrivia = newImports[i].GetTrailingTrivia(); 65var originalFirstUsingTrailingTrivia = originalFirstUsing.GetTrailingTrivia(); 88var trailingTrivia = newImports[i].GetTrailingTrivia();
Microsoft.Gen.Logging (1)
Parsing\Parser.cs (1)
457var triviaList = method.GetLeadingTrivia();
Microsoft.Interop.SourceGeneration (2)
GeneratedStatements.cs (2)
83SyntaxTriviaList newLeadingTrivia = GenerateStageTrivia(context.CurrentStage); 175private static SyntaxTriviaList GenerateStageTrivia(StubIdentifierContext.Stage stage)
Microsoft.VisualStudio.LanguageServices.CSharp (12)
CodeModel\CSharpCodeModelService.cs (9)
1293var newTriviaList = SyntaxFactory.ParseLeadingTrivia(commentText); 1426var newTriviaList = SyntaxFactory.ParseLeadingTrivia(builder.ToString()); 2780var trailingTrivia = node.GetTrailingTrivia(); 3240var trailingTrivia = lastMember.GetTrailingTrivia(); 3241enumDeclaration = enumDeclaration.ReplaceNode(lastMember, lastMember.WithTrailingTrivia(SyntaxTriviaList.Empty)); 3292var triviaList = nextToken.LeadingTrivia; 3298.ReplaceToken(nextToken, nextToken.WithLeadingTrivia(SyntaxTriviaList.Empty)); 3352var trivia = firstToken.LeadingTrivia; 3354container = container.ReplaceToken(firstToken, firstToken.WithLeadingTrivia(SyntaxTriviaList.Empty));
CodeModel\MethodXml\MethodXmlBuilder.cs (1)
37private void GenerateComments(SyntaxTriviaList triviaList)
CodeModel\ModifierFlagsExtensions.cs (2)
108var leadingTrivia = member.GetLeadingTrivia(); 109member = member.WithLeadingTrivia(SyntaxTriviaList.Empty);
Microsoft.VisualStudio.LanguageServices.VisualBasic (24)
CodeModel\VisualBasicCodeModelService.vb (24)
2503Dim triviaList = CType(Nothing, SyntaxTriviaList) 2978.WithLeadingTrivia(SyntaxTriviaList.Empty) _ 2979.WithTrailingTrivia(SyntaxTriviaList.Empty) 3031.WithLeadingTrivia(SyntaxTriviaList.Empty) _ 3032.WithTrailingTrivia(SyntaxTriviaList.Empty) 3069.WithLeadingTrivia(SyntaxTriviaList.Empty) _ 3070.WithTrailingTrivia(SyntaxTriviaList.Empty) 3142.WithLeadingTrivia(SyntaxTriviaList.Empty) _ 3143.WithTrailingTrivia(SyntaxTriviaList.Empty) 3198.WithLeadingTrivia(SyntaxTriviaList.Empty) _ 3199.WithTrailingTrivia(SyntaxTriviaList.Empty) 3252.WithLeadingTrivia(SyntaxTriviaList.Empty) _ 3253.WithTrailingTrivia(SyntaxTriviaList.Empty) 3285.WithLeadingTrivia(SyntaxTriviaList.Empty) _ 3286.WithTrailingTrivia(SyntaxTriviaList.Empty) 3314.WithLeadingTrivia(SyntaxTriviaList.Empty) _ 3315.WithTrailingTrivia(SyntaxTriviaList.Empty) 3343.WithLeadingTrivia(SyntaxTriviaList.Empty) _ 3344.WithTrailingTrivia(SyntaxTriviaList.Empty) 3397.WithLeadingTrivia(SyntaxTriviaList.Empty) _ 3398.WithTrailingTrivia(SyntaxTriviaList.Empty) 3567variableDeclarator = variableDeclarator.WithTrailingTrivia(SyntaxTriviaList.Empty) 3589enumMemberDeclaration = enumMemberDeclaration.WithTrailingTrivia(SyntaxTriviaList.Empty) 3819container = container.ReplaceToken(firstToken, firstToken.WithLeadingTrivia(SyntaxTriviaList.Empty))
System.Windows.Forms.Analyzers.CodeFixes.CSharp (2)
System\Windows\Forms\CSharp\CodeFixes\AddDesignerSerializationVisibility\AddDesignerSerializationVisibilityCodeFixProvider.cs (2)
85SyntaxTriviaList leadingTrivia = propertyDeclarationSyntax.GetLeadingTrivia(); 125SyntaxTriviaList? firstNodesLeadingTrivia = compilationUnit
System.Windows.Forms.Analyzers.CodeFixes.VisualBasic (2)
AddDesignerSerializationVisibility\AddDesignerSerializationVisibilityCodeFixProvider.vb (2)
93Dim leadingTrivia As SyntaxTriviaList = propertyDeclarationSyntax.GetLeadingTrivia() 139Dim firstNodesLeadingTrivia As SyntaxTriviaList? = compilationUnit.