561 references to GetFirstToken
GenerateDocumentationAndConfigFiles (19)
src\RoslynAnalyzers\Utilities\Compiler\DoNotCatchGeneralUnlessRethrown.cs (1)
82
operationBlockAnalysisContext.ReportDiagnostic(CreateDiagnostic(method, catchClause.Syntax.
GetFirstToken
()));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs (1)
126
var firstToken = root.
GetFirstToken
(includeZeroWidth: true, includeSkipped: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (1)
111
startToken: _rootNode.
GetFirstToken
(includeZeroWidth: true),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.cs (1)
43
_firstToken = Root.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.Node.cs (1)
17
Contract.ThrowIfFalse(root.
GetFirstToken
(includeZeroWidth: true).RawKind != 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (2)
282
? (childNode.
GetFirstToken
(includeZeroWidth: true), childNode.GetLastToken(includeZeroWidth: true))
368
if (conditionStatement.
GetFirstToken
() == indentationAnchor)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (1)
486
var firstToken = trivia2.GetStructure()!.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (1)
169
return GetFileBanner(root.
GetFirstToken
(includeZeroWidth: true));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SelectedMembers\AbstractSelectedMembers.cs (1)
167
if (token == member.
GetFirstToken
() &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (2)
357
var previousToken = node.
GetFirstToken
().GetPreviousToken();
360
syntaxFacts.IsWordOrNumber(resultNode.
GetFirstToken
()))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\CommonFormattingHelpers.cs (1)
119
startToken = (startToken.RawKind != 0) ? startToken : root.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService_FindDeclaration.cs (1)
49
var start = node.
GetFirstToken
();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\AddParameterEditor.cs (3)
55
var previousToken = firstParameter.
GetFirstToken
().GetPreviousToken();
57
if (sourceText.AreOnSameLine(previousToken, firstParameter.
GetFirstToken
()))
165
if (text.AreOnSameLine(lastParameter.GetLastToken(), thisParameter.
GetFirstToken
()))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\AddImports\AddImportHelpers.cs (1)
35
var firstToken = root.
GetFirstToken
();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.State.cs (1)
171
var previousToken = FirstStatementAffectedInInnermostBlock.
GetFirstToken
().GetPreviousToken();
Metrics (13)
src\RoslynAnalyzers\Utilities\Compiler\DoNotCatchGeneralUnlessRethrown.cs (1)
82
operationBlockAnalysisContext.ReportDiagnostic(CreateDiagnostic(method, catchClause.Syntax.
GetFirstToken
()));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs (1)
126
var firstToken = root.
GetFirstToken
(includeZeroWidth: true, includeSkipped: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (1)
111
startToken: _rootNode.
GetFirstToken
(includeZeroWidth: true),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.cs (1)
43
_firstToken = Root.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.Node.cs (1)
17
Contract.ThrowIfFalse(root.
GetFirstToken
(includeZeroWidth: true).RawKind != 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (2)
282
? (childNode.
GetFirstToken
(includeZeroWidth: true), childNode.GetLastToken(includeZeroWidth: true))
368
if (conditionStatement.
GetFirstToken
() == indentationAnchor)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (1)
486
var firstToken = trivia2.GetStructure()!.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (1)
169
return GetFileBanner(root.
GetFirstToken
(includeZeroWidth: true));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SelectedMembers\AbstractSelectedMembers.cs (1)
167
if (token == member.
GetFirstToken
() &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (2)
357
var previousToken = node.
GetFirstToken
().GetPreviousToken();
360
syntaxFacts.IsWordOrNumber(resultNode.
GetFirstToken
()))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\CommonFormattingHelpers.cs (1)
119
startToken = (startToken.RawKind != 0) ? startToken : root.
GetFirstToken
(includeZeroWidth: true);
Metrics.Legacy (13)
src\RoslynAnalyzers\Utilities\Compiler\DoNotCatchGeneralUnlessRethrown.cs (1)
82
operationBlockAnalysisContext.ReportDiagnostic(CreateDiagnostic(method, catchClause.Syntax.
GetFirstToken
()));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs (1)
126
var firstToken = root.
GetFirstToken
(includeZeroWidth: true, includeSkipped: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (1)
111
startToken: _rootNode.
GetFirstToken
(includeZeroWidth: true),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.cs (1)
43
_firstToken = Root.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.Node.cs (1)
17
Contract.ThrowIfFalse(root.
GetFirstToken
(includeZeroWidth: true).RawKind != 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (2)
282
? (childNode.
GetFirstToken
(includeZeroWidth: true), childNode.GetLastToken(includeZeroWidth: true))
368
if (conditionStatement.
GetFirstToken
() == indentationAnchor)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (1)
486
var firstToken = trivia2.GetStructure()!.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (1)
169
return GetFileBanner(root.
GetFirstToken
(includeZeroWidth: true));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SelectedMembers\AbstractSelectedMembers.cs (1)
167
if (token == member.
GetFirstToken
() &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (2)
357
var previousToken = node.
GetFirstToken
().GetPreviousToken();
360
syntaxFacts.IsWordOrNumber(resultNode.
GetFirstToken
()))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\CommonFormattingHelpers.cs (1)
119
startToken = (startToken.RawKind != 0) ? startToken : root.
GetFirstToken
(includeZeroWidth: true);
Microsoft.AspNetCore.App.CodeFixes (1)
RouteParameterUnusedParameterFixer.cs (1)
62
var token = param.
GetFirstToken
();
Microsoft.CodeAnalysis (3)
Syntax\SyntaxNode.cs (1)
1068
return
GetFirstToken
(includeZeroWidth: true).LeadingTrivia;
Syntax\SyntaxNodeExtensions.cs (2)
362
var first = node.
GetFirstToken
(includeZeroWidth: true);
374
var first = node.
GetFirstToken
(includeZeroWidth: true);
Microsoft.CodeAnalysis.Analyzers (19)
src\RoslynAnalyzers\Utilities\Compiler\DoNotCatchGeneralUnlessRethrown.cs (1)
82
operationBlockAnalysisContext.ReportDiagnostic(CreateDiagnostic(method, catchClause.Syntax.
GetFirstToken
()));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs (1)
126
var firstToken = root.
GetFirstToken
(includeZeroWidth: true, includeSkipped: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (1)
111
startToken: _rootNode.
GetFirstToken
(includeZeroWidth: true),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.cs (1)
43
_firstToken = Root.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.Node.cs (1)
17
Contract.ThrowIfFalse(root.
GetFirstToken
(includeZeroWidth: true).RawKind != 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (2)
282
? (childNode.
GetFirstToken
(includeZeroWidth: true), childNode.GetLastToken(includeZeroWidth: true))
368
if (conditionStatement.
GetFirstToken
() == indentationAnchor)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (1)
486
var firstToken = trivia2.GetStructure()!.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (1)
169
return GetFileBanner(root.
GetFirstToken
(includeZeroWidth: true));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SelectedMembers\AbstractSelectedMembers.cs (1)
167
if (token == member.
GetFirstToken
() &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (2)
357
var previousToken = node.
GetFirstToken
().GetPreviousToken();
360
syntaxFacts.IsWordOrNumber(resultNode.
GetFirstToken
()))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\CommonFormattingHelpers.cs (1)
119
startToken = (startToken.RawKind != 0) ? startToken : root.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService_FindDeclaration.cs (1)
49
var start = node.
GetFirstToken
();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\AddParameterEditor.cs (3)
55
var previousToken = firstParameter.
GetFirstToken
().GetPreviousToken();
57
if (sourceText.AreOnSameLine(previousToken, firstParameter.
GetFirstToken
()))
165
if (text.AreOnSameLine(lastParameter.GetLastToken(), thisParameter.
GetFirstToken
()))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\AddImports\AddImportHelpers.cs (1)
35
var firstToken = root.
GetFirstToken
();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.State.cs (1)
171
var previousToken = FirstStatementAffectedInInnermostBlock.
GetFirstToken
().GetPreviousToken();
Microsoft.CodeAnalysis.AnalyzerUtilities (13)
src\RoslynAnalyzers\Utilities\Compiler\DoNotCatchGeneralUnlessRethrown.cs (1)
82
operationBlockAnalysisContext.ReportDiagnostic(CreateDiagnostic(method, catchClause.Syntax.
GetFirstToken
()));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs (1)
126
var firstToken = root.
GetFirstToken
(includeZeroWidth: true, includeSkipped: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (1)
111
startToken: _rootNode.
GetFirstToken
(includeZeroWidth: true),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.cs (1)
43
_firstToken = Root.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.Node.cs (1)
17
Contract.ThrowIfFalse(root.
GetFirstToken
(includeZeroWidth: true).RawKind != 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (2)
282
? (childNode.
GetFirstToken
(includeZeroWidth: true), childNode.GetLastToken(includeZeroWidth: true))
368
if (conditionStatement.
GetFirstToken
() == indentationAnchor)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (1)
486
var firstToken = trivia2.GetStructure()!.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (1)
169
return GetFileBanner(root.
GetFirstToken
(includeZeroWidth: true));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SelectedMembers\AbstractSelectedMembers.cs (1)
167
if (token == member.
GetFirstToken
() &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (2)
357
var previousToken = node.
GetFirstToken
().GetPreviousToken();
360
syntaxFacts.IsWordOrNumber(resultNode.
GetFirstToken
()))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\CommonFormattingHelpers.cs (1)
119
startToken = (startToken.RawKind != 0) ? startToken : root.
GetFirstToken
(includeZeroWidth: true);
Microsoft.CodeAnalysis.BannedApiAnalyzers (19)
src\RoslynAnalyzers\Utilities\Compiler\DoNotCatchGeneralUnlessRethrown.cs (1)
82
operationBlockAnalysisContext.ReportDiagnostic(CreateDiagnostic(method, catchClause.Syntax.
GetFirstToken
()));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs (1)
126
var firstToken = root.
GetFirstToken
(includeZeroWidth: true, includeSkipped: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (1)
111
startToken: _rootNode.
GetFirstToken
(includeZeroWidth: true),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.cs (1)
43
_firstToken = Root.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.Node.cs (1)
17
Contract.ThrowIfFalse(root.
GetFirstToken
(includeZeroWidth: true).RawKind != 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (2)
282
? (childNode.
GetFirstToken
(includeZeroWidth: true), childNode.GetLastToken(includeZeroWidth: true))
368
if (conditionStatement.
GetFirstToken
() == indentationAnchor)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (1)
486
var firstToken = trivia2.GetStructure()!.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (1)
169
return GetFileBanner(root.
GetFirstToken
(includeZeroWidth: true));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SelectedMembers\AbstractSelectedMembers.cs (1)
167
if (token == member.
GetFirstToken
() &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (2)
357
var previousToken = node.
GetFirstToken
().GetPreviousToken();
360
syntaxFacts.IsWordOrNumber(resultNode.
GetFirstToken
()))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\CommonFormattingHelpers.cs (1)
119
startToken = (startToken.RawKind != 0) ? startToken : root.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService_FindDeclaration.cs (1)
49
var start = node.
GetFirstToken
();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\AddParameterEditor.cs (3)
55
var previousToken = firstParameter.
GetFirstToken
().GetPreviousToken();
57
if (sourceText.AreOnSameLine(previousToken, firstParameter.
GetFirstToken
()))
165
if (text.AreOnSameLine(lastParameter.GetLastToken(), thisParameter.
GetFirstToken
()))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\AddImports\AddImportHelpers.cs (1)
35
var firstToken = root.
GetFirstToken
();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.State.cs (1)
171
var previousToken = FirstStatementAffectedInInnermostBlock.
GetFirstToken
().GetPreviousToken();
Microsoft.CodeAnalysis.CodeStyle (26)
src\Analyzers\Core\Analyzers\FileHeaders\AbstractFileHeaderHelper.cs (1)
35
var firstToken = root.
GetFirstToken
(includeZeroWidth: true);
src\Analyzers\Core\Analyzers\ForEachCast\AbstractForEachCastDiagnosticAnalyzer.cs (2)
146
node.
GetFirstToken
().GetLocation(),
151
node.
GetFirstToken
().ToString(),
src\Analyzers\Core\Analyzers\NewLines\ConsecutiveStatementPlacement\AbstractConsecutiveStatementPlacementDiagnosticAnalyzer.cs (1)
88
if (nextToken != nextTokenContainingStatement.
GetFirstToken
())
src\Analyzers\Core\Analyzers\PopulateSwitch\AbstractPopulateSwitchStatementDiagnosticAnalyzer.cs (1)
38
=> switchBlock.
GetFirstToken
().GetLocation();
src\Analyzers\Core\Analyzers\RemoveUnnecessaryImports\AbstractRemoveUnnecessaryImportsDiagnosticAnalyzer.cs (1)
158
if (lastToken.GetNextToken(includeDirectives: true) == node.
GetFirstToken
())
src\Analyzers\Core\Analyzers\RemoveUnnecessaryParentheses\AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer.cs (1)
114
parenthesizedExpression.
GetFirstToken
().GetLocation(),
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (1)
740
var firstToken = memberDeclaration.
GetFirstToken
();
src\Analyzers\Core\Analyzers\SimplifyInterpolation\AbstractSimplifyInterpolationHelpers.cs (1)
152
.Subtract(GetSpanWithinLiteralQuotes(virtualCharService, literal.Syntax.
GetFirstToken
())));
src\Analyzers\Core\Analyzers\UseCoalesceExpression\AbstractUseCoalesceExpressionForIfNullCheckDiagnosticAnalyzer.cs (1)
114
ifStatement.
GetFirstToken
().GetLocation(),
src\Analyzers\Core\Analyzers\UseCollectionInitializer\AbstractUseCollectionInitializerDiagnosticAnalyzer.cs (1)
192
objectCreationExpression.
GetFirstToken
().GetLocation(),
src\Analyzers\Core\Analyzers\UseConditionalExpression\AbstractUseConditionalExpressionDiagnosticAnalyzer.cs (1)
54
ifStatement.
GetFirstToken
().GetLocation(),
src\Analyzers\Core\Analyzers\UseNullPropagation\AbstractUseNullPropagationDiagnosticAnalyzer_IfStatement.cs (1)
49
ifStatement.
GetFirstToken
().GetLocation(),
src\Analyzers\Core\Analyzers\UseObjectInitializer\AbstractUseObjectInitializerDiagnosticAnalyzer.cs (1)
129
objectCreationExpression.
GetFirstToken
().GetLocation(),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs (1)
126
var firstToken = root.
GetFirstToken
(includeZeroWidth: true, includeSkipped: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (1)
111
startToken: _rootNode.
GetFirstToken
(includeZeroWidth: true),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.cs (1)
43
_firstToken = Root.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.Node.cs (1)
17
Contract.ThrowIfFalse(root.
GetFirstToken
(includeZeroWidth: true).RawKind != 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (2)
282
? (childNode.
GetFirstToken
(includeZeroWidth: true), childNode.GetLastToken(includeZeroWidth: true))
368
if (conditionStatement.
GetFirstToken
() == indentationAnchor)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (1)
486
var firstToken = trivia2.GetStructure()!.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (1)
169
return GetFileBanner(root.
GetFirstToken
(includeZeroWidth: true));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SelectedMembers\AbstractSelectedMembers.cs (1)
167
if (token == member.
GetFirstToken
() &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (2)
357
var previousToken = node.
GetFirstToken
().GetPreviousToken();
360
syntaxFacts.IsWordOrNumber(resultNode.
GetFirstToken
()))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\CommonFormattingHelpers.cs (1)
119
startToken = (startToken.RawKind != 0) ? startToken : root.
GetFirstToken
(includeZeroWidth: true);
Microsoft.CodeAnalysis.CodeStyle.Fixes (10)
src\Analyzers\Core\CodeFixes\UseConditionalExpression\AbstractUseConditionalExpressionCodeFixProvider.cs (3)
159
if (!sourceText.AreOnSameLine(condition.
GetFirstToken
(), condition.GetLastToken()) ||
160
!sourceText.AreOnSameLine(trueSyntax.
GetFirstToken
(), trueSyntax.GetLastToken()) ||
161
!sourceText.AreOnSameLine(falseSyntax.
GetFirstToken
(), falseSyntax.GetLastToken()))
src\Analyzers\Core\CodeFixes\UseObjectInitializer\AbstractUseObjectInitializerCodeFixProvider.cs (1)
83
var firstToken = objectCreation.
GetFirstToken
();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService_FindDeclaration.cs (1)
49
var start = node.
GetFirstToken
();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\AddParameterEditor.cs (3)
55
var previousToken = firstParameter.
GetFirstToken
().GetPreviousToken();
57
if (sourceText.AreOnSameLine(previousToken, firstParameter.
GetFirstToken
()))
165
if (text.AreOnSameLine(lastParameter.GetLastToken(), thisParameter.
GetFirstToken
()))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\AddImports\AddImportHelpers.cs (1)
35
var firstToken = root.
GetFirstToken
();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.State.cs (1)
171
var previousToken = FirstStatementAffectedInInnermostBlock.
GetFirstToken
().GetPreviousToken();
Microsoft.CodeAnalysis.CSharp (10)
Binder\Binder_Expressions.cs (1)
4653
MessageID.IDS_FeatureNestedStackalloc.CheckFeatureAvailability(diagnostics, node.
GetFirstToken
());
Binder\Binder_Invocation.cs (1)
1421
_ => syntax.
GetFirstToken
()
BoundTree\BoundTreeVisitors.cs (1)
192
return syntax.
GetFirstToken
().GetLocation();
Compilation\CSharpSemanticModel.cs (1)
1321
SyntaxToken firstToken = node.
GetFirstToken
(includeZeroWidth: false);
FlowAnalysis\ControlFlowPass.cs (4)
218
var loc = new SourceLocation(leave.Syntax.
GetFirstToken
());
226
var loc = new SourceLocation(leave.Syntax.
GetFirstToken
());
267
var firstToken = statement.Syntax.
GetFirstToken
();
303
var location = new SourceLocation(branch.Branch.Syntax.
GetFirstToken
());
Syntax\CSharpSyntaxNode.cs (1)
321
return base.
GetFirstToken
(includeZeroWidth, includeSkipped, includeDirectives, includeDocumentationComments);
Syntax\LookupPosition.cs (1)
502
firstIncluded = lambdaExpressionOrQueryNode.
GetFirstToken
().GetNextToken();
Microsoft.CodeAnalysis.CSharp.CodeStyle (49)
src\Analyzers\CSharp\Analyzers\AddBraces\CSharpAddBracesDiagnosticAnalyzer.cs (5)
108
var firstToken = statement.
GetFirstToken
();
161
if (FormattingRangeHelper.AreTwoTokensOnSameLine(statement.
GetFirstToken
(), statement.GetLastToken()))
172
var lastTokenBeforeEmbeddedStatement = embeddedStatement.
GetFirstToken
().GetPreviousToken();
173
if (!FormattingRangeHelper.AreTwoTokensOnSameLine(statement.
GetFirstToken
(), lastTokenBeforeEmbeddedStatement))
185
if (!FormattingRangeHelper.AreTwoTokensOnSameLine(embeddedStatement.
GetFirstToken
(), embeddedStatement.GetLastToken()))
src\Analyzers\CSharp\Analyzers\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionDiagnosticAnalyzer.cs (1)
69
location: switchStatement.
GetFirstToken
().GetLocation(),
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (1)
754
var newKeyword = parent.
GetFirstToken
();
src\Analyzers\CSharp\Analyzers\UseUtf8StringLiteral\UseUtf8StringLiteralDiagnosticAnalyzer.cs (1)
132
var location = syntaxNode.
GetFirstToken
().GetLocation();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (1)
63
=> node.
GetFirstToken
().GetAllPrecedingTriviaToPreviousToken(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\CSharpStructuredTriviaFormatEngine.cs (1)
23
var formatter = new CSharpStructuredTriviaFormatEngine(trivia, initialColumn, options, formattingRules, root.
GetFirstToken
(includeZeroWidth: true), root.GetLastToken(includeZeroWidth: true));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\FormattingHelpers.cs (1)
113
return token.Parent.Parent.
GetFirstToken
() != token;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\AnchorIndentationFormattingRule.cs (2)
44
block.Parent.
GetFirstToken
(includeZeroWidth: true),
91
=> AddAnchorIndentationOperation(list, node.
GetFirstToken
(includeZeroWidth: true), node.GetLastToken(includeZeroWidth: true));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\BaseFormattingRule.cs (2)
158
var firstTokenOfNode = node.
GetFirstToken
(includeZeroWidth: true);
170
firstTokenOfNode = node.Parent.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\IndentBlockFormattingRule.cs (6)
65
var baseToken = declaringNode.
GetFirstToken
();
66
AddIndentBlockOperation(list, baseToken, node.
GetFirstToken
(), node.GetLastToken());
185
var baseTokenForAlignment = recursivePatternParent.
GetFirstToken
();
204
var baseToken = baseNode.
GetFirstToken
(includeZeroWidth: true);
205
var firstToken = body.
GetFirstToken
(includeZeroWidth: true);
275
var firstToken = node.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SpacingFormattingRule.cs (1)
589
var firstToken = node.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (5)
83
AddSuppressWrappingIfOnSingleLineOperation(list, node.
GetFirstToken
(), node.GetLastToken());
91
AddSuppressWrappingIfOnSingleLineOperation(list, node.
GetFirstToken
(), node.GetLastToken());
207
node.
GetFirstToken
(includeZeroWidth: true),
394
AddSuppressWrappingIfOnSingleLineOperation(list, parent.
GetFirstToken
(includeZeroWidth: true), parent.GetLastToken(includeZeroWidth: true));
399
var firstToken = item.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\WrappingFormattingRule.cs (2)
141
var firstTokenOfNode = node.
GetFirstToken
(includeZeroWidth: true);
146
firstTokenOfNode = node.Parent!.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\FormattingRangeHelper.cs (20)
93
return (GetAppropriatePreviousToken(parent.
GetFirstToken
()), parent.GetLastToken());
115
return (GetAppropriatePreviousToken(parent.
GetFirstToken
(), canTokenBeFirstInABlock: true), parent.GetLastToken());
129
return (GetAppropriatePreviousToken(parent.
GetFirstToken
(), canTokenBeFirstInABlock: true), parent.GetLastToken());
136
return (GetAppropriatePreviousToken(parent.
GetFirstToken
()), parent.GetLastToken());
139
return (GetAppropriatePreviousToken(container.
GetFirstToken
()), container.GetLastToken());
141
return (GetAppropriatePreviousToken(parent.
GetFirstToken
(), canTokenBeFirstInABlock: true), parent.GetLastToken());
160
return ValueTuple.Create(GetAppropriatePreviousToken(parent.
GetFirstToken
()), parent.GetLastToken());
170
return ValueTuple.Create(GetAppropriatePreviousToken(parent.
GetFirstToken
()), parent.GetLastToken());
173
return ValueTuple.Create(containerOfList.
GetFirstToken
(), containerOfList.GetLastToken());
178
return ValueTuple.Create(parent.
GetFirstToken
(), parent.GetLastToken());
186
return ValueTuple.Create(GetAppropriatePreviousToken(parent.
GetFirstToken
()), parent.GetLastToken());
195
var firstTokenOfInnerBlock = parent.
GetFirstToken
();
206
return ValueTuple.Create(parentOfParent.
GetFirstToken
(), parentOfParent.GetLastToken());
214
return ValueTuple.Create(GetAppropriatePreviousToken(parent.
GetFirstToken
()), parent.GetLastToken());
221
return ValueTuple.Create(GetAppropriatePreviousToken(containerOfBlock.
GetFirstToken
()), containerOfBlock.GetLastToken());
230
var firstTokenOfInnerBlock = parent.
GetFirstToken
();
241
return ValueTuple.Create(GetPreviousTokenIfNotFirstTokenInTree(parent.
GetFirstToken
()), parent.GetLastToken());
257
return (GetPreviousTokenIfNotFirstTokenInTree(parent.
GetFirstToken
()), parent.GetLastToken());
260
return (GetPreviousTokenIfNotFirstTokenInTree(parent.
GetFirstToken
()), parent.GetLastToken());
319
return GetAppropriatePreviousToken(labelNode.
GetFirstToken
());
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (16)
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (2)
606
var firstToken = node.
GetFirstToken
();
781
if (!document.Text.AreOnSameLine(component.
GetFirstToken
(), component.GetLastToken()))
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpUseCollectionExpressionForArrayCodeFixProvider.cs (1)
97
=> sourceText.AreOnSameLine(node.
GetFirstToken
(), node.GetLastToken());
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Formatting\TypingFormattingRule.cs (1)
34
var firstTokenOfNode = node.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Indentation\CSharpIndentationService.cs (2)
196
var baseToken = node.Parent.
GetFirstToken
(includeZeroWidth: true);
200
node.
GetFirstToken
(includeZeroWidth: true).GetNextToken(includeZeroWidth: true),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Indentation\CSharpIndentationService.Indenter.cs (8)
235
return indenter.GetIndentationOfLine(sourceText.Lines.GetLineFromPosition(embeddedStatementOwner.
GetFirstToken
(includeZeroWidth: true).SpanStart));
277
return indenter.GetIndentationOfLine(sourceText.Lines.GetLineFromPosition(nonTerminalNode.
GetFirstToken
(includeZeroWidth: true).SpanStart), indenter.Options.FormattingOptions.IndentationSize);
291
return indenter.GetIndentationOfLine(sourceText.Lines.GetLineFromPosition(nonTerminalNode.
GetFirstToken
(includeZeroWidth: true).SpanStart));
311
return GetDefaultIndentationFromToken(indenter, token.Parent.
GetFirstToken
(includeZeroWidth: true));
351
var firstToken = node.
GetFirstToken
(includeZeroWidth: true);
386
var firstToken = queryExpressionClause.
GetFirstToken
(includeZeroWidth: true);
430
return indenter.GetIndentationOfToken(queryBody.Parent.
GetFirstToken
(includeZeroWidth: true));
488
var firstTokenLine = sourceText.Lines.GetLineFromPosition(nonExpressionNode.
GetFirstToken
(includeZeroWidth: true).SpanStart);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Utilities\CSharpSimplificationHelpers.cs (2)
59
var firstRewrittenToken = rewrittenNode.
GetFirstToken
(true, false, true, true);
60
var firstOriginalToken = originalNode.
GetFirstToken
(true, false, true, true);
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (1)
Diagnostics\DiagnosticAnalyzerDriver\DiagnosticAnalyzerDriverTests.cs (1)
226
=> context.ReportDiagnostic(Diagnostic.Create(s_syntaxDiagnosticDescriptor, context.Tree.GetRoot().
GetFirstToken
().GetLocation()));
Microsoft.CodeAnalysis.CSharp.Features (30)
ChangeSignature\ChangeSignatureFormattingRule.cs (2)
42
var baseToken = node.Parent.
GetFirstToken
();
43
var startToken = node.
GetFirstToken
();
CodeRefactorings\EnableNullable\EnableNullableCodeRefactoringProvider.cs (3)
119
var firstNonDirectiveToken = root.
GetFirstToken
();
219
var firstToken = root.
GetFirstToken
(includeDirectives: true);
247
var firstSemanticToken = root.
GetFirstToken
();
ConvertProgram\ConvertProgramTransform_TopLevelStatements.cs (2)
174
updated.
GetFirstToken
(),
175
updated.
GetFirstToken
().WithAdditionalAnnotations(Formatter.Annotation));
ConvertToRawString\ConvertInterpolatedStringToRawStringCodeRefactoringProvider.cs (1)
272
var firstToken = node.
GetFirstToken
();
EditAndContinue\BreakpointSpans.cs (1)
114
=> CreateSpan(node.
GetFirstToken
(), node.GetLastToken());
ExtractMethod\CSharpMethodExtractor.TriviaResult.cs (1)
61
TriviaLocation.BeforeBeginningOfSpan => callsite.
GetFirstToken
(includeZeroWidth: true).GetPreviousToken(includeZeroWidth: true),
ExtractMethod\CSharpSelectionValidator.cs (2)
201
FirstTokenInFinalSpan = firstValidNode.
GetFirstToken
(includeZeroWidth: true),
360
FirstTokenInFinalSpan = selectionInfo.CommonRoot.
GetFirstToken
(includeZeroWidth: true),
GoToDefinition\CSharpGoToDefinitionSymbolService.cs (2)
38
? foundContinuedLoop.
GetFirstToken
().Span.Start
66
return foundReturnableConstruct.
GetFirstToken
().Span.Start;
QuickInfo\CSharpSyntacticQuickInfoProvider.cs (1)
82
else if (parent.
GetFirstToken
() == openBrace)
src\Analyzers\CSharp\Analyzers\AddBraces\CSharpAddBracesDiagnosticAnalyzer.cs (5)
108
var firstToken = statement.
GetFirstToken
();
161
if (FormattingRangeHelper.AreTwoTokensOnSameLine(statement.
GetFirstToken
(), statement.GetLastToken()))
172
var lastTokenBeforeEmbeddedStatement = embeddedStatement.
GetFirstToken
().GetPreviousToken();
173
if (!FormattingRangeHelper.AreTwoTokensOnSameLine(statement.
GetFirstToken
(), lastTokenBeforeEmbeddedStatement))
185
if (!FormattingRangeHelper.AreTwoTokensOnSameLine(embeddedStatement.
GetFirstToken
(), embeddedStatement.GetLastToken()))
src\Analyzers\CSharp\Analyzers\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionDiagnosticAnalyzer.cs (1)
69
location: switchStatement.
GetFirstToken
().GetLocation(),
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (1)
754
var newKeyword = parent.
GetFirstToken
();
src\Analyzers\CSharp\Analyzers\UseUtf8StringLiteral\UseUtf8StringLiteralDiagnosticAnalyzer.cs (1)
132
var location = syntaxNode.
GetFirstToken
().GetLocation();
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (2)
606
var firstToken = node.
GetFirstToken
();
781
if (!document.Text.AreOnSameLine(component.
GetFirstToken
(), component.GetLastToken()))
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpUseCollectionExpressionForArrayCodeFixProvider.cs (1)
97
=> sourceText.AreOnSameLine(node.
GetFirstToken
(), node.GetLastToken());
Structure\CSharpStructureHelpers.cs (2)
234
var startToken = node.
GetFirstToken
();
453
var spanStart = syntaxList.First().
GetFirstToken
().FullSpan.End;
Wrapping\SeparatedSyntaxList\CSharpArgumentWrapper.cs (1)
83
startToken = declaration.
GetFirstToken
();
Wrapping\SeparatedSyntaxList\CSharpParameterWrapper.cs (1)
64
: declaration.
GetFirstToken
();
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (3)
Parsing\SyntaxExtensions.cs (1)
19
return node.
GetFirstToken
(includeSkipped: true).LeadingTrivia;
Syntax\SyntaxNodeTests.cs (2)
1159
SyntaxToken token = syntaxTree.GetRoot().
GetFirstToken
();
1309
SyntaxToken token = syntaxTree.GetRoot().
GetFirstToken
(includeZeroWidth: true);
Microsoft.CodeAnalysis.CSharp.Workspaces (58)
CodeGeneration\CSharpSyntaxGenerator.cs (1)
3211
var firstToken = node.
GetFirstToken
();
Simplification\CSharpSimplificationService.cs (2)
139
var firstRewrittenToken = rewrittenNode.
GetFirstToken
(true, false, true, true);
140
var firstOriginalToken = originalNode.
GetFirstToken
(true, false, true, true);
Simplification\Reducers\CSharpMiscellaneousReducer.cs (1)
160
if (!FormattingRangeHelper.AreTwoTokensOnSameLine(node.Parent.
GetFirstToken
(), node.GetFirstToken().GetPreviousToken()))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (1)
63
=> node.
GetFirstToken
().GetAllPrecedingTriviaToPreviousToken(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\CSharpStructuredTriviaFormatEngine.cs (1)
23
var formatter = new CSharpStructuredTriviaFormatEngine(trivia, initialColumn, options, formattingRules, root.
GetFirstToken
(includeZeroWidth: true), root.GetLastToken(includeZeroWidth: true));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\FormattingHelpers.cs (1)
113
return token.Parent.Parent.
GetFirstToken
() != token;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\AnchorIndentationFormattingRule.cs (2)
44
block.Parent.
GetFirstToken
(includeZeroWidth: true),
91
=> AddAnchorIndentationOperation(list, node.
GetFirstToken
(includeZeroWidth: true), node.GetLastToken(includeZeroWidth: true));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\BaseFormattingRule.cs (2)
158
var firstTokenOfNode = node.
GetFirstToken
(includeZeroWidth: true);
170
firstTokenOfNode = node.Parent.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\IndentBlockFormattingRule.cs (6)
65
var baseToken = declaringNode.
GetFirstToken
();
66
AddIndentBlockOperation(list, baseToken, node.
GetFirstToken
(), node.GetLastToken());
185
var baseTokenForAlignment = recursivePatternParent.
GetFirstToken
();
204
var baseToken = baseNode.
GetFirstToken
(includeZeroWidth: true);
205
var firstToken = body.
GetFirstToken
(includeZeroWidth: true);
275
var firstToken = node.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SpacingFormattingRule.cs (1)
589
var firstToken = node.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (5)
83
AddSuppressWrappingIfOnSingleLineOperation(list, node.
GetFirstToken
(), node.GetLastToken());
91
AddSuppressWrappingIfOnSingleLineOperation(list, node.
GetFirstToken
(), node.GetLastToken());
207
node.
GetFirstToken
(includeZeroWidth: true),
394
AddSuppressWrappingIfOnSingleLineOperation(list, parent.
GetFirstToken
(includeZeroWidth: true), parent.GetLastToken(includeZeroWidth: true));
399
var firstToken = item.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\WrappingFormattingRule.cs (2)
141
var firstTokenOfNode = node.
GetFirstToken
(includeZeroWidth: true);
146
firstTokenOfNode = node.Parent!.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\FormattingRangeHelper.cs (20)
93
return (GetAppropriatePreviousToken(parent.
GetFirstToken
()), parent.GetLastToken());
115
return (GetAppropriatePreviousToken(parent.
GetFirstToken
(), canTokenBeFirstInABlock: true), parent.GetLastToken());
129
return (GetAppropriatePreviousToken(parent.
GetFirstToken
(), canTokenBeFirstInABlock: true), parent.GetLastToken());
136
return (GetAppropriatePreviousToken(parent.
GetFirstToken
()), parent.GetLastToken());
139
return (GetAppropriatePreviousToken(container.
GetFirstToken
()), container.GetLastToken());
141
return (GetAppropriatePreviousToken(parent.
GetFirstToken
(), canTokenBeFirstInABlock: true), parent.GetLastToken());
160
return ValueTuple.Create(GetAppropriatePreviousToken(parent.
GetFirstToken
()), parent.GetLastToken());
170
return ValueTuple.Create(GetAppropriatePreviousToken(parent.
GetFirstToken
()), parent.GetLastToken());
173
return ValueTuple.Create(containerOfList.
GetFirstToken
(), containerOfList.GetLastToken());
178
return ValueTuple.Create(parent.
GetFirstToken
(), parent.GetLastToken());
186
return ValueTuple.Create(GetAppropriatePreviousToken(parent.
GetFirstToken
()), parent.GetLastToken());
195
var firstTokenOfInnerBlock = parent.
GetFirstToken
();
206
return ValueTuple.Create(parentOfParent.
GetFirstToken
(), parentOfParent.GetLastToken());
214
return ValueTuple.Create(GetAppropriatePreviousToken(parent.
GetFirstToken
()), parent.GetLastToken());
221
return ValueTuple.Create(GetAppropriatePreviousToken(containerOfBlock.
GetFirstToken
()), containerOfBlock.GetLastToken());
230
var firstTokenOfInnerBlock = parent.
GetFirstToken
();
241
return ValueTuple.Create(GetPreviousTokenIfNotFirstTokenInTree(parent.
GetFirstToken
()), parent.GetLastToken());
257
return (GetPreviousTokenIfNotFirstTokenInTree(parent.
GetFirstToken
()), parent.GetLastToken());
260
return (GetPreviousTokenIfNotFirstTokenInTree(parent.
GetFirstToken
()), parent.GetLastToken());
319
return GetAppropriatePreviousToken(labelNode.
GetFirstToken
());
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Formatting\TypingFormattingRule.cs (1)
34
var firstTokenOfNode = node.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Indentation\CSharpIndentationService.cs (2)
196
var baseToken = node.Parent.
GetFirstToken
(includeZeroWidth: true);
200
node.
GetFirstToken
(includeZeroWidth: true).GetNextToken(includeZeroWidth: true),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Indentation\CSharpIndentationService.Indenter.cs (8)
235
return indenter.GetIndentationOfLine(sourceText.Lines.GetLineFromPosition(embeddedStatementOwner.
GetFirstToken
(includeZeroWidth: true).SpanStart));
277
return indenter.GetIndentationOfLine(sourceText.Lines.GetLineFromPosition(nonTerminalNode.
GetFirstToken
(includeZeroWidth: true).SpanStart), indenter.Options.FormattingOptions.IndentationSize);
291
return indenter.GetIndentationOfLine(sourceText.Lines.GetLineFromPosition(nonTerminalNode.
GetFirstToken
(includeZeroWidth: true).SpanStart));
311
return GetDefaultIndentationFromToken(indenter, token.Parent.
GetFirstToken
(includeZeroWidth: true));
351
var firstToken = node.
GetFirstToken
(includeZeroWidth: true);
386
var firstToken = queryExpressionClause.
GetFirstToken
(includeZeroWidth: true);
430
return indenter.GetIndentationOfToken(queryBody.Parent.
GetFirstToken
(includeZeroWidth: true));
488
var firstTokenLine = sourceText.Lines.GetLineFromPosition(nonExpressionNode.
GetFirstToken
(includeZeroWidth: true).SpanStart);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Utilities\CSharpSimplificationHelpers.cs (2)
59
var firstRewrittenToken = rewrittenNode.
GetFirstToken
(true, false, true, true);
60
var firstOriginalToken = originalNode.
GetFirstToken
(true, false, true, true);
Microsoft.CodeAnalysis.Features (68)
AddFileBanner\AbstractAddFileBannerCodeRefactoringProvider.cs (1)
52
var firstToken = root.
GetFirstToken
();
AddFileBanner\AddFileBannerHelpers.cs (1)
36
var firstToken = destinationRoot.
GetFirstToken
();
AddImport\References\Reference.cs (2)
85
var identifier = SearchResult.NameNode.
GetFirstToken
();
87
var newIdentifier = generator.IdentifierName(SearchResult.DesiredName).
GetFirstToken
().WithTriviaFrom(identifier);
AddImport\SymbolReferenceFinder.cs (1)
321
var name = nameNode.
GetFirstToken
().ValueText;
AddImport\SymbolResult.cs (2)
38
NameNode.
GetFirstToken
().ValueText != DesiredName;
45
NameNode.
GetFirstToken
().ValueText, DesiredName);
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.cs (2)
107
if (containingStatement is not null && containingStatement.
GetFirstToken
() != token)
109
var indexOfLine = lines.IndexOf(containingStatement.
GetFirstToken
().SpanStart);
ConvertForEachToFor\AbstractConvertForEachToForCodeRefactoringProvider.cs (1)
126
collectionStatement = collectionStatement.WithLeadingTrivia(foreachInfo.ForEachStatement.
GetFirstToken
().LeadingTrivia);
ConvertNumericLiteral\AbstractConvertNumericLiteralCodeRefactoringProvider.cs (1)
43
var numericToken = numericLiteralNode.
GetFirstToken
();
ConvertToInterpolatedString\AbstractConvertConcatenationToInterpolatedStringRefactoringProvider.cs (9)
91
var firstStringToken = stringLiterals[0].
GetFirstToken
();
97
var firstToken = literal.
GetFirstToken
();
154
var text = piece.
GetFirstToken
().Text;
155
var value = piece.
GetFirstToken
().Value?.ToString() ?? piece.
GetFirstToken
().ValueText;
195
var newText = ConcatenateTextToTextNode(generator, content.Last(), contentPart.
GetFirstToken
().Text, contentPart.
GetFirstToken
().ValueText);
258
var existingText = interpolatedStringTextNode.
GetFirstToken
().Text;
259
var existingValue = interpolatedStringTextNode.
GetFirstToken
().ValueText;
ConvertToInterpolatedString\AbstractConvertPlaceholderToInterpolatedStringRefactoringProvider.cs (3)
62
var stringToken = placeholderExpression.
GetFirstToken
();
205
var stringLiteralText = expression.
GetFirstToken
().Text;
412
int.TryParse(literalExpression.
GetFirstToken
().ValueText, out var index) &&
ConvertToInterpolatedString\ConvertRegularStringToInterpolatedStringRefactoringProvider.cs (2)
93
var text = literalExpression.
GetFirstToken
().Text;
94
var valueText = literalExpression.
GetFirstToken
().ValueText;
DocumentationComments\AbstractDocumentationCommentSnippetService.cs (2)
202
var startPosition = member.
GetFirstToken
().SpanStart;
324
var token = targetMember.
GetFirstToken
();
GenerateEqualsAndGetHashCodeFromMembers\FormatLargeBinaryExpressionRule.cs (2)
52
expr.
GetFirstToken
(),
53
expr.
GetFirstToken
().GetNextToken(),
GenerateType\AbstractGenerateTypeService.State.cs (1)
94
NameIsVerbatim = syntaxFacts.IsVerbatimIdentifier(SimpleName.
GetFirstToken
());
ReplacePropertyWithMethods\AbstractReplacePropertyWithMethodsService.cs (2)
434
name.
GetFirstToken
(),
435
AddConflictAnnotation(name.
GetFirstToken
(), conflictMessage));
Snippets\SnippetProviders\AbstractInlineStatementSnippetProvider.cs (4)
102
CanInsertStatementBeforeToken(parentNode.
GetFirstToken
()))
107
if (sourceText.AreOnSameLine(dotToken, name.
GetFirstToken
()))
135
if (syntaxFacts.IsQualifiedName(parentNode) && CanInsertStatementBeforeToken(parentNode.
GetFirstToken
()))
140
if (sourceText.AreOnSameLine(dotToken, right.
GetFirstToken
()))
SpellCheck\AbstractSpellCheckCodeFixProvider.cs (1)
75
var token = name.
GetFirstToken
();
src\Analyzers\Core\Analyzers\FileHeaders\AbstractFileHeaderHelper.cs (1)
35
var firstToken = root.
GetFirstToken
(includeZeroWidth: true);
src\Analyzers\Core\Analyzers\ForEachCast\AbstractForEachCastDiagnosticAnalyzer.cs (2)
146
node.
GetFirstToken
().GetLocation(),
151
node.
GetFirstToken
().ToString(),
src\Analyzers\Core\Analyzers\NewLines\ConsecutiveStatementPlacement\AbstractConsecutiveStatementPlacementDiagnosticAnalyzer.cs (1)
88
if (nextToken != nextTokenContainingStatement.
GetFirstToken
())
src\Analyzers\Core\Analyzers\PopulateSwitch\AbstractPopulateSwitchStatementDiagnosticAnalyzer.cs (1)
38
=> switchBlock.
GetFirstToken
().GetLocation();
src\Analyzers\Core\Analyzers\RemoveUnnecessaryImports\AbstractRemoveUnnecessaryImportsDiagnosticAnalyzer.cs (1)
158
if (lastToken.GetNextToken(includeDirectives: true) == node.
GetFirstToken
())
src\Analyzers\Core\Analyzers\RemoveUnnecessaryParentheses\AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer.cs (1)
114
parenthesizedExpression.
GetFirstToken
().GetLocation(),
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (1)
740
var firstToken = memberDeclaration.
GetFirstToken
();
src\Analyzers\Core\Analyzers\SimplifyInterpolation\AbstractSimplifyInterpolationHelpers.cs (1)
152
.Subtract(GetSpanWithinLiteralQuotes(virtualCharService, literal.Syntax.
GetFirstToken
())));
src\Analyzers\Core\Analyzers\UseCoalesceExpression\AbstractUseCoalesceExpressionForIfNullCheckDiagnosticAnalyzer.cs (1)
114
ifStatement.
GetFirstToken
().GetLocation(),
src\Analyzers\Core\Analyzers\UseCollectionInitializer\AbstractUseCollectionInitializerDiagnosticAnalyzer.cs (1)
192
objectCreationExpression.
GetFirstToken
().GetLocation(),
src\Analyzers\Core\Analyzers\UseConditionalExpression\AbstractUseConditionalExpressionDiagnosticAnalyzer.cs (1)
54
ifStatement.
GetFirstToken
().GetLocation(),
src\Analyzers\Core\Analyzers\UseNullPropagation\AbstractUseNullPropagationDiagnosticAnalyzer_IfStatement.cs (1)
49
ifStatement.
GetFirstToken
().GetLocation(),
src\Analyzers\Core\Analyzers\UseObjectInitializer\AbstractUseObjectInitializerDiagnosticAnalyzer.cs (1)
129
objectCreationExpression.
GetFirstToken
().GetLocation(),
src\Analyzers\Core\CodeFixes\UseConditionalExpression\AbstractUseConditionalExpressionCodeFixProvider.cs (3)
159
if (!sourceText.AreOnSameLine(condition.
GetFirstToken
(), condition.GetLastToken()) ||
160
!sourceText.AreOnSameLine(trueSyntax.
GetFirstToken
(), trueSyntax.GetLastToken()) ||
161
!sourceText.AreOnSameLine(falseSyntax.
GetFirstToken
(), falseSyntax.GetLastToken()))
src\Analyzers\Core\CodeFixes\UseObjectInitializer\AbstractUseObjectInitializerCodeFixProvider.cs (1)
83
var firstToken = objectCreation.
GetFirstToken
();
Wrapping\AbstractWrapper.cs (1)
52
var firstToken = item.IsToken ? item.AsToken() : item.AsNode()!.
GetFirstToken
();
Wrapping\Edit.cs (1)
69
var rightFirstToken = right.IsToken ? right.AsToken() : right.AsNode()!.
GetFirstToken
();
Wrapping\SeparatedSyntaxList\SeparatedSyntaxListCodeActionComputer.cs (11)
99
? Edit.UpdateBetween(_listSyntax.
GetFirstToken
(), NewLineTrivia, await _singleIndentationTrivia.GetValueAsync(cancellationToken).ConfigureAwait(false), _listItems[0])
100
: Edit.DeleteBetween(_listSyntax.
GetFirstToken
(), _listItems[0]));
105
var openToken = _listSyntax.
GetFirstToken
();
117
var openToken = _listSyntax.
GetFirstToken
();
131
var previousToken = _listSyntax.
GetFirstToken
().GetPreviousToken();
207
result.Add(Edit.DeleteBetween(_listSyntax.
GetFirstToken
().GetPreviousToken(), _listSyntax.
GetFirstToken
()));
296
_listSyntax.
GetFirstToken
().GetPreviousToken(), NewLineTrivia,
298
_listSyntax.
GetFirstToken
()));
431
_listSyntax.
GetFirstToken
().GetPreviousToken(), NewLineTrivia,
433
_listSyntax.
GetFirstToken
()));
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (2)
Diagnostics\NonLocalDiagnosticTests.cs (2)
92
var diagnostic = Diagnostic.Create(NonLocalDescriptor, root.
GetFirstToken
().GetLocation());
103
var diagnostic = Diagnostic.Create(CompilationEndDescriptor, root.
GetFirstToken
().GetLocation());
Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers (19)
src\RoslynAnalyzers\Utilities\Compiler\DoNotCatchGeneralUnlessRethrown.cs (1)
82
operationBlockAnalysisContext.ReportDiagnostic(CreateDiagnostic(method, catchClause.Syntax.
GetFirstToken
()));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs (1)
126
var firstToken = root.
GetFirstToken
(includeZeroWidth: true, includeSkipped: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (1)
111
startToken: _rootNode.
GetFirstToken
(includeZeroWidth: true),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.cs (1)
43
_firstToken = Root.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.Node.cs (1)
17
Contract.ThrowIfFalse(root.
GetFirstToken
(includeZeroWidth: true).RawKind != 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (2)
282
? (childNode.
GetFirstToken
(includeZeroWidth: true), childNode.GetLastToken(includeZeroWidth: true))
368
if (conditionStatement.
GetFirstToken
() == indentationAnchor)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (1)
486
var firstToken = trivia2.GetStructure()!.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (1)
169
return GetFileBanner(root.
GetFirstToken
(includeZeroWidth: true));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SelectedMembers\AbstractSelectedMembers.cs (1)
167
if (token == member.
GetFirstToken
() &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (2)
357
var previousToken = node.
GetFirstToken
().GetPreviousToken();
360
syntaxFacts.IsWordOrNumber(resultNode.
GetFirstToken
()))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\CommonFormattingHelpers.cs (1)
119
startToken = (startToken.RawKind != 0) ? startToken : root.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService_FindDeclaration.cs (1)
49
var start = node.
GetFirstToken
();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\AddParameterEditor.cs (3)
55
var previousToken = firstParameter.
GetFirstToken
().GetPreviousToken();
57
if (sourceText.AreOnSameLine(previousToken, firstParameter.
GetFirstToken
()))
165
if (text.AreOnSameLine(lastParameter.GetLastToken(), thisParameter.
GetFirstToken
()))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\AddImports\AddImportHelpers.cs (1)
35
var firstToken = root.
GetFirstToken
();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.State.cs (1)
171
var previousToken = FirstStatementAffectedInInnermostBlock.
GetFirstToken
().GetPreviousToken();
Microsoft.CodeAnalysis.PublicApiAnalyzers (13)
src\RoslynAnalyzers\Utilities\Compiler\DoNotCatchGeneralUnlessRethrown.cs (1)
82
operationBlockAnalysisContext.ReportDiagnostic(CreateDiagnostic(method, catchClause.Syntax.
GetFirstToken
()));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs (1)
126
var firstToken = root.
GetFirstToken
(includeZeroWidth: true, includeSkipped: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (1)
111
startToken: _rootNode.
GetFirstToken
(includeZeroWidth: true),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.cs (1)
43
_firstToken = Root.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.Node.cs (1)
17
Contract.ThrowIfFalse(root.
GetFirstToken
(includeZeroWidth: true).RawKind != 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (2)
282
? (childNode.
GetFirstToken
(includeZeroWidth: true), childNode.GetLastToken(includeZeroWidth: true))
368
if (conditionStatement.
GetFirstToken
() == indentationAnchor)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (1)
486
var firstToken = trivia2.GetStructure()!.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (1)
169
return GetFileBanner(root.
GetFirstToken
(includeZeroWidth: true));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SelectedMembers\AbstractSelectedMembers.cs (1)
167
if (token == member.
GetFirstToken
() &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (2)
357
var previousToken = node.
GetFirstToken
().GetPreviousToken();
360
syntaxFacts.IsWordOrNumber(resultNode.
GetFirstToken
()))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\CommonFormattingHelpers.cs (1)
119
startToken = (startToken.RawKind != 0) ? startToken : root.
GetFirstToken
(includeZeroWidth: true);
Microsoft.CodeAnalysis.ResxSourceGenerator (13)
src\RoslynAnalyzers\Utilities\Compiler\DoNotCatchGeneralUnlessRethrown.cs (1)
82
operationBlockAnalysisContext.ReportDiagnostic(CreateDiagnostic(method, catchClause.Syntax.
GetFirstToken
()));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs (1)
126
var firstToken = root.
GetFirstToken
(includeZeroWidth: true, includeSkipped: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (1)
111
startToken: _rootNode.
GetFirstToken
(includeZeroWidth: true),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.cs (1)
43
_firstToken = Root.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.Node.cs (1)
17
Contract.ThrowIfFalse(root.
GetFirstToken
(includeZeroWidth: true).RawKind != 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (2)
282
? (childNode.
GetFirstToken
(includeZeroWidth: true), childNode.GetLastToken(includeZeroWidth: true))
368
if (conditionStatement.
GetFirstToken
() == indentationAnchor)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (1)
486
var firstToken = trivia2.GetStructure()!.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (1)
169
return GetFileBanner(root.
GetFirstToken
(includeZeroWidth: true));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SelectedMembers\AbstractSelectedMembers.cs (1)
167
if (token == member.
GetFirstToken
() &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (2)
357
var previousToken = node.
GetFirstToken
().GetPreviousToken();
360
syntaxFacts.IsWordOrNumber(resultNode.
GetFirstToken
()))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\CommonFormattingHelpers.cs (1)
119
startToken = (startToken.RawKind != 0) ? startToken : root.
GetFirstToken
(includeZeroWidth: true);
Microsoft.CodeAnalysis.VisualBasic (3)
Binding\Binder_Expressions.vb (1)
4037
Return argumentExpression.
GetFirstToken
() ' since we use this for error reporting, this gives us something close, anyway.
BoundTree\BoundTreeVisitor.vb (1)
168
Return syntax.
GetFirstToken
().GetLocation()
Syntax\VisualBasicSyntaxNode.vb (1)
316
Return CType(MyBase.
GetFirstToken
(includeZeroWidth, includeSkipped, includeDirectives, includeDocumentationComments), SyntaxToken)
Microsoft.CodeAnalysis.Workspaces (27)
CodeCleanup\AbstractCodeCleanerService.cs (3)
293
previousToken = (previousToken.RawKind == 0) ? root.
GetFirstToken
(includeZeroWidth: true) : previousToken;
337
previousToken = (previousToken.RawKind == 0) ? root.
GetFirstToken
(includeZeroWidth: true) : previousToken;
425
return root.
GetFirstToken
(includeZeroWidth: true, includeSkipped: true, includeDirectives: true, includeDocumentationComments: true);
FindSymbols\FindReferences\Finders\AbstractReferenceFinder.cs (4)
413
var location = node.
GetFirstToken
().GetLocation();
455
var location = expression.
GetFirstToken
().GetLocation();
530
var location = node.
GetFirstToken
().GetLocation();
565
var location = node.
GetFirstToken
().GetLocation();
FindSymbols\FindReferences\Finders\ExplicitConversionSymbolReferenceFinder.cs (1)
83
return node.
GetFirstToken
() == token && syntaxFacts.IsConversionExpression(node);
FindSymbols\FindReferences\Finders\OrdinaryMethodReferenceFinder.cs (1)
168
var location = node.
GetFirstToken
().GetLocation();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs (1)
126
var firstToken = root.
GetFirstToken
(includeZeroWidth: true, includeSkipped: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (1)
111
startToken: _rootNode.
GetFirstToken
(includeZeroWidth: true),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.cs (1)
43
_firstToken = Root.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.Node.cs (1)
17
Contract.ThrowIfFalse(root.
GetFirstToken
(includeZeroWidth: true).RawKind != 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (2)
282
? (childNode.
GetFirstToken
(includeZeroWidth: true), childNode.GetLastToken(includeZeroWidth: true))
368
if (conditionStatement.
GetFirstToken
() == indentationAnchor)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (1)
486
var firstToken = trivia2.GetStructure()!.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (1)
169
return GetFileBanner(root.
GetFirstToken
(includeZeroWidth: true));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SelectedMembers\AbstractSelectedMembers.cs (1)
167
if (token == member.
GetFirstToken
() &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (2)
357
var previousToken = node.
GetFirstToken
().GetPreviousToken();
360
syntaxFacts.IsWordOrNumber(resultNode.
GetFirstToken
()))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\CommonFormattingHelpers.cs (1)
119
startToken = (startToken.RawKind != 0) ? startToken : root.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService_FindDeclaration.cs (1)
49
var start = node.
GetFirstToken
();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\AddParameterEditor.cs (3)
55
var previousToken = firstParameter.
GetFirstToken
().GetPreviousToken();
57
if (sourceText.AreOnSameLine(previousToken, firstParameter.
GetFirstToken
()))
165
if (text.AreOnSameLine(lastParameter.GetLastToken(), thisParameter.
GetFirstToken
()))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\AddImports\AddImportHelpers.cs (1)
35
var firstToken = root.
GetFirstToken
();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.State.cs (1)
171
var previousToken = FirstStatementAffectedInInnermostBlock.
GetFirstToken
().GetPreviousToken();
Microsoft.CodeAnalysis.Workspaces.UnitTests (5)
CodeCleanup\CodeCleanupTests.cs (1)
357
var previousToken = member.
GetFirstToken
().GetPreviousToken().GetPreviousToken();
CodeCleanup\Extensions.cs (1)
20
var previousToken = node.
GetFirstToken
(includeZeroWidth: true, includeSkipped: true, includeDirectives: true, includeDocumentationComments: true).GetPreviousToken(includeZeroWidth: true, includeSkipped: true, includeDirectives: true, includeDocumentationComments: true);
UtilityTest\FormattingRangeHelperTests.cs (3)
18
var token1 = root.
GetFirstToken
();
28
var token1 = root.
GetFirstToken
();
37
var token = SyntaxFactory.ParseSyntaxTree("else\nFoo();").GetRoot().
GetFirstToken
();
Microsoft.VisualStudio.LanguageServices.CSharp (3)
CodeModel\CSharpCodeModelService.cs (2)
1245
var firstToken = node.
GetFirstToken
();
3349
var firstToken = container.
GetFirstToken
();
CodeModel\SyntaxNodeExtensions.cs (1)
68
return node.
GetFirstToken
();
Roslyn.Diagnostics.Analyzers (19)
src\RoslynAnalyzers\Utilities\Compiler\DoNotCatchGeneralUnlessRethrown.cs (1)
82
operationBlockAnalysisContext.ReportDiagnostic(CreateDiagnostic(method, catchClause.Syntax.
GetFirstToken
()));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs (1)
126
var firstToken = root.
GetFirstToken
(includeZeroWidth: true, includeSkipped: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (1)
111
startToken: _rootNode.
GetFirstToken
(includeZeroWidth: true),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.cs (1)
43
_firstToken = Root.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.Node.cs (1)
17
Contract.ThrowIfFalse(root.
GetFirstToken
(includeZeroWidth: true).RawKind != 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (2)
282
? (childNode.
GetFirstToken
(includeZeroWidth: true), childNode.GetLastToken(includeZeroWidth: true))
368
if (conditionStatement.
GetFirstToken
() == indentationAnchor)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (1)
486
var firstToken = trivia2.GetStructure()!.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (1)
169
return GetFileBanner(root.
GetFirstToken
(includeZeroWidth: true));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SelectedMembers\AbstractSelectedMembers.cs (1)
167
if (token == member.
GetFirstToken
() &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (2)
357
var previousToken = node.
GetFirstToken
().GetPreviousToken();
360
syntaxFacts.IsWordOrNumber(resultNode.
GetFirstToken
()))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\CommonFormattingHelpers.cs (1)
119
startToken = (startToken.RawKind != 0) ? startToken : root.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService_FindDeclaration.cs (1)
49
var start = node.
GetFirstToken
();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\AddParameterEditor.cs (3)
55
var previousToken = firstParameter.
GetFirstToken
().GetPreviousToken();
57
if (sourceText.AreOnSameLine(previousToken, firstParameter.
GetFirstToken
()))
165
if (text.AreOnSameLine(lastParameter.GetLastToken(), thisParameter.
GetFirstToken
()))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\AddImports\AddImportHelpers.cs (1)
35
var firstToken = root.
GetFirstToken
();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.State.cs (1)
171
var previousToken = FirstStatementAffectedInInnermostBlock.
GetFirstToken
().GetPreviousToken();
Roslyn.Diagnostics.CSharp.Analyzers (54)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (1)
63
=> node.
GetFirstToken
().GetAllPrecedingTriviaToPreviousToken(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\CSharpStructuredTriviaFormatEngine.cs (1)
23
var formatter = new CSharpStructuredTriviaFormatEngine(trivia, initialColumn, options, formattingRules, root.
GetFirstToken
(includeZeroWidth: true), root.GetLastToken(includeZeroWidth: true));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\FormattingHelpers.cs (1)
113
return token.Parent.Parent.
GetFirstToken
() != token;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\AnchorIndentationFormattingRule.cs (2)
44
block.Parent.
GetFirstToken
(includeZeroWidth: true),
91
=> AddAnchorIndentationOperation(list, node.
GetFirstToken
(includeZeroWidth: true), node.GetLastToken(includeZeroWidth: true));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\BaseFormattingRule.cs (2)
158
var firstTokenOfNode = node.
GetFirstToken
(includeZeroWidth: true);
170
firstTokenOfNode = node.Parent.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\IndentBlockFormattingRule.cs (6)
65
var baseToken = declaringNode.
GetFirstToken
();
66
AddIndentBlockOperation(list, baseToken, node.
GetFirstToken
(), node.GetLastToken());
185
var baseTokenForAlignment = recursivePatternParent.
GetFirstToken
();
204
var baseToken = baseNode.
GetFirstToken
(includeZeroWidth: true);
205
var firstToken = body.
GetFirstToken
(includeZeroWidth: true);
275
var firstToken = node.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SpacingFormattingRule.cs (1)
589
var firstToken = node.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (5)
83
AddSuppressWrappingIfOnSingleLineOperation(list, node.
GetFirstToken
(), node.GetLastToken());
91
AddSuppressWrappingIfOnSingleLineOperation(list, node.
GetFirstToken
(), node.GetLastToken());
207
node.
GetFirstToken
(includeZeroWidth: true),
394
AddSuppressWrappingIfOnSingleLineOperation(list, parent.
GetFirstToken
(includeZeroWidth: true), parent.GetLastToken(includeZeroWidth: true));
399
var firstToken = item.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\WrappingFormattingRule.cs (2)
141
var firstTokenOfNode = node.
GetFirstToken
(includeZeroWidth: true);
146
firstTokenOfNode = node.Parent!.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\FormattingRangeHelper.cs (20)
93
return (GetAppropriatePreviousToken(parent.
GetFirstToken
()), parent.GetLastToken());
115
return (GetAppropriatePreviousToken(parent.
GetFirstToken
(), canTokenBeFirstInABlock: true), parent.GetLastToken());
129
return (GetAppropriatePreviousToken(parent.
GetFirstToken
(), canTokenBeFirstInABlock: true), parent.GetLastToken());
136
return (GetAppropriatePreviousToken(parent.
GetFirstToken
()), parent.GetLastToken());
139
return (GetAppropriatePreviousToken(container.
GetFirstToken
()), container.GetLastToken());
141
return (GetAppropriatePreviousToken(parent.
GetFirstToken
(), canTokenBeFirstInABlock: true), parent.GetLastToken());
160
return ValueTuple.Create(GetAppropriatePreviousToken(parent.
GetFirstToken
()), parent.GetLastToken());
170
return ValueTuple.Create(GetAppropriatePreviousToken(parent.
GetFirstToken
()), parent.GetLastToken());
173
return ValueTuple.Create(containerOfList.
GetFirstToken
(), containerOfList.GetLastToken());
178
return ValueTuple.Create(parent.
GetFirstToken
(), parent.GetLastToken());
186
return ValueTuple.Create(GetAppropriatePreviousToken(parent.
GetFirstToken
()), parent.GetLastToken());
195
var firstTokenOfInnerBlock = parent.
GetFirstToken
();
206
return ValueTuple.Create(parentOfParent.
GetFirstToken
(), parentOfParent.GetLastToken());
214
return ValueTuple.Create(GetAppropriatePreviousToken(parent.
GetFirstToken
()), parent.GetLastToken());
221
return ValueTuple.Create(GetAppropriatePreviousToken(containerOfBlock.
GetFirstToken
()), containerOfBlock.GetLastToken());
230
var firstTokenOfInnerBlock = parent.
GetFirstToken
();
241
return ValueTuple.Create(GetPreviousTokenIfNotFirstTokenInTree(parent.
GetFirstToken
()), parent.GetLastToken());
257
return (GetPreviousTokenIfNotFirstTokenInTree(parent.
GetFirstToken
()), parent.GetLastToken());
260
return (GetPreviousTokenIfNotFirstTokenInTree(parent.
GetFirstToken
()), parent.GetLastToken());
319
return GetAppropriatePreviousToken(labelNode.
GetFirstToken
());
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Formatting\TypingFormattingRule.cs (1)
34
var firstTokenOfNode = node.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Indentation\CSharpIndentationService.cs (2)
196
var baseToken = node.Parent.
GetFirstToken
(includeZeroWidth: true);
200
node.
GetFirstToken
(includeZeroWidth: true).GetNextToken(includeZeroWidth: true),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Indentation\CSharpIndentationService.Indenter.cs (8)
235
return indenter.GetIndentationOfLine(sourceText.Lines.GetLineFromPosition(embeddedStatementOwner.
GetFirstToken
(includeZeroWidth: true).SpanStart));
277
return indenter.GetIndentationOfLine(sourceText.Lines.GetLineFromPosition(nonTerminalNode.
GetFirstToken
(includeZeroWidth: true).SpanStart), indenter.Options.FormattingOptions.IndentationSize);
291
return indenter.GetIndentationOfLine(sourceText.Lines.GetLineFromPosition(nonTerminalNode.
GetFirstToken
(includeZeroWidth: true).SpanStart));
311
return GetDefaultIndentationFromToken(indenter, token.Parent.
GetFirstToken
(includeZeroWidth: true));
351
var firstToken = node.
GetFirstToken
(includeZeroWidth: true);
386
var firstToken = queryExpressionClause.
GetFirstToken
(includeZeroWidth: true);
430
return indenter.GetIndentationOfToken(queryBody.Parent.
GetFirstToken
(includeZeroWidth: true));
488
var firstTokenLine = sourceText.Lines.GetLineFromPosition(nonExpressionNode.
GetFirstToken
(includeZeroWidth: true).SpanStart);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Utilities\CSharpSimplificationHelpers.cs (2)
59
var firstRewrittenToken = rewrittenNode.
GetFirstToken
(true, false, true, true);
60
var firstOriginalToken = originalNode.
GetFirstToken
(true, false, true, true);
Test.Utilities (13)
src\RoslynAnalyzers\Utilities\Compiler\DoNotCatchGeneralUnlessRethrown.cs (1)
82
operationBlockAnalysisContext.ReportDiagnostic(CreateDiagnostic(method, catchClause.Syntax.
GetFirstToken
()));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs (1)
126
var firstToken = root.
GetFirstToken
(includeZeroWidth: true, includeSkipped: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (1)
111
startToken: _rootNode.
GetFirstToken
(includeZeroWidth: true),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.cs (1)
43
_firstToken = Root.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.Node.cs (1)
17
Contract.ThrowIfFalse(root.
GetFirstToken
(includeZeroWidth: true).RawKind != 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (2)
282
? (childNode.
GetFirstToken
(includeZeroWidth: true), childNode.GetLastToken(includeZeroWidth: true))
368
if (conditionStatement.
GetFirstToken
() == indentationAnchor)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (1)
486
var firstToken = trivia2.GetStructure()!.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (1)
169
return GetFileBanner(root.
GetFirstToken
(includeZeroWidth: true));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SelectedMembers\AbstractSelectedMembers.cs (1)
167
if (token == member.
GetFirstToken
() &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (2)
357
var previousToken = node.
GetFirstToken
().GetPreviousToken();
360
syntaxFacts.IsWordOrNumber(resultNode.
GetFirstToken
()))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\CommonFormattingHelpers.cs (1)
119
startToken = (startToken.RawKind != 0) ? startToken : root.
GetFirstToken
(includeZeroWidth: true);
Text.Analyzers (19)
src\RoslynAnalyzers\Utilities\Compiler\DoNotCatchGeneralUnlessRethrown.cs (1)
82
operationBlockAnalysisContext.ReportDiagnostic(CreateDiagnostic(method, catchClause.Syntax.
GetFirstToken
()));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs (1)
126
var firstToken = root.
GetFirstToken
(includeZeroWidth: true, includeSkipped: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (1)
111
startToken: _rootNode.
GetFirstToken
(includeZeroWidth: true),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.cs (1)
43
_firstToken = Root.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.Node.cs (1)
17
Contract.ThrowIfFalse(root.
GetFirstToken
(includeZeroWidth: true).RawKind != 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (2)
282
? (childNode.
GetFirstToken
(includeZeroWidth: true), childNode.GetLastToken(includeZeroWidth: true))
368
if (conditionStatement.
GetFirstToken
() == indentationAnchor)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (1)
486
var firstToken = trivia2.GetStructure()!.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (1)
169
return GetFileBanner(root.
GetFirstToken
(includeZeroWidth: true));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SelectedMembers\AbstractSelectedMembers.cs (1)
167
if (token == member.
GetFirstToken
() &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (2)
357
var previousToken = node.
GetFirstToken
().GetPreviousToken();
360
syntaxFacts.IsWordOrNumber(resultNode.
GetFirstToken
()))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\CommonFormattingHelpers.cs (1)
119
startToken = (startToken.RawKind != 0) ? startToken : root.
GetFirstToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService_FindDeclaration.cs (1)
49
var start = node.
GetFirstToken
();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\AddParameterEditor.cs (3)
55
var previousToken = firstParameter.
GetFirstToken
().GetPreviousToken();
57
if (sourceText.AreOnSameLine(previousToken, firstParameter.
GetFirstToken
()))
165
if (text.AreOnSameLine(lastParameter.GetLastToken(), thisParameter.
GetFirstToken
()))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\AddImports\AddImportHelpers.cs (1)
35
var firstToken = root.
GetFirstToken
();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.State.cs (1)
171
var previousToken = FirstStatementAffectedInInnermostBlock.
GetFirstToken
().GetPreviousToken();