389 references to GetPreviousToken
Microsoft.AspNetCore.App.Analyzers (6)
RouteEmbeddedLanguage\FrameworkParametersCompletionProvider.cs (2)
109
token = token.
GetPreviousToken
();
164
var previous = token.
GetPreviousToken
();
RouteEmbeddedLanguage\Infrastructure\RouteStringSyntaxDetector.cs (1)
147
if (HasLanguageComment(token.
GetPreviousToken
().TrailingTrivia, out identifier, out options))
RouteEmbeddedLanguage\Infrastructure\SyntaxNodeExtensions.cs (3)
94
: token.
GetPreviousToken
(includeZeroWidth: false, includeSkipped: includeSkipped, includeDirectives: includeDirectives, includeDocumentationComments: includeDocumentationComments);
106
token = token.
GetPreviousToken
();
122
.
GetPreviousToken
(includeZeroWidth: false, includeSkipped: includeSkipped, includeDirectives: includeDirectives, includeDocumentationComments: includeDocumentationComments);
Microsoft.CodeAnalysis.CodeStyle (23)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (4)
607
.
GetPreviousToken
(includeZeroWidth: false, includeSkipped: includeSkipped, includeDirectives: includeDirectives, includeDocumentationComments: includeDocumentationComments);
670
: token.
GetPreviousToken
(includeZeroWidth: false, includeSkipped: includeSkipped, includeDirectives: includeDirectives, includeDocumentationComments: includeDocumentationComments);
682
token = token.
GetPreviousToken
();
972
current = current.
GetPreviousToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTokenExtensions.cs (1)
72
var previousToken = token.
GetPreviousToken
(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs (2)
85
token = token.
GetPreviousToken
();
187
var token = endOfFileToken.
GetPreviousToken
(includeSkipped: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (3)
156
var previousToken = tokenData.Token.
GetPreviousToken
(includeZeroWidth: true);
392
Debug.Assert((token1.IndexInStream >= 0 && token2.IndexInStream >= 0) || token1.Token.Equals(token2.Token.
GetPreviousToken
(includeZeroWidth: true)) || token2.Token.LeadingTrivia.Span.Contains(token1.Token.Span));
417
Debug.Assert((token1.IndexInStream >= 0 && token2.IndexInStream >= 0) || token1.Token.Equals(token2.Token.
GetPreviousToken
(includeZeroWidth: true)) || token2.Token.LeadingTrivia.Span.Contains(token1.Token.Span));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.Node.cs (2)
36
var currentToken = token.
GetPreviousToken
(includeZeroWidth: true);
45
currentToken = currentToken.
GetPreviousToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
292
var previousToken = firstToken.
GetPreviousToken
();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\BaseIndentationFormattingRule.cs (2)
159
token1 = token1.
GetPreviousToken
();
179
token1 = token1.
GetPreviousToken
();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.Indenter.cs (2)
133
token = token.
GetPreviousToken
();
139
token = token.
GetPreviousToken
();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (1)
86
return tokenToRightOrIn.
GetPreviousToken
().GetAncestor<TNode>();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (1)
357
var previousToken = node.GetFirstToken().
GetPreviousToken
();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\CommonFormattingHelpers.cs (4)
93
startToken = startToken.
GetPreviousToken
();
100
startToken = startToken.
GetPreviousToken
();
297
var previousToken = token.
GetPreviousToken
();
362
var startToken = root.FindToken(span.Start).
GetPreviousToken
();
Microsoft.CodeAnalysis.CodeStyle.Fixes (5)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\AbstractRefactoringHelpersService.cs (3)
179
var previousToken = commaToken.
GetPreviousToken
();
202
: tokenOnLocation.
GetPreviousToken
(includeZeroWidth: true);
295
? tokenToLeft.
GetPreviousToken
(includeZeroWidth: true)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\AddParameterEditor.cs (1)
55
var previousToken = firstParameter.GetFirstToken().
GetPreviousToken
();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.State.cs (1)
171
var previousToken = FirstStatementAffectedInInnermostBlock.GetFirstToken().
GetPreviousToken
();
Microsoft.CodeAnalysis.CSharp (1)
Compilation\CSharpSemanticModel.cs (1)
1285
token = token.
GetPreviousToken
();
Microsoft.CodeAnalysis.CSharp.CodeStyle (31)
src\Analyzers\CSharp\Analyzers\AddBraces\CSharpAddBracesDiagnosticAnalyzer.cs (1)
173
var lastTokenBeforeEmbeddedStatement = embeddedStatement.GetFirstToken().
GetPreviousToken
();
src\Analyzers\CSharp\Analyzers\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessAnalyzer.cs (1)
180
var previousToken = expressionStatement.GetFirstToken().
GetPreviousToken
();
src\Analyzers\CSharp\Analyzers\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementDiagnosticAnalyzer.cs (1)
100
if (ContainsEndOfLineBetween(statementStartToken.
GetPreviousToken
(), statementStartToken))
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (2)
671
.WithPrependedLeadingTrivia(originalInitializer.OpenBraceToken.
GetPreviousToken
().TrailingTrivia)
680
if (initializer.OpenBraceToken.
GetPreviousToken
().TrailingTrivia.Any(static x => x.IsSingleOrMultiLineComment()))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ExpressionSyntaxExtensions.cs (1)
86
&& firstToken.
GetPreviousToken
().Kind() == SyntaxKind.CloseParenToken;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ParenthesizedExpressionSyntaxExtensions.cs (1)
46
var tokenBeforeParen = node.GetFirstToken().
GetPreviousToken
();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\StatementSyntaxExtensions.cs (1)
20
var previousToken = statement.GetFirstToken().
GetPreviousToken
();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (1)
72
var prevToken = token.
GetPreviousToken
(includeSkipped: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTokenExtensions.cs (4)
147
? token.
GetPreviousToken
(includeSkipped: true)
162
var previousToken = token.
GetPreviousToken
(includeSkipped: true, includeDirectives: true, includeDocumentationComments: true);
325
return token.
GetPreviousToken
(includeSkipped: true);
336
return token.
GetPreviousToken
(includeSkipped: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTreeExtensions.cs (3)
35
token = token.
GetPreviousToken
(includeSkipped: true);
400
token = token.
GetPreviousToken
(includeSkipped: true, includeDirectives: true);
452
token = root.EndOfFileToken.
GetPreviousToken
(includeSkipped: true, includeDirectives: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.Analyzer.cs (1)
68
var previousToken = currentToken.
GetPreviousToken
(includeSkipped: false, includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\BaseFormattingRule.cs (1)
187
firstTokenOfNode = firstTokenOfNode.
GetPreviousToken
();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\IndentBlockFormattingRule.cs (3)
250
AddIndentBlockOperation(list, bracePair.openBrace.GetNextToken(includeZeroWidth: true), bracePair.closeBrace.
GetPreviousToken
(includeZeroWidth: true));
269
AddIndentBlockOperation(list, bracketPair.openBracket.GetNextToken(includeZeroWidth: true), bracketPair.closeBracket.
GetPreviousToken
(includeZeroWidth: true));
282
var baseToken = firstToken.
GetPreviousToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (1)
375
AddSuppressAllOperationIfOnMultipleLine(list, arrayOrCollectionInitializer.OpenBraceToken.
GetPreviousToken
(includeZeroWidth: true), arrayOrCollectionInitializer.CloseBraceToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\TokenBasedFormattingRule.cs (1)
202
currentToken.
GetPreviousToken
().IsLastTokenOfNode<StatementSyntax>())
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\WrappingFormattingRule.cs (1)
73
var firstToken = firstTokenOfEmbeddedStatement.
GetPreviousToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Indentation\CSharpSmartTokenFormatter.cs (1)
83
var previousToken = token.
GetPreviousToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\FormattingRangeHelper.cs (4)
38
var previousToken = currentToken.
GetPreviousToken
();
49
previousToken = currentToken.
GetPreviousToken
();
287
var previousToken = token.
GetPreviousToken
();
309
var previousToken = startToken.
GetPreviousToken
();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TokenComparer.cs (2)
24
x.
GetPreviousToken
(includeSkipped: true).Kind() is SyntaxKind.UsingKeyword or SyntaxKind.StaticKeyword &&
25
y.
GetPreviousToken
(includeSkipped: true).Kind() is SyntaxKind.UsingKeyword or SyntaxKind.StaticKeyword)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (26)
src\Analyzers\CSharp\CodeFixes\InlineDeclaration\CSharpInlineDeclarationCodeFixProvider.cs (1)
200
if (sourceText.AreOnSameLine(declarator.GetFirstToken(), declarator.GetFirstToken().
GetPreviousToken
(includeSkipped: true)))
src\Analyzers\CSharp\CodeFixes\NewLines\ConsecutiveBracePlacement\ConsecutiveBracePlacementCodeFixProvider.cs (1)
75
var firstBrace = token.
GetPreviousToken
();
src\Analyzers\CSharp\CodeFixes\NewLines\ConstructorInitializerPlacement\ConstructorInitializerPlacementCodeFixProvider.cs (2)
55
var parenToken = colonToken.
GetPreviousToken
();
92
var closeParen = colonToken.
GetPreviousToken
();
src\Analyzers\CSharp\CodeFixes\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementCodeFixProvider.cs (1)
108
var previousToken = openBrace.
GetPreviousToken
();
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (3)
180
initializer.OpenBraceToken.
GetPreviousToken
().TrailingTrivia.Any(static x => x.IsSingleOrMultiLineComment());
184
var additionalLeadingTrivia = initializer!.OpenBraceToken.
GetPreviousToken
().TrailingTrivia
589
if (document.Text.AreOnSameLine(firstToken.
GetPreviousToken
(), firstToken))
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpUseCollectionExpressionForFluentCodeFixProvider.cs (1)
186
if (text.AreOnSameLine(firstToken.
GetPreviousToken
(), firstToken))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs (4)
48
token.
GetPreviousToken
() is { RawKind: (int)SyntaxKind.StaticKeyword, Parent: UsingDirectiveSyntax })
301
token.
GetPreviousToken
(includeSkipped: true).Kind() == SyntaxKind.IntoKeyword)
494
targetToken.
GetPreviousToken
(includeSkipped: true).IsLastTokenOfNode<TypeSyntax>())
576
targetToken = targetToken.
GetPreviousToken
(includeSkipped: true);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (7)
851
token.
GetPreviousToken
(includeSkipped: true).IsKind(SyntaxKind.IdentifierToken) &&
852
token.
GetPreviousToken
(includeSkipped: true).
GetPreviousToken
().IsKind(SyntaxKind.WhereKeyword))
1186
token.
GetPreviousToken
(includeSkipped: true).Kind() is SyntaxKind.ImplicitKeyword or SyntaxKind.ExplicitKeyword)
1372
return IsAtStartOfPattern(syntaxTree, parenthesizedExpression.GetFirstToken().
GetPreviousToken
(), parenthesizedExpression.SpanStart);
1889
token.
GetPreviousToken
(includeSkipped: true).IsKind(SyntaxKind.FixedKeyword))
2342
var previousToken = tokenOnLeftOfPosition.
GetPreviousToken
(includeSkipped: true);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Indentation\CSharpIndentationService.cs (3)
87
var previousToken = token.
GetPreviousToken
(includeZeroWidth: true);
158
constructorInitializer.ArgumentList.CloseParenToken.
GetPreviousToken
(includeZeroWidth: true),
204
node.GetLastToken(includeZeroWidth: true).
GetPreviousToken
(includeZeroWidth: true),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (2)
428
previousToken.
GetPreviousToken
().Kind() is SyntaxKind.EqualsToken or SyntaxKind.OpenParenToken or SyntaxKind.CommaToken)
818
if (previousToken.HasValue && previousToken.Value.
GetPreviousToken
().Kind() == SyntaxKind.EqualsToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Utilities\CSharpSimplificationHelpers.cs (1)
78
var previousToken = originalToken.
GetPreviousToken
();
Microsoft.CodeAnalysis.CSharp.EditorFeatures (2)
AutomaticCompletion\AutomaticLineEnderCommandHandler.cs (2)
223
var previousToken = lastToken.
GetPreviousToken
();
601
&& IsTokenPartOfExpression(switchStatementNode.GetFirstToken().
GetPreviousToken
()))
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (2)
Formatting\Indentation\SmartTokenFormatterFormatRangeTests.cs (2)
3424
if (position == endToken.SpanStart && !endToken.
GetPreviousToken
().IsKind(SyntaxKind.None))
3426
endToken = endToken.
GetPreviousToken
();
Microsoft.CodeAnalysis.CSharp.Features (62)
BraceCompletion\LessAndGreaterThanBraceCompletionService.cs (1)
59
var previousToken = token.
GetPreviousToken
();
Completion\CompletionProviders\EnumAndCompletionListTagCompletionProvider.cs (1)
297
var previousToken = token.
GetPreviousToken
();
Completion\CompletionProviders\ExplicitInterfaceTypeCompletionProvider.cs (2)
94
var tokenBeforeType = typeNode.GetFirstToken().
GetPreviousToken
();
123
tokenBeforeType = tokenBeforeType.
GetPreviousToken
();
Completion\CompletionProviders\OperatorsAndIndexer\UnnamedSymbolCompletionProvider.cs (2)
190
var questionToken = dotToken.
GetPreviousToken
().Kind() == SyntaxKind.QuestionToken
191
? dotToken.
GetPreviousToken
()
Completion\CompletionProviders\OperatorsAndIndexer\UnnamedSymbolCompletionProvider_Conversions.cs (2)
84
var questionToken = dotToken.
GetPreviousToken
().Kind() == SyntaxKind.QuestionToken
85
? dotToken.
GetPreviousToken
()
Completion\CompletionProviders\OverrideCompletionProvider.cs (2)
66
nextToken = typeSyntax.GetFirstToken().
GetPreviousToken
();
179
token = token.
GetPreviousToken
();
Completion\CompletionProviders\Scripting\DirectiveCompletionProviderUtilities.cs (1)
19
token = token.
GetPreviousToken
(includeSkipped: true, includeDirectives: true);
Completion\CompletionProviders\SymbolCompletionProvider.cs (1)
171
return token.
GetPreviousToken
().Kind() != SyntaxKind.NumericLiteralToken;
Completion\CompletionProviders\XmlDocCommentCompletionProvider.cs (1)
223
token = token.
GetPreviousToken
();
Completion\KeywordRecommenders\AnnotationsKeywordRecommender.cs (2)
20
var previousToken2 = previousToken1.
GetPreviousToken
(includeSkipped: true);
21
var previousToken3 = previousToken2.
GetPreviousToken
(includeSkipped: true);
Completion\KeywordRecommenders\ByKeywordRecommender.cs (1)
46
token.
GetPreviousToken
(includeSkipped: true) == lastToken)
Completion\KeywordRecommenders\CheckedKeywordRecommender.cs (2)
33
var previousPossiblySkippedToken = targetToken.
GetPreviousToken
(includeSkipped: true);
55
previousToken = targetToken.
GetPreviousToken
(includeSkipped: false);
Completion\KeywordRecommenders\ChecksumKeywordRecommender.cs (1)
22
var previousToken2 = previousToken1.
GetPreviousToken
(includeSkipped: true);
Completion\KeywordRecommenders\DefaultKeywordRecommender.cs (1)
37
var previousToken2 = previousToken1.
GetPreviousToken
(includeSkipped: true);
Completion\KeywordRecommenders\DisableKeywordRecommender.cs (2)
20
var previousToken2 = previousToken1.
GetPreviousToken
(includeSkipped: true);
21
var previousToken3 = previousToken2.
GetPreviousToken
(includeSkipped: true);
Completion\KeywordRecommenders\EnableKeywordRecommender.cs (2)
20
var previousToken2 = previousToken1.
GetPreviousToken
(includeSkipped: true);
30
var previousToken3 = previousToken2.
GetPreviousToken
(includeSkipped: true);
Completion\KeywordRecommenders\HiddenKeywordRecommender.cs (1)
26
var previousToken2 = previousToken1.
GetPreviousToken
(includeSkipped: true);
Completion\KeywordRecommenders\InKeywordRecommender.cs (1)
91
if (token.
GetPreviousToken
(includeSkipped: true).IsKindOrHasMatchingText(SyntaxKind.FromKeyword))
Completion\KeywordRecommenders\IntoKeywordRecommender.cs (1)
105
token = token.
GetPreviousToken
(includeSkipped: true);
Completion\KeywordRecommenders\RefKeywordRecommender.cs (1)
200
var previous = token.
GetPreviousToken
(includeSkipped: true);
Completion\KeywordRecommenders\RestoreKeywordRecommender.cs (2)
20
var previousToken2 = previousToken1.
GetPreviousToken
(includeSkipped: true);
21
var previousToken3 = previousToken2.
GetPreviousToken
(includeSkipped: true);
Completion\KeywordRecommenders\ScopedKeywordRecommender.cs (1)
37
var previous = token.
GetPreviousToken
(includeSkipped: true);
Completion\KeywordRecommenders\UsingKeywordRecommender.cs (1)
138
var previousToken = token.
GetPreviousToken
(includeSkipped: true);
Completion\KeywordRecommenders\WarningKeywordRecommender.cs (1)
28
var previousToken2 = previousToken1.
GetPreviousToken
(includeSkipped: true);
Completion\KeywordRecommenders\WarningsKeywordRecommender.cs (2)
20
var previousToken2 = previousToken1.
GetPreviousToken
(includeSkipped: true);
21
var previousToken3 = previousToken2.
GetPreviousToken
(includeSkipped: true);
Completion\KeywordRecommenders\WhereKeywordRecommender.cs (1)
101
.
GetPreviousToken
(includeZeroWidth: true)
ConvertToRawString\ConvertInterpolatedStringToRawStringCodeRefactoringProvider.cs (1)
275
if (parsedDocument.Text.AreOnSameLine(firstToken.
GetPreviousToken
(), firstToken))
Debugging\CSharpProximityExpressionsService.cs (2)
58
if (token.Kind() == SyntaxKind.CloseBraceToken && token.
GetPreviousToken
().Kind() != SyntaxKind.None)
60
token = token.
GetPreviousToken
();
DocumentationComments\CSharpDocumentationCommentSnippetService.cs (1)
87
var previousToken = firstToken.
GetPreviousToken
();
ExtractMethod\CSharpMethodExtractor.TriviaResult.cs (2)
75
TriviaLocation.BeforeBeginningOfSpan => callsite.GetFirstToken(includeZeroWidth: true).
GetPreviousToken
(includeZeroWidth: true),
81
? body.CloseBraceToken.
GetPreviousToken
(includeZeroWidth: true)
GoToDefinition\CSharpGoToDefinitionSymbolService.cs (1)
42
if (token.
GetPreviousToken
().IsKind(SyntaxKind.YieldKeyword))
Highlighting\KeywordHighlighters\AsyncAwaitHighlighter.cs (1)
105
var previousToken = mod.
GetPreviousToken
();
IntroduceVariable\CSharpIntroduceVariableService_IntroduceLocal.cs (1)
472
var priorToken = nextStatement.GetFirstToken().
GetPreviousToken
();
src\Analyzers\CSharp\Analyzers\AddBraces\CSharpAddBracesDiagnosticAnalyzer.cs (1)
173
var lastTokenBeforeEmbeddedStatement = embeddedStatement.GetFirstToken().
GetPreviousToken
();
src\Analyzers\CSharp\Analyzers\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessAnalyzer.cs (1)
180
var previousToken = expressionStatement.GetFirstToken().
GetPreviousToken
();
src\Analyzers\CSharp\Analyzers\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementDiagnosticAnalyzer.cs (1)
100
if (ContainsEndOfLineBetween(statementStartToken.
GetPreviousToken
(), statementStartToken))
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (2)
671
.WithPrependedLeadingTrivia(originalInitializer.OpenBraceToken.
GetPreviousToken
().TrailingTrivia)
680
if (initializer.OpenBraceToken.
GetPreviousToken
().TrailingTrivia.Any(static x => x.IsSingleOrMultiLineComment()))
src\Analyzers\CSharp\CodeFixes\InlineDeclaration\CSharpInlineDeclarationCodeFixProvider.cs (1)
200
if (sourceText.AreOnSameLine(declarator.GetFirstToken(), declarator.GetFirstToken().
GetPreviousToken
(includeSkipped: true)))
src\Analyzers\CSharp\CodeFixes\NewLines\ConsecutiveBracePlacement\ConsecutiveBracePlacementCodeFixProvider.cs (1)
75
var firstBrace = token.
GetPreviousToken
();
src\Analyzers\CSharp\CodeFixes\NewLines\ConstructorInitializerPlacement\ConstructorInitializerPlacementCodeFixProvider.cs (2)
55
var parenToken = colonToken.
GetPreviousToken
();
92
var closeParen = colonToken.
GetPreviousToken
();
src\Analyzers\CSharp\CodeFixes\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementCodeFixProvider.cs (1)
108
var previousToken = openBrace.
GetPreviousToken
();
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (3)
180
initializer.OpenBraceToken.
GetPreviousToken
().TrailingTrivia.Any(static x => x.IsSingleOrMultiLineComment());
184
var additionalLeadingTrivia = initializer!.OpenBraceToken.
GetPreviousToken
().TrailingTrivia
589
if (document.Text.AreOnSameLine(firstToken.
GetPreviousToken
(), firstToken))
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpUseCollectionExpressionForFluentCodeFixProvider.cs (1)
186
if (text.AreOnSameLine(firstToken.
GetPreviousToken
(), firstToken))
Structure\CSharpStructureHelpers.cs (2)
290
EnumDeclarationSyntax enumDeclaration => enumDeclaration.OpenBraceToken.
GetPreviousToken
(),
291
TypeDeclarationSyntax typeDeclaration => typeDeclaration.OpenBraceToken.
GetPreviousToken
(),
Structure\Providers\BlockSyntaxStructureProvider.cs (1)
165
var previousToken = node.GetFirstToken().
GetPreviousToken
();
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (8)
Syntax\SyntaxNodeTests.cs (8)
1111
token = token.
GetPreviousToken
();
1142
token = token.
GetPreviousToken
(includeSkipped: true);
1171
token = token.
GetPreviousToken
(includeSkipped: false);
1195
token = token.
GetPreviousToken
();
1256
var token = tree.GetCompilationUnitRoot().EndOfFileToken.
GetPreviousToken
(includeZeroWidth: true);
1260
token = token.
GetPreviousToken
(includeZeroWidth: true);
1280
SyntaxToken token = syntaxTree.GetCompilationUnitRoot().EndOfFileToken.
GetPreviousToken
(includeZeroWidth: true);
1284
token = token.
GetPreviousToken
(includeZeroWidth: true);
Microsoft.CodeAnalysis.CSharp.Workspaces (63)
Classification\Worker_Preprocesser.cs (1)
80
var lastToken = node.EndOfDirectiveToken.
GetPreviousToken
(includeSkipped: false);
CodeGeneration\CSharpSyntaxGenerator.cs (1)
3040
var previousToken = firstToken.
GetPreviousToken
();
Formatting\TypingFormattingRule.cs (1)
91
endToken = endToken.
GetPreviousToken
();
Rename\CSharpRenameRewriterLanguageService.cs (3)
379
if (!isRenameLocation && symbol is INamespaceSymbol && token.
GetPreviousToken
().IsKind(SyntaxKind.NamespaceKeyword))
398
if (isRenameLocation && token.
GetPreviousToken
().IsKind(SyntaxKind.NamespaceKeyword))
747
token.
GetPreviousToken
().Kind() != SyntaxKind.DotToken &&
Simplification\CSharpSimplificationService.cs (1)
159
var previousToken = originalToken.
GetPreviousToken
();
Simplification\Reducers\CSharpMiscellaneousReducer.cs (1)
160
if (!FormattingRangeHelper.AreTwoTokensOnSameLine(node.Parent.GetFirstToken(), node.GetFirstToken().
GetPreviousToken
()))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ExpressionSyntaxExtensions.cs (1)
86
&& firstToken.
GetPreviousToken
().Kind() == SyntaxKind.CloseParenToken;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ParenthesizedExpressionSyntaxExtensions.cs (1)
46
var tokenBeforeParen = node.GetFirstToken().
GetPreviousToken
();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\StatementSyntaxExtensions.cs (1)
20
var previousToken = statement.GetFirstToken().
GetPreviousToken
();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (1)
72
var prevToken = token.
GetPreviousToken
(includeSkipped: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTokenExtensions.cs (4)
147
? token.
GetPreviousToken
(includeSkipped: true)
162
var previousToken = token.
GetPreviousToken
(includeSkipped: true, includeDirectives: true, includeDocumentationComments: true);
325
return token.
GetPreviousToken
(includeSkipped: true);
336
return token.
GetPreviousToken
(includeSkipped: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTreeExtensions.cs (3)
35
token = token.
GetPreviousToken
(includeSkipped: true);
400
token = token.
GetPreviousToken
(includeSkipped: true, includeDirectives: true);
452
token = root.EndOfFileToken.
GetPreviousToken
(includeSkipped: true, includeDirectives: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.Analyzer.cs (1)
68
var previousToken = currentToken.
GetPreviousToken
(includeSkipped: false, includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\BaseFormattingRule.cs (1)
187
firstTokenOfNode = firstTokenOfNode.
GetPreviousToken
();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\IndentBlockFormattingRule.cs (3)
250
AddIndentBlockOperation(list, bracePair.openBrace.GetNextToken(includeZeroWidth: true), bracePair.closeBrace.
GetPreviousToken
(includeZeroWidth: true));
269
AddIndentBlockOperation(list, bracketPair.openBracket.GetNextToken(includeZeroWidth: true), bracketPair.closeBracket.
GetPreviousToken
(includeZeroWidth: true));
282
var baseToken = firstToken.
GetPreviousToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (1)
375
AddSuppressAllOperationIfOnMultipleLine(list, arrayOrCollectionInitializer.OpenBraceToken.
GetPreviousToken
(includeZeroWidth: true), arrayOrCollectionInitializer.CloseBraceToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\TokenBasedFormattingRule.cs (1)
202
currentToken.
GetPreviousToken
().IsLastTokenOfNode<StatementSyntax>())
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\WrappingFormattingRule.cs (1)
73
var firstToken = firstTokenOfEmbeddedStatement.
GetPreviousToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Indentation\CSharpSmartTokenFormatter.cs (1)
83
var previousToken = token.
GetPreviousToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\FormattingRangeHelper.cs (4)
38
var previousToken = currentToken.
GetPreviousToken
();
49
previousToken = currentToken.
GetPreviousToken
();
287
var previousToken = token.
GetPreviousToken
();
309
var previousToken = startToken.
GetPreviousToken
();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TokenComparer.cs (2)
24
x.
GetPreviousToken
(includeSkipped: true).Kind() is SyntaxKind.UsingKeyword or SyntaxKind.StaticKeyword &&
25
y.
GetPreviousToken
(includeSkipped: true).Kind() is SyntaxKind.UsingKeyword or SyntaxKind.StaticKeyword)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\CSharpSyntaxContext.cs (1)
456
var previousToken = targetToken.
GetPreviousToken
();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs (4)
48
token.
GetPreviousToken
() is { RawKind: (int)SyntaxKind.StaticKeyword, Parent: UsingDirectiveSyntax })
301
token.
GetPreviousToken
(includeSkipped: true).Kind() == SyntaxKind.IntoKeyword)
494
targetToken.
GetPreviousToken
(includeSkipped: true).IsLastTokenOfNode<TypeSyntax>())
576
targetToken = targetToken.
GetPreviousToken
(includeSkipped: true);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (18)
631
token.
GetPreviousToken
(includeSkipped: true).IsKind(SyntaxKind.GlobalKeyword))
696
token.
GetPreviousToken
().IsKind(SyntaxKind.PartialKeyword))
851
token.
GetPreviousToken
(includeSkipped: true).IsKind(SyntaxKind.IdentifierToken) &&
852
token.
GetPreviousToken
(includeSkipped: true).
GetPreviousToken
().IsKind(SyntaxKind.WhereKeyword))
1186
token.
GetPreviousToken
(includeSkipped: true).Kind() is SyntaxKind.ImplicitKeyword or SyntaxKind.ExplicitKeyword)
1372
return IsAtStartOfPattern(syntaxTree, parenthesizedExpression.GetFirstToken().
GetPreviousToken
(), parenthesizedExpression.SpanStart);
1831
var previous = token.
GetPreviousToken
(includeSkipped: true);
1889
token.
GetPreviousToken
(includeSkipped: true).IsKind(SyntaxKind.FixedKeyword))
2342
var previousToken = tokenOnLeftOfPosition.
GetPreviousToken
(includeSkipped: true);
2601
if (token.
GetPreviousToken
(includeSkipped: true).Kind() != SyntaxKind.OpenBracketToken)
2615
token.
GetPreviousToken
(includeSkipped: true).IsKind(SyntaxKind.WhileKeyword))
2631
token.
GetPreviousToken
(includeSkipped: true).IsKind(SyntaxKind.LockKeyword))
2638
token.
GetPreviousToken
(includeSkipped: true).IsKind(SyntaxKind.IfKeyword))
2645
token.
GetPreviousToken
(includeSkipped: true).IsKind(SyntaxKind.SwitchKeyword))
2652
token.
GetPreviousToken
(includeSkipped: true).IsKind(SyntaxKind.CheckedKeyword))
2659
token.
GetPreviousToken
(includeSkipped: true).IsKind(SyntaxKind.UncheckedKeyword))
2666
token.
GetPreviousToken
(includeSkipped: true).IsKind(SyntaxKind.WhenKeyword))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Indentation\CSharpIndentationService.cs (3)
87
var previousToken = token.
GetPreviousToken
(includeZeroWidth: true);
158
constructorInitializer.ArgumentList.CloseParenToken.
GetPreviousToken
(includeZeroWidth: true),
204
node.GetLastToken(includeZeroWidth: true).
GetPreviousToken
(includeZeroWidth: true),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (2)
428
previousToken.
GetPreviousToken
().Kind() is SyntaxKind.EqualsToken or SyntaxKind.OpenParenToken or SyntaxKind.CommaToken)
818
if (previousToken.HasValue && previousToken.Value.
GetPreviousToken
().Kind() == SyntaxKind.EqualsToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Utilities\CSharpSimplificationHelpers.cs (1)
78
var previousToken = originalToken.
GetPreviousToken
();
Microsoft.CodeAnalysis.Features (14)
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.PragmaHelpers.cs (1)
215
var previousOfStart = startToken.
GetPreviousToken
(includeZeroWidth: true);
CodeRefactorings\MoveType\AbstractMoveTypeService.MoveTypeEditor.cs (1)
210
var previousToken = endOfFileToken.
GetPreviousToken
(includeZeroWidth: true, includeSkipped: true);
EmbeddedLanguages\DateAndTime\LanguageServices\DateAndTimeEmbeddedLanguage.cs (1)
51
var previous = token.
GetPreviousToken
();
EmbeddedLanguages\EmbeddedLanguageDetector.cs (1)
87
if (HasLanguageComment(token.
GetPreviousToken
().TrailingTrivia, syntaxFacts, out identifier, out options))
ExtractMethod\AbstractSyntaxTriviaService.cs (1)
115
tokens[TriviaLocation.BeforeBeginningOfSpan] = tokens[TriviaLocation.AfterBeginningOfSpan].
GetPreviousToken
(includeZeroWidth: true);
ExtractMethod\AbstractSyntaxTriviaService.Result.cs (3)
116
tokens[TriviaLocation.AfterBeginningOfSpan].
GetPreviousToken
(includeZeroWidth: true) == tokens[TriviaLocation.BeforeEndOfSpan] ||
223
PreviousToken = tokens[TriviaLocation.AfterBeginningOfSpan].
GetPreviousToken
(includeZeroWidth: true),
235
PreviousToken = tokens[TriviaLocation.AfterEndOfSpan].
GetPreviousToken
(includeZeroWidth: true),
Snippets\SnippetProviders\AbstractInlineStatementSnippetProvider.cs (1)
82
var previousToken = token.
GetPreviousToken
();
Wrapping\SeparatedSyntaxList\SeparatedSyntaxListCodeActionComputer.cs (5)
132
var previousToken = _listSyntax.GetFirstToken().
GetPreviousToken
();
208
result.Add(Edit.DeleteBetween(_listSyntax.GetFirstToken().
GetPreviousToken
(), _listSyntax.GetFirstToken()));
215
result.Add(Edit.DeleteBetween(comma.
GetPreviousToken
(), comma));
297
_listSyntax.GetFirstToken().
GetPreviousToken
(), NewLineTrivia,
432
_listSyntax.GetFirstToken().
GetPreviousToken
(), NewLineTrivia,
Microsoft.CodeAnalysis.VisualBasic (1)
Compilation\SemanticModel.vb (1)
636
token = token.
GetPreviousToken
(includeSkipped:=False, includeDirectives:=False, includeDocumentationComments:=False)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (36)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\ParenthesizedExpressionSyntaxExtensions.vb (1)
181
Dim previousToken = node.OpenParenToken.
GetPreviousToken
()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\StatementSyntaxExtensions.vb (1)
696
Dim previousToken = statement.GetFirstToken().
GetPreviousToken
()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxTokenExtensions.vb (2)
197
Dim previousToken = token.
GetPreviousToken
(includeSkipped:=True, includeDirectives:=True, includeDocumentationComments:=True)
216
token.
GetPreviousToken
(includeSkipped:=True),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Indentation\VisualBasicSmartTokenFormatter.vb (1)
38
Dim previousToken = token.
GetPreviousToken
()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Utilities\TokenComparer.vb (2)
25
token1.
GetPreviousToken
().Kind = SyntaxKind.ImportsKeyword AndAlso
26
token2.
GetPreviousToken
().Kind = SyntaxKind.ImportsKeyword Then
src\Workspaces\VisualBasic\Portable\Formatting\Rules\AdjustSpaceFormattingRule.vb (1)
363
Return ContainsLineBreak(previousToken.LeadingTrivia) OrElse ContainsLineBreak(previousToken.
GetPreviousToken
(includeZeroWidth:=True).TrailingTrivia)
src\Workspaces\VisualBasic\Portable\Formatting\Rules\BaseFormattingRule.vb (2)
51
Dim previousToken = startToken.
GetPreviousToken
(includeZeroWidth:=True)
57
Dim spanStart = startToken.
GetPreviousToken
(includeZeroWidth:=True).Span.End
src\Workspaces\VisualBasic\Portable\Formatting\Rules\ElasticTriviaFormattingRule.vb (2)
31
initializer.CloseBraceToken.
GetPreviousToken
(),
49
initializer.CloseBraceToken.
GetPreviousToken
(),
src\Workspaces\VisualBasic\Portable\Formatting\Rules\NodeBasedFormattingRule.vb (24)
60
xmlDocument.GetLastToken(includeZeroWidth:=True).
GetPreviousToken
(includeZeroWidth:=True))
94
xmlNode.EndTag.LessThanSlashToken.
GetPreviousToken
(includeZeroWidth:=True))
108
xmlEmbeddedExpression.PercentGreaterThanToken.
GetPreviousToken
(includeZeroWidth:=True))
124
multiLineLambda.EndSubOrFunctionStatement.GetFirstToken(includeZeroWidth:=True).
GetPreviousToken
(includeZeroWidth:=True))
233
Dim token = endToken.
GetPreviousToken
(includeZeroWidth:=True)
279
Dim previousToken = baseToken.
GetPreviousToken
(includeZeroWidth:=True)
286
previousToken = previousToken.
GetPreviousToken
(includeZeroWidth:=True)
301
Dim previousToken = xmlToken.
GetPreviousToken
(includeZeroWidth:=True)
315
[namespace].EndNamespaceStatement.GetFirstToken(includeZeroWidth:=True).
GetPreviousToken
(includeZeroWidth:=True))
322
[module].EndBlockStatement.GetFirstToken(includeZeroWidth:=True).
GetPreviousToken
(includeZeroWidth:=True))
329
[class].EndBlockStatement.GetFirstToken(includeZeroWidth:=True).
GetPreviousToken
(includeZeroWidth:=True))
336
[struct].EndBlockStatement.GetFirstToken(includeZeroWidth:=True).
GetPreviousToken
(includeZeroWidth:=True))
343
[interface].EndBlockStatement.GetFirstToken(includeZeroWidth:=True).
GetPreviousToken
(includeZeroWidth:=True))
350
[enum].EndEnumStatement.GetFirstToken(includeZeroWidth:=True).
GetPreviousToken
(includeZeroWidth:=True))
357
[method].EndBlockStatement.GetFirstToken(includeZeroWidth:=True).
GetPreviousToken
(includeZeroWidth:=True))
364
[property].EndPropertyStatement.GetFirstToken(includeZeroWidth:=True).
GetPreviousToken
(includeZeroWidth:=True))
371
[event].EndEventStatement.GetFirstToken(includeZeroWidth:=True).
GetPreviousToken
(includeZeroWidth:=True))
378
[while].EndWhileStatement.GetFirstToken(includeZeroWidth:=True).
GetPreviousToken
(includeZeroWidth:=True))
385
[using].EndUsingStatement.GetFirstToken(includeZeroWidth:=True).
GetPreviousToken
(includeZeroWidth:=True))
392
[sync].EndSyncLockStatement.GetFirstToken(includeZeroWidth:=True).
GetPreviousToken
(includeZeroWidth:=True))
399
[with].EndWithStatement.GetFirstToken(includeZeroWidth:=True).
GetPreviousToken
(includeZeroWidth:=True))
460
[select].EndSelectStatement.GetFirstToken(includeZeroWidth:=True).
GetPreviousToken
(includeZeroWidth:=True))
474
[do].LoopStatement.GetFirstToken(includeZeroWidth:=True).
GetPreviousToken
(includeZeroWidth:=True))
487
Return node.NextStatement.GetFirstToken(includeZeroWidth:=True).
GetPreviousToken
(includeZeroWidth:=True)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (8)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ContextQuery\SyntaxTokenExtensions.vb (2)
109
targetToken.
GetPreviousToken
().IsKind(SyntaxKind.HashToken) AndAlso
110
targetToken.
GetPreviousToken
().Parent.IsKind(SyntaxKind.BadDirectiveTrivia)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ContextQuery\VisualBasicSyntaxContext.vb (1)
265
targetToken = targetToken.
GetPreviousToken
()
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Indentation\SpecialFormattingOperation.vb (2)
107
Dim endToken = closeBrace.
GetPreviousToken
(includeZeroWidth:=True)
158
endToken = closeBrace.
GetPreviousToken
(includeZeroWidth:=True)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Indentation\VisualBasicIndentationService.Indenter.vb (1)
107
Return token.
GetPreviousToken
()
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Indentation\VisualBasicIndentationService.vb (1)
67
Dim previousToken = token.
GetPreviousToken
(includeZeroWidth:=True)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Utilities\ModifierCollectionFacts.vb (1)
210
targetToken = targetToken.
GetPreviousToken
()
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures (3)
AutomaticCompletion\AutomaticLineEnderCommandHandler.vb (2)
73
lastToken = If(lastToken.Kind = SyntaxKind.EndOfFileToken, lastToken.
GetPreviousToken
(includeZeroWidth:=True), lastToken)
86
Dim nonMissingToken = If(lastToken.IsMissing, lastToken.
GetPreviousToken
(), lastToken)
EndConstructGeneration\EndConstructCommandHandler.vb (1)
177
Dim previousToken = firstToken.
GetPreviousToken
()
Microsoft.CodeAnalysis.VisualBasic.Features (10)
CodeRefactorings\InlineTemporary\VisualBasicInlineTemporaryCodeRefactoringProvider.vb (1)
315
Dim previousToken = localDeclaration.GetFirstToken().
GetPreviousToken
()
Completion\CompletionProviders\HandlesClauseCompletionProvider.vb (1)
119
Dim previousToken = token.
GetPreviousToken
()
Completion\CompletionProviders\OverrideCompletionProvider.vb (1)
132
Dim previousToken = token.
GetPreviousToken
()
Completion\CompletionProviders\SymbolCompletionProvider.vb (1)
93
Dim previousToken = token.
GetPreviousToken
()
Completion\CompletionProviders\XmlDocCommentCompletionProvider.vb (1)
60
token.
GetPreviousToken
(includeSkipped:=True),
Debugging\ProximityExpressionsGetter.vb (1)
70
token = parentEndBlock.EndKeyword.
GetPreviousToken
()
DocumentationComments\VisualBasicDocumentationCommentSnippetService.vb (1)
104
Dim previousToken = firstToken.
GetPreviousToken
()
ExtractMethod\VisualBasicMethodExtractor.TriviaResult.vb (2)
61
Return callsite.GetFirstToken(includeZeroWidth:=True).
GetPreviousToken
(includeZeroWidth:=True)
67
Return method.EndBlockStatement.GetFirstToken(includeZeroWidth:=True).
GetPreviousToken
(includeZeroWidth:=True)
Highlighting\KeywordHighlightingHelpers.vb (1)
86
Dim previousToken = .AwaitKeyword.
GetPreviousToken
()
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (1)
TestSyntaxNodes.vb (1)
1989
Dim listToken = CType(openParenToken.
GetPreviousToken
(), SyntaxToken)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (47)
Formatting\Rules\AdjustSpaceFormattingRule.vb (1)
363
Return ContainsLineBreak(previousToken.LeadingTrivia) OrElse ContainsLineBreak(previousToken.
GetPreviousToken
(includeZeroWidth:=True).TrailingTrivia)
Formatting\Rules\BaseFormattingRule.vb (2)
51
Dim previousToken = startToken.
GetPreviousToken
(includeZeroWidth:=True)
57
Dim spanStart = startToken.
GetPreviousToken
(includeZeroWidth:=True).Span.End
Formatting\Rules\ElasticTriviaFormattingRule.vb (2)
31
initializer.CloseBraceToken.
GetPreviousToken
(),
49
initializer.CloseBraceToken.
GetPreviousToken
(),
Formatting\Rules\NodeBasedFormattingRule.vb (24)
60
xmlDocument.GetLastToken(includeZeroWidth:=True).
GetPreviousToken
(includeZeroWidth:=True))
94
xmlNode.EndTag.LessThanSlashToken.
GetPreviousToken
(includeZeroWidth:=True))
108
xmlEmbeddedExpression.PercentGreaterThanToken.
GetPreviousToken
(includeZeroWidth:=True))
124
multiLineLambda.EndSubOrFunctionStatement.GetFirstToken(includeZeroWidth:=True).
GetPreviousToken
(includeZeroWidth:=True))
233
Dim token = endToken.
GetPreviousToken
(includeZeroWidth:=True)
279
Dim previousToken = baseToken.
GetPreviousToken
(includeZeroWidth:=True)
286
previousToken = previousToken.
GetPreviousToken
(includeZeroWidth:=True)
301
Dim previousToken = xmlToken.
GetPreviousToken
(includeZeroWidth:=True)
315
[namespace].EndNamespaceStatement.GetFirstToken(includeZeroWidth:=True).
GetPreviousToken
(includeZeroWidth:=True))
322
[module].EndBlockStatement.GetFirstToken(includeZeroWidth:=True).
GetPreviousToken
(includeZeroWidth:=True))
329
[class].EndBlockStatement.GetFirstToken(includeZeroWidth:=True).
GetPreviousToken
(includeZeroWidth:=True))
336
[struct].EndBlockStatement.GetFirstToken(includeZeroWidth:=True).
GetPreviousToken
(includeZeroWidth:=True))
343
[interface].EndBlockStatement.GetFirstToken(includeZeroWidth:=True).
GetPreviousToken
(includeZeroWidth:=True))
350
[enum].EndEnumStatement.GetFirstToken(includeZeroWidth:=True).
GetPreviousToken
(includeZeroWidth:=True))
357
[method].EndBlockStatement.GetFirstToken(includeZeroWidth:=True).
GetPreviousToken
(includeZeroWidth:=True))
364
[property].EndPropertyStatement.GetFirstToken(includeZeroWidth:=True).
GetPreviousToken
(includeZeroWidth:=True))
371
[event].EndEventStatement.GetFirstToken(includeZeroWidth:=True).
GetPreviousToken
(includeZeroWidth:=True))
378
[while].EndWhileStatement.GetFirstToken(includeZeroWidth:=True).
GetPreviousToken
(includeZeroWidth:=True))
385
[using].EndUsingStatement.GetFirstToken(includeZeroWidth:=True).
GetPreviousToken
(includeZeroWidth:=True))
392
[sync].EndSyncLockStatement.GetFirstToken(includeZeroWidth:=True).
GetPreviousToken
(includeZeroWidth:=True))
399
[with].EndWithStatement.GetFirstToken(includeZeroWidth:=True).
GetPreviousToken
(includeZeroWidth:=True))
460
[select].EndSelectStatement.GetFirstToken(includeZeroWidth:=True).
GetPreviousToken
(includeZeroWidth:=True))
474
[do].LoopStatement.GetFirstToken(includeZeroWidth:=True).
GetPreviousToken
(includeZeroWidth:=True))
487
Return node.NextStatement.GetFirstToken(includeZeroWidth:=True).
GetPreviousToken
(includeZeroWidth:=True)
Rename\VisualBasicRenameRewriterLanguageService.vb (2)
348
If Not isRenameLocation AndAlso TypeOf (symbol) Is INamespaceSymbol AndAlso token.
GetPreviousToken
().Kind = SyntaxKind.NamespaceKeyword Then
363
If isRenameLocation AndAlso token.
GetPreviousToken
().Kind = SyntaxKind.NamespaceKeyword Then
Simplification\Reducers\VisualBasicEscapingReducer.vb (1)
126
Dim previousToken = identifier.
GetPreviousToken
(False, False, True, True)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\ParenthesizedExpressionSyntaxExtensions.vb (1)
181
Dim previousToken = node.OpenParenToken.
GetPreviousToken
()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\StatementSyntaxExtensions.vb (1)
696
Dim previousToken = statement.GetFirstToken().
GetPreviousToken
()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxTokenExtensions.vb (2)
197
Dim previousToken = token.
GetPreviousToken
(includeSkipped:=True, includeDirectives:=True, includeDocumentationComments:=True)
216
token.
GetPreviousToken
(includeSkipped:=True),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Indentation\VisualBasicSmartTokenFormatter.vb (1)
38
Dim previousToken = token.
GetPreviousToken
()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Utilities\TokenComparer.vb (2)
25
token1.
GetPreviousToken
().Kind = SyntaxKind.ImportsKeyword AndAlso
26
token2.
GetPreviousToken
().Kind = SyntaxKind.ImportsKeyword Then
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ContextQuery\SyntaxTokenExtensions.vb (2)
109
targetToken.
GetPreviousToken
().IsKind(SyntaxKind.HashToken) AndAlso
110
targetToken.
GetPreviousToken
().Parent.IsKind(SyntaxKind.BadDirectiveTrivia)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ContextQuery\VisualBasicSyntaxContext.vb (1)
265
targetToken = targetToken.
GetPreviousToken
()
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Indentation\SpecialFormattingOperation.vb (2)
107
Dim endToken = closeBrace.
GetPreviousToken
(includeZeroWidth:=True)
158
endToken = closeBrace.
GetPreviousToken
(includeZeroWidth:=True)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Indentation\VisualBasicIndentationService.Indenter.vb (1)
107
Return token.
GetPreviousToken
()
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Indentation\VisualBasicIndentationService.vb (1)
67
Dim previousToken = token.
GetPreviousToken
(includeZeroWidth:=True)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Utilities\ModifierCollectionFacts.vb (1)
210
targetToken = targetToken.
GetPreviousToken
()
Microsoft.CodeAnalysis.Workspaces (31)
CodeCleanup\AbstractCodeCleanerService.cs (3)
260
return nextToken.
GetPreviousToken
(includeZeroWidth: true, includeSkipped: true, includeDirectives: true, includeDocumentationComments: true).Span.End;
333
var previousToken = startToken.
GetPreviousToken
(includeZeroWidth: true, includeSkipped: true, includeDirectives: true, includeDocumentationComments: true);
374
previousToken = startToken.
GetPreviousToken
(includeZeroWidth: true, includeSkipped: true, includeDirectives: true, includeDocumentationComments: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (4)
607
.
GetPreviousToken
(includeZeroWidth: false, includeSkipped: includeSkipped, includeDirectives: includeDirectives, includeDocumentationComments: includeDocumentationComments);
670
: token.
GetPreviousToken
(includeZeroWidth: false, includeSkipped: includeSkipped, includeDirectives: includeDirectives, includeDocumentationComments: includeDocumentationComments);
682
token = token.
GetPreviousToken
();
972
current = current.
GetPreviousToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTokenExtensions.cs (1)
72
var previousToken = token.
GetPreviousToken
(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs (2)
85
token = token.
GetPreviousToken
();
187
var token = endOfFileToken.
GetPreviousToken
(includeSkipped: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (3)
156
var previousToken = tokenData.Token.
GetPreviousToken
(includeZeroWidth: true);
392
Debug.Assert((token1.IndexInStream >= 0 && token2.IndexInStream >= 0) || token1.Token.Equals(token2.Token.
GetPreviousToken
(includeZeroWidth: true)) || token2.Token.LeadingTrivia.Span.Contains(token1.Token.Span));
417
Debug.Assert((token1.IndexInStream >= 0 && token2.IndexInStream >= 0) || token1.Token.Equals(token2.Token.
GetPreviousToken
(includeZeroWidth: true)) || token2.Token.LeadingTrivia.Span.Contains(token1.Token.Span));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.Node.cs (2)
36
var currentToken = token.
GetPreviousToken
(includeZeroWidth: true);
45
currentToken = currentToken.
GetPreviousToken
(includeZeroWidth: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
292
var previousToken = firstToken.
GetPreviousToken
();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\BaseIndentationFormattingRule.cs (2)
159
token1 = token1.
GetPreviousToken
();
179
token1 = token1.
GetPreviousToken
();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.Indenter.cs (2)
133
token = token.
GetPreviousToken
();
139
token = token.
GetPreviousToken
();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (1)
86
return tokenToRightOrIn.
GetPreviousToken
().GetAncestor<TNode>();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (1)
357
var previousToken = node.GetFirstToken().
GetPreviousToken
();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\CommonFormattingHelpers.cs (4)
93
startToken = startToken.
GetPreviousToken
();
100
startToken = startToken.
GetPreviousToken
();
297
var previousToken = token.
GetPreviousToken
();
362
var startToken = root.FindToken(span.Start).
GetPreviousToken
();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\AbstractRefactoringHelpersService.cs (3)
179
var previousToken = commaToken.
GetPreviousToken
();
202
: tokenOnLocation.
GetPreviousToken
(includeZeroWidth: true);
295
? tokenToLeft.
GetPreviousToken
(includeZeroWidth: true)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\AddParameterEditor.cs (1)
55
var previousToken = firstParameter.GetFirstToken().
GetPreviousToken
();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.State.cs (1)
171
var previousToken = FirstStatementAffectedInInnermostBlock.GetFirstToken().
GetPreviousToken
();
Microsoft.CodeAnalysis.Workspaces.UnitTests (3)
CodeCleanup\CodeCleanupTests.cs (2)
350
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);
Microsoft.VisualStudio.LanguageServices (1)
LanguageService\AbstractLanguageService`2.IVsLanguageTextOps.cs (1)
94
var prevToken = root.FindToken(start).
GetPreviousToken
();
Microsoft.VisualStudio.LanguageServices.CSharp (4)
CodeModel\CSharpCodeModelService.cs (3)
3198
var startToken = root.FindToken(span.Start).
GetPreviousToken
();
3201
startToken = startToken.
GetPreviousToken
();
3207
endToken = endToken.
GetPreviousToken
();
CodeModel\EndRegionFormattingRule.cs (1)
25
var previousPreviousToken = previousToken.
GetPreviousToken
();
Microsoft.VisualStudio.LanguageServices.VisualBasic (1)
CodeModel\VisualBasicCodeModelService.vb (1)
3732
Dim startToken = GetTokenWithoutAnnotation(root.FindToken(span.Start).
GetPreviousToken
(), Function(t) t.GetPreviousToken())