980 references to Span
Microsoft.AspNetCore.App.Analyzers (8)
Infrastructure\VirtualChars\AbstractVirtualCharService.cs (2)
114Debug.Assert(lastVC.Span.End == token.Span.End - "\"".Length, "Last span has to end right before the end of the string token."); 118Debug.Assert(lastVC.Span.End == token.Span.End - "\"u8".Length, "Last span has to end right before the end of the string token.");
RouteEmbeddedLanguage\Infrastructure\SyntaxNodeExtensions.cs (3)
98else if (token.Span.End < position) 104if (token.Span.Length == 0) 138if (token.Span.Length > 0 && token.SpanStart <= position)
RouteEmbeddedLanguage\RoutePatternCompletionProvider.cs (1)
103context.Position >= stringToken.Span.End)
RouteEmbeddedLanguage\RoutePatternHighlighter.cs (2)
81highlightSpans.Add(new AspNetCoreHighlightSpan(parameterSyntax.Identifier.Span, AspNetCoreHighlightSpanKind.Definition)); 103highlightSpans.Add(new AspNetCoreHighlightSpan(reference.Identifier.Span, AspNetCoreHighlightSpanKind.Reference));
Microsoft.CodeAnalysis (7)
Diagnostic\SourceLocation.cs (1)
32: this(token.SyntaxTree!, token.Span)
DiagnosticAnalyzer\AnalysisContextInfo.cs (2)
129if (token.Span.Start - lastEnd > 0) 135lastEnd = token.Span.End;
Syntax\SyntaxNode.cs (1)
1533var span = token.Span;
Syntax\SyntaxNodeOrToken.cs (1)
232return this.AsToken().Span;
Syntax\SyntaxToken.cs (2)
119/// Same as accessing <see cref="TextSpan.Start"/> on <see cref="Span"/>. 648: tree.GetLocation(Span);
Microsoft.CodeAnalysis.CodeStyle (73)
src\Analyzers\Core\Analyzers\OrderModifiers\AbstractOrderModifiersDiagnosticAnalyzer.cs (1)
82context.Tree.GetLocation(TextSpan.FromBounds(modifiers.First().SpanStart, modifiers.Last().Span.End)),
src\Analyzers\Core\Analyzers\UseObjectInitializer\AbstractUseObjectInitializerDiagnosticAnalyzer.cs (1)
148? syntaxFacts.GetOperatorTokenOfMemberAccessExpression(match.MemberAccessExpression).Span.End
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (2)
118Debug.Assert(lastVC.Span.End == token.Span.End - "\"".Length, "Last span has to end right before the end of the string token."); 122Debug.Assert(lastVC.Span.End == token.Span.End - "\"u8".Length, "Last span has to end right before the end of the string token.");
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SourceTextExtensions_SharedWithCodeStyle.cs (1)
86text.AreOnSameLine(token1.Span.End, token2.SpanStart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (10)
555if (token.Span.Length > 0 && position <= token.Span.End) 585if (token.Span.Length > 0 && token.SpanStart <= position) 629else if (token.Span.End <= position) 638while (token.RawKind != 0 && token.Span.End <= position && token.Span.End <= root.FullSpan.End); 641if (token.Span.Length == 0) 674else if (token.Span.End < position) 680if (token.Span.Length == 0) 964while (fullSpan.Contains(current.Span))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTokenExtensions.cs (2)
53=> token.Span.Length; 66previousToken.Span.End == position)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs (4)
80if ((token.Span.Contains(position) || token.Span.End == position) && predicate(semanticModel, token)) 87if (token.Span.End == position && predicate(semanticModel, token)) 153if (token.Span.End == position)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\BottomUpBaseIndentationFinder.cs (2)
59if (token.Span.End <= operation.TextSpan.Start && 374if (lastVisibleToken.Span.End <= position && operation.TextSpan.End == position)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.cs (4)
449var span = token.Span; 470var span = token.Span; 644var spanBetweenTwoTokens = TextSpan.FromBounds(token1.SpanStart, token2.Span.End); 659var spanBetweenTwoTokens = TextSpan.FromBounds(token1.SpanStart, token2.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (1)
69var span = TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (4)
184nodeOperations.AlignmentOperation.Sort(static (o1, o2) => o1.BaseToken.Span.CompareTo(o2.BaseToken.Span)); 339var endPosition = this.TreeData.IsLastToken(_endToken) ? this.TreeData.EndPosition : _endToken.Span.End; 458var spanBetweenTokens = TextSpan.FromBounds(token1.Span.End, token2.SpanStart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (1)
337var spanBetweenTokens = TextSpan.FromBounds(previousToken.Token.Span.End, currentToken.Token.SpanStart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormattingResult.cs (1)
78var span = TextSpan.FromBounds(token1.RawKind == 0 ? this.TreeInfo.StartPosition : token1.Span.End, token2.RawKind == 0 ? this.TreeInfo.EndPosition : token2.SpanStart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenData.cs (2)
76var end = this.Token.Span.End - other.Token.Span.End;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (5)
211if (token1.Span.End > token2.SpanStart) 390Debug.Assert(token1.Token.Span.End <= token2.Token.SpanStart); 392Debug.Assert((token1.IndexInStream >= 0 && token2.IndexInStream >= 0) || token1.Token.Equals(token2.Token.GetPreviousToken(includeZeroWidth: true)) || token2.Token.LeadingTrivia.Span.Contains(token1.Token.Span)); 415Debug.Assert(token1.Token.Span.End <= token2.Token.SpanStart); 417Debug.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.NodeAndText.cs (2)
44return _text.ToString(TextSpan.FromBounds(token1.Span.End, token1.FullSpan.End)); 47return _text.ToString(TextSpan.FromBounds(token1.Span.End, token2.SpanStart));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
305return TextSpan.FromBounds(firstToken.SpanStart, lastToken.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\BaseIndentationFormattingRule.cs (8)
157if (span.End < token1.Span.Start) 162if (token2.Span.End < span.Start) 174var start = token1.Span.End; 177if (span.Start <= token1.Span.Start) 180start = token1.Span.End; 190var end = token2.Span.Start; 193if (token2.Span.End <= span.End) 196end = token2.Span.Start;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\FormattingOperations.cs (3)
31=> CreateAnchorIndentationOperation(anchorToken, endToken, TextSpan.FromBounds(anchorToken.Span.End, endToken.Span.End)); 43=> CreateSuppressOperation(startToken, endToken, TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End), option);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\IndentBlockOperation.cs (1)
39Contract.ThrowIfFalse(baseToken.Span.End <= textSpan.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (3)
206return this.Token1.Span.End; 474if (ContainsOnlyWhitespace(lastToken.Span.End, lastToken.FullSpan.End)) 502for (var i = span.Start - this.Token1.Span.End; i < span.Length; i++)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (1)
97return Math.Min(afterAttributesToken.Span.Start, node.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SelectedMembers\AbstractSelectedMembers.cs (3)
155if (textSpan.OverlapsWith(id.Span)) 176position >= token.Span.End && 177text.AreOnSameLine(position, token.Span.End))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (1)
459var startOfNodeWithoutAttributes = Math.Min(afterAttributesToken.Span.Start, endOfNode);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\CommonFormattingHelpers.cs (9)
64if (currentOne.Item1.SpanStart <= previousOne.Item2.Span.End) 67previousOne = ValueTuple.Create(previousOne.Item1, previousOne.Item2.Span.End < currentOne.Item2.Span.End ? currentOne.Item2 : previousOne.Item2); 114if (endToken.Span.End < textSpan.End) 124Contract.ThrowIfFalse(startToken.Equals(endToken) || startToken.Span.End <= endToken.SpanStart); 158=> (token1.RawKind == 0) ? text.ToString(TextSpan.FromBounds(0, token2.SpanStart)) : text.ToString(TextSpan.FromBounds(token1.Span.End, token2.SpanStart)); 300return previousToken.Span.End; 318return previousToken.Span.End; 366var endPosition = endToken.RawKind == 0 ? root.Span.End : endToken.Span.End;
Microsoft.CodeAnalysis.CodeStyle.Fixes (17)
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorCodeFixProvider.cs (1)
39document, new TextSpan(typeName.Value.Span.Start, 0), forRefactoring: false, cancellationToken).ConfigureAwait(false);
src\Analyzers\Core\CodeFixes\GenerateMember\AbstractGenerateMemberCodeFixProvider.cs (1)
66if (token.Span.IntersectsWith(span))
src\Analyzers\Core\CodeFixes\ImplementAbstractClass\AbstractImplementAbstractClassCodeFixProvider.cs (1)
32if (!token.Span.IntersectsWith(context.Span))
src\Analyzers\Core\CodeFixes\ImplementInterface\AbstractImplementInterfaceCodeFixProvider.cs (1)
39if (!token.Span.IntersectsWith(span))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService_FindDeclaration.cs (1)
53return TextSpan.FromBounds(start.SpanStart, end.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\AbstractRefactoringHelpersService.cs (12)
164if (tokenOnLocation.RawKind == syntaxKinds.CommaToken && location >= tokenOnLocation.Span.End) 184else if (previousToken != default && previousToken.Span.End == commaToken.Span.Start) 191var tokenToRight = tokenOnLocation.Span.Contains(location) 200var previousToken = tokenOnLocation.Span.End == location 204tokenToLeft = previousToken.Span.End == location 219if (tokenOnLocation.Span.Start >= location) 236var tokenLine = sourceText.Lines.GetLineFromPosition(tokenOnLocation.Span.Start); 270var location = tokenToLeft.Span.End; 288if (leftNode.GetLastToken().Span.End != location && leftNode.Span.End != location) 294tokenToLeft = tokenToLeft.Span.IsEmpty 309var location = tokenToRightOrIn.Span.Start;
Microsoft.CodeAnalysis.CSharp (4)
Lowering\Instrumentation\CodeCoverageInstrumenter.cs (1)
630var startSpan = modifiers.Node != null ? modifiers.Span : (keyword.Node != null ? keyword.Span : type!.Span);
Syntax\SyntaxNodeRemover.cs (2)
344var span = TextSpan.FromBounds(token.Span.Start, node.Span.End); 378var span = TextSpan.FromBounds(node.Span.Start, token.Span.End);
Syntax\SyntaxReplacer.cs (1)
452: base(originalToken.Span, editKind, false, originalToken.IsPartOfStructuredTrivia())
Microsoft.CodeAnalysis.CSharp.CodeStyle (42)
src\Analyzers\CSharp\Analyzers\ConvertNamespace\ConvertToBlockScopedNamespaceDiagnosticAnalyzer.cs (1)
55: declaration.SyntaxTree.GetLocation(TextSpan.FromBounds(declaration.SpanStart, declaration.SemicolonToken.Span.End));
src\Analyzers\CSharp\Analyzers\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessAnalyzer.cs (3)
184var fadeLocation = Location.Create(tree, TextSpan.FromBounds(firstStatement.SpanStart, previousToken.Span.End)); 203if (nextToken.Span.Start < ifStatement.Span.End) 205fadeLocation = Location.Create(tree, TextSpan.FromBounds(nextToken.Span.Start, ifStatement.Span.End));
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryCast\CSharpRemoveUnnecessaryCastDiagnosticAnalyzer.cs (1)
32CastExpressionSyntax cast => TextSpan.FromBounds(cast.OpenParenToken.SpanStart, cast.CloseParenToken.Span.End),
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForArrayDiagnosticAnalyzer.cs (1)
222: ((ImplicitArrayCreationExpressionSyntax)expression).CloseBracketToken.Span.End)));
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForCreateDiagnosticAnalyzer.cs (1)
63invocationExpression.ArgumentList.OpenParenToken.Span.End)),
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForNewDiagnosticAnalyzer.cs (1)
105objectCreationExpression.ArgumentList.OpenParenToken.Span.End)),
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForStackAllocDiagnosticAnalyzer.cs (1)
72expression.CloseBracketToken.Span.End)));
src\Analyzers\CSharp\Analyzers\UseDefaultLiteral\CSharpUseDefaultLiteralDiagnosticAnalyzer.cs (1)
47var fadeSpan = TextSpan.FromBounds(defaultExpression.OpenParenToken.SpanStart, defaultExpression.CloseParenToken.Span.End);
src\Analyzers\CSharp\Analyzers\UseExpressionBodyForLambda\UseExpressionBodyForLambdaDiagnosticAnalyzer.cs (1)
105TextSpan.FromBounds(declaration.SpanStart, declaration.ArrowToken.Span.End));
src\Analyzers\CSharp\Analyzers\UseInferredMemberName\CSharpUseInferredMemberNameDiagnosticAnalyzer.cs (2)
55var fadeSpan = TextSpan.FromBounds(nameColon.Name.SpanStart, nameColon.ColonToken.Span.End); 81var fadeSpan = TextSpan.FromBounds(nameEquals.Name.SpanStart, nameEquals.EqualsToken.Span.End);
src\Analyzers\CSharp\Analyzers\UseUnboundGenericTypeInNameOf\CSharpUseUnboundGenericTypeInNameOfDiagnosticAnalyzer.cs (2)
81TextSpan.FromBounds(typeArgumentList.LessThanToken.Span.End, typeArgumentList.GreaterThanToken.Span.Start))]));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\BlockSyntaxExtensions.cs (1)
73conditionalDirectives.Last().Span.End >= block.CloseBraceToken.Span.End)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTokenExtensions.cs (2)
141=> token.Span.IntersectsWith(position); 238var name = SyntaxFactory.ParseName(syntaxTree.GetText(cancellationToken).ToString(TextSpan.FromBounds(genericIdentifier.SpanStart, lastToken.Span.End)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTreeExtensions.cs (12)
346if (position != token.Span.End) 354for (int i = token.SpanStart, n = token.Span.End; i < n; i++) 362for (int i = token.Span.End - 1, n = token.Span.Start; i >= n; i--) 370return token.Span.Length == startDelimeterLength || 371(token.Span.Length > startDelimeterLength && endDelimeterLength < startDelimeterLength); 376return token.Span.Length == startDelimeterLength || 377(token.Span.Length > startDelimeterLength && token.Text[^1] != lastChar); 411var span = token.Span; 427return token.SpanStart < position && token.Span.End > position; 435return token.Span.Contains(position); 457var span = token.Span;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.cs (1)
132var initialColumn = (token1.RawKind == 0) ? 0 : this.TreeInfo.GetOriginalColumn(Options.TabSize, token1) + token1.Span.Length;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaRewriter.cs (2)
108return TextSpan.FromBounds(pair.Item1.Span.End, _node.FullSpan.End); 111return TextSpan.FromBounds(pair.Item1.Span.End, pair.Item2.SpanStart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\BaseFormattingRule.cs (1)
51var endPosition = endToken.Span.End;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\IndentUserSettingsFormattingRule.cs (2)
54AddIndentBlockOperation(list, bracePair.openBrace, bracePair.openBrace, bracePair.openBrace.Span); 55AddIndentBlockOperation(list, bracePair.closeBrace, bracePair.closeBrace, bracePair.closeBrace.Span);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (1)
335var textSpan = TextSpan.FromBounds(startToken.Span.End, endToken.SpanStart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\WrappingFormattingRule.cs (1)
188var span = TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Indentation\CSharpSmartTokenFormatter.cs (2)
67_root, [TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End)], _options.FormattingOptions, smartTokenformattingRules, cancellationToken); 94var adjustedEndPosition = token.Span.End;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SemanticFacts\CSharpSemanticFacts.cs (1)
125return model.TryGetSpeculativeSemanticModelForMethodBody(oldMethod.Body.OpenBraceToken.Span.End, newMethod, out speculativeModel);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (1)
987=> TextSpan.FromBounds(body.OpenBraceToken.Span.End, body.CloseBraceToken.SpanStart);
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (10)
src\Analyzers\CSharp\CodeFixes\ConditionalExpressionInStringInterpolation\CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProvider.cs (1)
114var closeParenPosition = endToken.Span.End;
src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (2)
89return (updatedRoot, fileScopedNamespace.SemicolonToken.Span); 126return (dedentedText, fileScopedNamespace.SemicolonToken.Span);
src\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (1)
82var end = token.Span.End;
src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (1)
84var end = token.Span.End;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\CompilationUnitSyntaxExtensions.cs (1)
59? root.Members.First().GetFirstToken().Span.End
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (1)
882if (firstConstructorConstraint == null || firstConstructorConstraint.SpanStart > token.Span.End)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\TypeDeclarationSyntaxExtensions.cs (2)
28var start = destination.OpenBraceToken.Span.End; 35var start = destination.OpenBraceToken.Span.End;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Indentation\CSharpIndentationService.Indenter.cs (1)
86var endLine = sourceText.Lines.GetLineFromPosition(token.Span.End);
Microsoft.CodeAnalysis.CSharp.EditorFeatures (24)
AutomaticCompletion\AutomaticLineEnderCommandHandler.cs (11)
129return CommonFormattingHelpers.GetFormattingSpan(root, TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End)); 209var endingString = text.ToString(TextSpan.FromBounds(lastToken.Span.End, line.End)); 257if (!locatedAtTheEndOfLine && text.Lines.IndexOf(lastToken.Span.End) != line.LineNumber) 275=> lastToken.IsMissing && lastToken.Span.End == line.EndIncludingLineBreak; 585return annotatedOpenBraceToken.Span.End; 603return switchStatementNode.SwitchKeyword.Span.End; 607return switchStatementNode.CloseParenToken.Span.End; 614TryStatementSyntax tryStatementNode => tryStatementNode.TryKeyword.Span.End, 617CheckedStatementSyntax checkedStatementNode => checkedStatementNode.Keyword.Span.End, 618FieldDeclarationSyntax fieldDeclarationNode => fieldDeclarationNode.Declaration.Variables[0].Identifier.Span.End, 619EventFieldDeclarationSyntax eventFieldDeclarationNode => eventFieldDeclarationNode.Declaration.Variables[0].Identifier.Span.End,
AutomaticCompletion\AutomaticLineEnderCommandHandler_Helpers.cs (2)
57var nextCaretPosition = formattedNewRoot.GetAnnotatedTokens(s_openBracePositionAnnotation).Single().Span.End; 354var nextCaretPosition = formattedNewRoot.GetAnnotatedTokens(s_openBracePositionAnnotation).Single().Span.End;
CompleteStatement\CompleteStatementCommandHandler.cs (1)
372targetPosition = caret.Snapshot.GetPoint(((DoStatementSyntax)statementNode).CloseParenToken.Span.End);
Interactive\CSharpSendToInteractiveSubmissionProvider.cs (1)
55if (startToken != endToken && startToken.Span.End > endToken.SpanStart)
RawStringLiteral\RawStringLiteralCommandHandler_Return.cs (2)
226return interpolatedStringExpression.StringEndToken.Span.Start; 238return interpolatedStringExpression.StringStartToken.Span.End;
StringCopyPaste\KnownSourcePasteProcessor.cs (2)
238edits.Add(new TextChange(new TextSpan(interpolation.OpenBraceToken.Span.End, 0), new string('{', dollarSignsToAdd))); 239edits.Add(new TextChange(new TextSpan(interpolation.CloseBraceToken.Span.Start, 0), new string('}', dollarSignsToAdd)));
StringCopyPaste\StringInfo.cs (3)
193while (start < interpolatedString.StringStartToken.Span.End && text[start] == '"') 199while (end > interpolatedString.StringEndToken.Span.Start && text[end - 1] == '"') 219startDelimiterSpan: TextSpan.FromBounds(interpolatedString.SpanStart, interpolatedString.StringStartToken.Span.End),
TextStructureNavigation\CSharpTextStructureNavigatorProvider.cs (2)
85var start = token.Span.Start; 100var end = token.Span.End;
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (1)
Diagnostics\GetDiagnosticsTests.cs (1)
1081span = localDecl.GetLastToken().GetNextToken().Span;
Microsoft.CodeAnalysis.CSharp.Features (191)
BraceCompletion\AbstractCurlyBraceOrBracketCompletionService.cs (1)
128closingPoint = annotatedNewline.Token.Span.End;
BraceCompletion\InterpolatedStringBraceCompletionService.cs (1)
43=> IsValidOpeningBraceToken(token) && token.Span.End - 1 == position;
BraceCompletion\StringLiteralBraceCompletionService.cs (1)
74token.Span.Length > 1 &&
BraceMatching\CSharpDirectiveTriviaBraceMatcher.cs (1)
36=> TextSpan.FromBounds(directive.HashToken.SpanStart, directive.DirectiveNameToken.Span.End);
BraceMatching\StringLiteralBraceMatcher.cs (4)
45return new BraceMatchingResult(token.Span, interpolatedString.StringEndToken.Span); 52return new BraceMatchingResult(interpolatedString.StringStartToken.Span, token.Span); 66new TextSpan(token.Span.End - endTokenLength, endTokenLength)); 72new TextSpan(token.Span.End - endTokenLength, endTokenLength));
ChangeSignature\ChangeSignatureFormattingRule.cs (1)
46span = TextSpan.FromBounds(Math.Max(baseToken.Span.End, span.Start), span.End);
CodeLens\CSharpCodeLensMemberFinder.cs (14)
45_memberBuilder.Add(new CodeLensMember(node, node.Identifier.Span)); 51_memberBuilder.Add(new CodeLensMember(node, node.Identifier.Span)); 57_memberBuilder.Add(new CodeLensMember(node, node.Identifier.Span)); 63_memberBuilder.Add(new CodeLensMember(node, node.Identifier.Span)); 68_memberBuilder.Add(new CodeLensMember(node, node.Identifier.Span)); 73_memberBuilder.Add(new CodeLensMember(node, node.Identifier.Span)); 79_memberBuilder.Add(new CodeLensMember(node, node.Identifier.Span)); 84_memberBuilder.Add(new CodeLensMember(node, node.Identifier.Span)); 90_memberBuilder.Add(new CodeLensMember(node, node.Identifier.Span)); 95_memberBuilder.Add(new CodeLensMember(node, node.Identifier.Span)); 102_memberBuilder.Add(new CodeLensMember(variable, variable.Identifier.Span)); 110_memberBuilder.Add(new CodeLensMember(variable, variable.Identifier.Span)); 116_memberBuilder.Add(new CodeLensMember(node, node.Identifier.Span)); 121_memberBuilder.Add(new CodeLensMember(node, node.Identifier.Span));
Completion\CompletionProviders\OperatorsAndIndexer\UnnamedSymbolCompletionProvider_Operators.cs (2)
147dotLikeToken.Kind() == SyntaxKind.DotDotToken ? dotLikeToken.Span.Start + 1 : dotLikeToken.Span.End),
Completion\KeywordRecommenders\InKeywordRecommender.cs (1)
74if (statement != null && token.Span.End == statement.Variable.Span.End)
Completion\KeywordRecommenders\NewKeywordRecommender.cs (1)
69token.Span.End < t.CloseBraceToken.SpanStart);
ConvertNamespace\ConvertNamespaceCodeRefactoringProvider.cs (1)
79return position <= fileScopedNamespace.SemicolonToken.Span.End;
ConvertToRawString\ConvertInterpolatedStringToRawStringCodeRefactoringProvider.cs (2)
495interpolationInteriorSpans.Add(TextSpan.FromBounds(interpolation.OpenBraceToken.Span.End, interpolation.CloseBraceToken.Span.Start));
EditAndContinue\BreakpointSpans.cs (9)
110=> TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End); 116=> TextSpan.FromBounds(node.SpanStart, token.Span.End); 119=> TextSpan.FromBounds(token.SpanStart, token.Span.End); 160return nodeOrToken.AsNode()!.GetLastToken().Span.End; 221if (position < typeDeclaration.ParameterList.CloseParenToken.Span.End) 305position >= switchExpression.OpenBraceToken.Span.End && 306position <= switchExpression.CloseBraceToken.Span.Start: 442position > constructorSyntax.ExpressionBody.ArrowToken.Span.Start) 668if (position < forEachStatement.OpenParenToken.Span.End || position > forEachStatement.CloseParenToken.SpanStart)
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (55)
281Debug.Assert(span.End == switchExpression.CloseBraceToken.Span.End); 323=> position < node.OpenBraceToken.Span.End ? BlockPart.OpenBrace : BlockPart.CloseBrace; 328BlockPart.OpenBrace => node.OpenBraceToken.Span, 329BlockPart.CloseBrace => node.CloseBraceToken.Span, 342ForEachPart.ForEach => node.ForEachKeyword.Span, 343ForEachPart.VariableDeclaration => TextSpan.FromBounds(node.Type.SpanStart, node.Identifier.Span.End), 344ForEachPart.In => node.InKeyword.Span, 352ForEachPart.ForEach => node.ForEachKeyword.Span, 354ForEachPart.In => node.InKeyword.Span, 363SwitchExpressionPart.SwitchBody => TextSpan.FromBounds(node.SwitchKeyword.SpanStart, node.CloseBraceToken.Span.End), 593=> BreakpointSpans.TryGetClosestBreakpointSpan(token.Parent!, token.SpanStart, minLength: token.Span.Length, out span); 1274oldTypeDeclaration.Identifier.Span != newTypeDeclaration.Identifier.Span || 1723return typeParameter.Identifier.Span; 1756return ((BlockSyntax)node).OpenBraceToken.Span; 1760return TextSpan.FromBounds(usingStatement.UsingKeyword.SpanStart, usingStatement.CloseParenToken.Span.End); 1764return TextSpan.FromBounds(fixedStatement.FixedKeyword.SpanStart, fixedStatement.CloseParenToken.Span.End); 1768return TextSpan.FromBounds(lockStatement.LockKeyword.SpanStart, lockStatement.CloseParenToken.Span.End); 1771return ((StackAllocArrayCreationExpressionSyntax)node).StackAllocKeyword.Span; 1774return ((ImplicitStackAllocArrayCreationExpressionSyntax)node).StackAllocKeyword.Span; 1777return ((TryStatementSyntax)node).TryKeyword.Span; 1780return ((CatchClauseSyntax)node).CatchKeyword.Span; 1787return ((FinallyClauseSyntax)node).FinallyKeyword.Span; 1791return TextSpan.FromBounds(ifStatement.IfKeyword.SpanStart, ifStatement.CloseParenToken.Span.End); 1794return ((ElseClauseSyntax)node).ElseKeyword.Span; 1799(switchStatement.CloseParenToken != default) ? switchStatement.CloseParenToken.Span.End : switchStatement.Expression.Span.End); 1806return TextSpan.FromBounds(whileStatement.WhileKeyword.SpanStart, whileStatement.CloseParenToken.Span.End); 1809return ((DoStatementSyntax)node).DoKeyword.Span; 1813return TextSpan.FromBounds(forStatement.ForKeyword.SpanStart, forStatement.CloseParenToken.Span.End); 1819(commonForEachStatement.AwaitKeyword.Span.Length > 0) ? commonForEachStatement.AwaitKeyword.SpanStart : commonForEachStatement.ForEachKeyword.SpanStart, 1820commonForEachStatement.CloseParenToken.Span.End); 1823return ((LabeledStatementSyntax)node).Identifier.Span; 1827return ((CheckedStatementSyntax)node).Keyword.Span; 1830return ((UnsafeStatementSyntax)node).UnsafeKeyword.Span; 1834return lfd.Identifier.Span; 1851return CombineSpans(localDeclarationStatement.AwaitKeyword.Span, localDeclarationStatement.UsingKeyword.Span, node.Span); 1854return ((AwaitExpressionSyntax)node).AwaitKeyword.Span; 1857return ((AnonymousObjectCreationExpressionSyntax)node).NewKeyword.Span; 1867return ((AnonymousMethodExpressionSyntax)node).DelegateKeyword.Span; 1870return ((QueryExpressionSyntax)node).FromClause.FromKeyword.Span; 1877return ((QueryContinuationSyntax)node).IntoKeyword.Span; 1880return ((FromClauseSyntax)node).FromKeyword.Span; 1883return ((JoinClauseSyntax)node).JoinKeyword.Span; 1886return ((JoinIntoClauseSyntax)node).IntoKeyword.Span; 1889return ((LetClauseSyntax)node).LetKeyword.Span; 1892return ((WhereClauseSyntax)node).WhereKeyword.Span; 1895return ((OrderByClauseSyntax)node).OrderByKeyword.Span; 1902return ((SelectClauseSyntax)node).SelectKeyword.Span; 1905return ((GroupClauseSyntax)node).GroupKeyword.Span; 1921return ((SwitchExpressionSyntax)node).SwitchKeyword.Span; 1924return ((SwitchExpressionArmSyntax)node).EqualsGreaterThanToken.Span; 1944return ((ParenthesizedLambdaExpressionSyntax)lambda).ParameterList.Parameters[ordinal].Identifier.Span; 1948return ((SimpleLambdaExpressionSyntax)lambda).Parameter.Identifier.Span; 1952return ((AnonymousMethodExpressionSyntax)lambda).ParameterList!.Parameters[ordinal].Identifier.Span;
EmbeddedLanguages\CSharpTestEmbeddedLanguageClassifier.cs (2)
70var firstLine = lines.GetLineFromPosition(token.Span.Start); 71var lastLine = lines.GetLineFromPosition(token.Span.End);
ExtractMethod\CSharpSelectionValidator.cs (2)
207=> token.GetAncestors<SyntaxNode>().Any(n => CheckTopLevel(n, token.Span)); 252var blockSpan = TextSpan.FromBounds(block.OpenBraceToken.Span.End, block.CloseBraceToken.SpanStart);
GoToDefinition\CSharpGoToDefinitionSymbolService.cs (3)
38? foundContinuedLoop.GetFirstToken().Span.Start 50? foundBrokenLoop.GetLastToken().Span.End 66return foundReturnableConstruct.GetFirstToken().Span.Start;
Highlighting\KeywordHighlighters\AsyncAwaitHighlighter.cs (3)
107if (lastSpan == previousToken.Span) 109spans[^1] = TextSpan.FromBounds(lastSpan.Start, mod.Span.End); 114spans.Add(mod.Span);
Highlighting\KeywordHighlighters\CheckedExpressionHighlighter.cs (1)
28=> highlights.Add(checkedExpressionSyntax.Keyword.Span);
Highlighting\KeywordHighlighters\CheckedStatementHighlighter.cs (1)
28=> highlights.Add(checkedStatement.Keyword.Span);
Highlighting\KeywordHighlighters\IfStatementHighlighter.cs (5)
42highlights.Add(ifStatement.IfKeyword.Span); 57elseIfStatement.IfKeyword.Span.End)); 62highlights.Add(elseKeyword.Span); 63highlights.Add(elseIfStatement.IfKeyword.Span); 72highlights.Add(elseKeyword.Span);
Highlighting\KeywordHighlighters\LockStatementHighlighter.cs (1)
28=> highlights.Add(lockStatement.LockKeyword.Span);
Highlighting\KeywordHighlighters\LoopHighlighter.cs (10)
61spans.Add(statement.DoKeyword.Span); 62spans.Add(statement.WhileKeyword.Span); 63spans.Add(EmptySpan(statement.SemicolonToken.Span.End)); 67=> spans.Add(statement.ForKeyword.Span); 70=> spans.Add(statement.ForEachKeyword.Span); 73=> spans.Add(statement.WhileKeyword.Span); 85spans.Add(breakStatement.BreakKeyword.Span); 86spans.Add(EmptySpan(breakStatement.SemicolonToken.Span.End)); 90spans.Add(continueStatement.ContinueKeyword.Span); 91spans.Add(EmptySpan(continueStatement.SemicolonToken.Span.End));
Highlighting\KeywordHighlighters\RegionHighlighter.cs (1)
39directive.DirectiveNameToken.Span.End));
Highlighting\KeywordHighlighters\ReturnStatementHighlighter.cs (2)
53spans.Add(statement.ReturnKeyword.Span); 54spans.Add(EmptySpan(statement.SemicolonToken.Span.End));
Highlighting\KeywordHighlighters\SwitchStatementHighlighter.cs (8)
38spans.Add(switchStatement.SwitchKeyword.Span); 44spans.Add(label.Keyword.Span); 45spans.Add(EmptySpan(label.ColonToken.Span.End)); 63spans.Add(breakStatement.BreakKeyword.Span); 64spans.Add(EmptySpan(breakStatement.SemicolonToken.Span.End)); 76? gotoStatement.CaseOrDefaultKeyword.Span.End 77: gotoStatement.GotoKeyword.Span.End; 80spans.Add(EmptySpan(gotoStatement.SemicolonToken.Span.End));
Highlighting\KeywordHighlighters\TryStatementHighlighter.cs (4)
30highlights.Add(tryStatement.TryKeyword.Span); 34highlights.Add(catchDeclaration.CatchKeyword.Span); 38highlights.Add(catchDeclaration.Filter.WhenKeyword.Span); 44highlights.Add(tryStatement.Finally.FinallyKeyword.Span);
Highlighting\KeywordHighlighters\UnsafeStatementHighlighter.cs (1)
28=> highlights.Add(unsafeStatement.UnsafeKeyword.Span);
Highlighting\KeywordHighlighters\UsingStatementHighlighter.cs (1)
28=> highlights.Add(usingStatement.UsingKeyword.Span);
Highlighting\KeywordHighlighters\YieldStatementHighlighter.cs (2)
56statement.ReturnOrBreakKeyword.Span.End)); 58spans.Add(EmptySpan(statement.SemicolonToken.Span.End));
InlineHints\CSharpInlineTypeHintsService.cs (1)
95var span = new TextSpan(implicitNew.NewKeyword.Span.End, 0);
LineSeparators\CSharpLineSeparatorService.cs (1)
351return node.GetLastToken().Span;
MoveToNamespace\CSharpMoveToNamespaceService.cs (1)
35FileScopedNamespaceDeclarationSyntax fileScopedNamespace => fileScopedNamespace.SemicolonToken.Span.End,
QuickInfo\CSharpSyntacticQuickInfoProvider.cs (4)
75var spanEnd = openBrace.Span.End; 93return QuickInfoItem.Create(token.Span, relatedSpans: spans); 146return QuickInfoItem.Create(token.Span, relatedSpans: [regionStart.Span]); 156return QuickInfoItem.Create(token.Span, relatedSpans: matchesBefore);
Snippets\AbstractCSharpAutoPropertySnippetProvider.cs (1)
76=> propertyDeclaration.AccessorList!.CloseBraceToken.Span.End;
SplitStringLiteral\SimpleStringSplitter.cs (4)
33return _token.IsKind(SyntaxKind.Utf8StringLiteralToken) && CursorPosition >= _token.Span.End - "u8".Length; 42var suffix = Document.Text.GetSubText(TextSpan.FromBounds(CursorPosition, _token.Span.End)).ToString(); 47? Document.Text.GetSubText(TextSpan.FromBounds(_token.Span.End - "u8".Length, _token.Span.End)).ToString()
src\Analyzers\CSharp\Analyzers\ConvertNamespace\ConvertToBlockScopedNamespaceDiagnosticAnalyzer.cs (1)
55: declaration.SyntaxTree.GetLocation(TextSpan.FromBounds(declaration.SpanStart, declaration.SemicolonToken.Span.End));
src\Analyzers\CSharp\Analyzers\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessAnalyzer.cs (3)
184var fadeLocation = Location.Create(tree, TextSpan.FromBounds(firstStatement.SpanStart, previousToken.Span.End)); 203if (nextToken.Span.Start < ifStatement.Span.End) 205fadeLocation = Location.Create(tree, TextSpan.FromBounds(nextToken.Span.Start, ifStatement.Span.End));
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryCast\CSharpRemoveUnnecessaryCastDiagnosticAnalyzer.cs (1)
32CastExpressionSyntax cast => TextSpan.FromBounds(cast.OpenParenToken.SpanStart, cast.CloseParenToken.Span.End),
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForArrayDiagnosticAnalyzer.cs (1)
222: ((ImplicitArrayCreationExpressionSyntax)expression).CloseBracketToken.Span.End)));
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForCreateDiagnosticAnalyzer.cs (1)
63invocationExpression.ArgumentList.OpenParenToken.Span.End)),
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForNewDiagnosticAnalyzer.cs (1)
105objectCreationExpression.ArgumentList.OpenParenToken.Span.End)),
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForStackAllocDiagnosticAnalyzer.cs (1)
72expression.CloseBracketToken.Span.End)));
src\Analyzers\CSharp\Analyzers\UseDefaultLiteral\CSharpUseDefaultLiteralDiagnosticAnalyzer.cs (1)
47var fadeSpan = TextSpan.FromBounds(defaultExpression.OpenParenToken.SpanStart, defaultExpression.CloseParenToken.Span.End);
src\Analyzers\CSharp\Analyzers\UseExpressionBodyForLambda\UseExpressionBodyForLambdaDiagnosticAnalyzer.cs (1)
105TextSpan.FromBounds(declaration.SpanStart, declaration.ArrowToken.Span.End));
src\Analyzers\CSharp\Analyzers\UseInferredMemberName\CSharpUseInferredMemberNameDiagnosticAnalyzer.cs (2)
55var fadeSpan = TextSpan.FromBounds(nameColon.Name.SpanStart, nameColon.ColonToken.Span.End); 81var fadeSpan = TextSpan.FromBounds(nameEquals.Name.SpanStart, nameEquals.EqualsToken.Span.End);
src\Analyzers\CSharp\Analyzers\UseUnboundGenericTypeInNameOf\CSharpUseUnboundGenericTypeInNameOfDiagnosticAnalyzer.cs (2)
81TextSpan.FromBounds(typeArgumentList.LessThanToken.Span.End, typeArgumentList.GreaterThanToken.Span.Start))]));
src\Analyzers\CSharp\CodeFixes\ConditionalExpressionInStringInterpolation\CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProvider.cs (1)
114var closeParenPosition = endToken.Span.End;
src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (2)
89return (updatedRoot, fileScopedNamespace.SemicolonToken.Span); 126return (dedentedText, fileScopedNamespace.SemicolonToken.Span);
src\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (1)
82var end = token.Span.End;
src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (1)
84var end = token.Span.End;
Structure\CSharpStructureHelpers.cs (3)
32return lastTrailingCommentOrWhitespaceTrivia?.Span.End ?? firstToken.Span.End; 47var end = lastToken.Span.End; 257hintSpan: TextSpan.FromBounds(startPosition, hintTextEndToken.Span.End),
Structure\Providers\AnonymousObjectCreationExpressionStructureProvider.cs (1)
38textSpan: TextSpan.FromBounds(node.NewKeyword.Span.End, node.Span.End),
Structure\Providers\ArrowExpressionClauseStructureProvider.cs (1)
29textSpan: TextSpan.FromBounds(previousToken.Span.End, end),
Structure\Providers\BlockSyntaxStructureProvider.cs (1)
174return TextSpan.FromBounds(previousToken.Span.End, GetEnd(node));
Structure\Providers\CollectionExpressionStructureProvider.cs (2)
39? nextToken.Span.End 61var textSpan = TextSpan.FromBounds(previousToken.Span.End, node.Span.End);
Structure\Providers\InitializerExpressionStructureProvider.cs (2)
41? nextToken.Span.End 64textSpan: TextSpan.FromBounds(previousToken.Span.End, node.Span.End),
Structure\Providers\RegionDirectiveStructureProvider.cs (1)
19var prefixLength = kw.Span.End - simpleDirective.Span.Start;
Structure\Providers\SwitchExpressionStructureProvider.cs (2)
24textSpan: TextSpan.FromBounds(node.SwitchKeyword.Span.End, node.CloseBraceToken.Span.End),
Structure\Providers\SwitchStatementStructureProvider.cs (3)
24textSpan: TextSpan.FromBounds(node.CloseParenToken != default ? node.CloseParenToken.Span.End : node.Expression.Span.End, node.CloseBraceToken.Span.End), 32var start = section.Labels.Last().ColonToken.Span.End;
Wrapping\SeparatedSyntaxList\CSharpArgumentWrapper.cs (1)
91var span = TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End);
Wrapping\SeparatedSyntaxList\CSharpParameterWrapper.cs (1)
69var headerSpan = TextSpan.FromBounds(firstToken.SpanStart, lastToken.Span.End);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (1)
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (1)
3903Assert.Equal(param.Identifier.Span, symbol.Locations[0].SourceSpan);
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (8)
Parsing\ScriptParsingTests.cs (1)
9739Assert.Equal(0, endOfDirective.Span.Length);
Syntax\SyntaxAnnotationTests.cs (2)
638Assert.Equal(oldToken.Span, annotatedToken.Span);
Syntax\SyntaxDiffingTests.cs (3)
48Assert.Equal(decl.Identifier.Span, spans[0]); 68Assert.Equal(decl1.Identifier.Span, spans[0]); 70Assert.Equal(decl2.Identifier.Span, spans[1]);
Syntax\SyntaxNodeTests.cs (2)
742Assert.Equal(classDecl, root.FindNode(classDecl.Identifier.Span, findInsideTrivia: false)); 2085Assert.Equal(method.Identifier.Span, tokenLocation.SourceSpan);
Microsoft.CodeAnalysis.CSharp.Workspaces (87)
Classification\ClassificationHelpers.cs (1)
531if (token.Span.Length == span.Length)
Classification\SyntaxClassification\DiscardSyntaxClassifier.cs (1)
41result.Add(new ClassifiedSpan(parameter.Identifier.Span, ClassificationTypeNames.Keyword));
Classification\SyntaxClassification\FunctionPointerUnmanagedCallingConventionClassifier.cs (1)
34result.Add(new(ClassificationTypeNames.ClassName, callingConvention.Name.Span));
Classification\SyntaxClassification\NameSyntaxClassifier.cs (10)
189classifiedSpan = new ClassifiedSpan(token.Span, classification); 197classifiedSpan = new ClassifiedSpan(token.Span, GetClassificationForField(fieldSymbol)); 201classifiedSpan = new ClassifiedSpan(token.Span, GetClassificationForMethod(methodSymbol)); 205classifiedSpan = new ClassifiedSpan(token.Span, ClassificationTypeNames.PropertyName); 209classifiedSpan = new ClassifiedSpan(token.Span, ClassificationTypeNames.EventName); 218classifiedSpan = new ClassifiedSpan(token.Span, ClassificationTypeNames.ParameterName); 222classifiedSpan = new ClassifiedSpan(token.Span, GetClassificationForLocal(localSymbol)); 226classifiedSpan = new ClassifiedSpan(token.Span, ClassificationTypeNames.LabelName); 294result.Add(new ClassifiedSpan(token.Span, ClassificationTypeNames.Keyword)); 309result.Add(new ClassifiedSpan(name.Identifier.Span, ClassificationTypeNames.Keyword));
Classification\SyntaxClassification\OperatorOverloadSyntaxClassifier.cs (4)
57AssignmentExpressionSyntax assignmentExpression => assignmentExpression.OperatorToken.Span, 58BinaryExpressionSyntax binaryExpression => binaryExpression.OperatorToken.Span, 59PrefixUnaryExpressionSyntax prefixUnaryExpression => prefixUnaryExpression.OperatorToken.Span, 60PostfixUnaryExpressionSyntax postfixUnaryExpression => postfixUnaryExpression.OperatorToken.Span,
Classification\SyntaxClassification\SyntaxTokenClassifier.cs (2)
35if (syntaxTree.IsInPartiallyWrittenGeneric(lessThanToken.Span.End, cancellationToken, out var identifier)) 50result.Add(new ClassifiedSpan(identifier.Span, GetClassificationForType(types.First())));
Classification\Worker.cs (6)
67=> AddClassification(token.Span, type); 122var span = token.Span; 135AddClassification(TextSpan.FromBounds(token.Span.Start, token.Span.End - "u8".Length), type); 136AddClassification(TextSpan.FromBounds(token.Span.End - "u8".Length, token.Span.End), ClassificationTypeNames.Keyword);
FindSymbols\CSharpDeclaredSymbolInfoFactoryService.cs (12)
195localFunction.Identifier.Span, 239typeDeclaration.Identifier.Span, 261enumDeclaration.Identifier.Span, 289ctorDecl.Identifier.Span, 305delegateDecl.Identifier.Span, 319enumMember.Identifier.Span, 333eventDecl.Identifier.Span, 347indexerDecl.ThisKeyword.Span, 362method.Identifier.Span, 378property.Identifier.Span, 401variableDeclarator.Identifier.Span, 451parameter.Identifier.Span,
Rename\CSharpRenameRewriterLanguageService.cs (16)
209var shouldCheckTrivia = _stringAndCommentTextSpans.ContainsKey(token.Span); 334AddModifiedSpan(annotation.OriginalSpan, newToken.Span); 345var symbols = RenameUtilities.GetSymbolsTouchingPosition(token.Span.Start, _semanticModel, _solution.Services, _cancellationToken); 348var prefix = isRenameLocation && _renameLocations[token.Span].IsRenamableAccessor 385var oldSpan = token.Span; 388AddModifiedSpan(oldSpan, newToken.Span); 404token.Span, 414newToken = _renameAnnotations.WithAdditionalAnnotations(newToken, renameAnnotation, new RenameTokenSimplificationAnnotation() { OriginalTextSpan = token.Span }); 481identifierToken.Span, 518return _renameLocations.ContainsKey(token.Span); 638var oldSpan = oldToken.Span; 640AddModifiedSpan(oldSpan, newToken.Span); 680!_stringAndCommentTextSpans.TryGetValue(oldToken.Span, out subSpansToReplace))) 707newToken = newToken.CopyAnnotationsTo(_renameAnnotations.WithAdditionalAnnotations(newIdentifierToken, new RenameTokenSimplificationAnnotation() { OriginalTextSpan = oldToken.Span })); 708AddModifiedSpan(oldToken.Span, newToken.Span);
Simplification\Simplifiers\NameSimplifier.cs (1)
535issueSpan = new TextSpan(identifierToken.Span.End - 9, 9);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\BlockSyntaxExtensions.cs (1)
73conditionalDirectives.Last().Span.End >= block.CloseBraceToken.Span.End)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTokenExtensions.cs (2)
141=> token.Span.IntersectsWith(position); 238var name = SyntaxFactory.ParseName(syntaxTree.GetText(cancellationToken).ToString(TextSpan.FromBounds(genericIdentifier.SpanStart, lastToken.Span.End)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTreeExtensions.cs (12)
346if (position != token.Span.End) 354for (int i = token.SpanStart, n = token.Span.End; i < n; i++) 362for (int i = token.Span.End - 1, n = token.Span.Start; i >= n; i--) 370return token.Span.Length == startDelimeterLength || 371(token.Span.Length > startDelimeterLength && endDelimeterLength < startDelimeterLength); 376return token.Span.Length == startDelimeterLength || 377(token.Span.Length > startDelimeterLength && token.Text[^1] != lastChar); 411var span = token.Span; 427return token.SpanStart < position && token.Span.End > position; 435return token.Span.Contains(position); 457var span = token.Span;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.cs (1)
132var initialColumn = (token1.RawKind == 0) ? 0 : this.TreeInfo.GetOriginalColumn(Options.TabSize, token1) + token1.Span.Length;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaRewriter.cs (2)
108return TextSpan.FromBounds(pair.Item1.Span.End, _node.FullSpan.End); 111return TextSpan.FromBounds(pair.Item1.Span.End, pair.Item2.SpanStart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\BaseFormattingRule.cs (1)
51var endPosition = endToken.Span.End;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\IndentUserSettingsFormattingRule.cs (2)
54AddIndentBlockOperation(list, bracePair.openBrace, bracePair.openBrace, bracePair.openBrace.Span); 55AddIndentBlockOperation(list, bracePair.closeBrace, bracePair.closeBrace, bracePair.closeBrace.Span);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (1)
335var textSpan = TextSpan.FromBounds(startToken.Span.End, endToken.SpanStart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\WrappingFormattingRule.cs (1)
188var span = TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Indentation\CSharpSmartTokenFormatter.cs (2)
67_root, [TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End)], _options.FormattingOptions, smartTokenformattingRules, cancellationToken); 94var adjustedEndPosition = token.Span.End;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SemanticFacts\CSharpSemanticFacts.cs (1)
125return model.TryGetSpeculativeSemanticModelForMethodBody(oldMethod.Body.OpenBraceToken.Span.End, newMethod, out speculativeModel);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (1)
987=> TextSpan.FromBounds(body.OpenBraceToken.Span.End, body.CloseBraceToken.SpanStart);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\CompilationUnitSyntaxExtensions.cs (1)
59? root.Members.First().GetFirstToken().Span.End
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (2)
882if (firstConstructorConstraint == null || firstConstructorConstraint.SpanStart > token.Span.End) 2376position >= token.Span.End)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\TypeDeclarationSyntaxExtensions.cs (2)
28var start = destination.OpenBraceToken.Span.End; 35var start = destination.OpenBraceToken.Span.End;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Indentation\CSharpIndentationService.Indenter.cs (1)
86var endLine = sourceText.Lines.GetLineFromPosition(token.Span.End);
Microsoft.CodeAnalysis.EditorFeatures (2)
CodeActions\CodeActionEditHandlerService.cs (1)
376_renameService.StartInlineSession(openDocument, resolvedRenameToken.AsToken().Span, cancellationToken);
TextStructureNavigation\AbstractTextStructureNavigatorProvider.cs (1)
26=> new(token.Span.ToSnapshotSpan(snapshot), isSignificant: true);
Microsoft.CodeAnalysis.Features (51)
BraceMatching\AbstractBraceMatcher.cs (4)
75return new BraceMatchingResult(leftToken.Span, rightToken.Span); 83return new BraceMatchingResult(leftToken.Span, rightToken.Span);
ChangeSignature\AbstractChangeSignatureService.cs (1)
671if (position <= parameters.GetSeparator(i).Span.Start)
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.cs (1)
280var spanEnd = Math.Max(startToken.Span.End, span.End);
CodeLens\CodeLensReferencesService.cs (4)
130var spanStart = token.Span.Start - textLine.Span.Start; 143var referenceSpan = new TextSpan(spanStart, token.Span.Length); 154token.Span.Start, 155token.Span.Length,
CodeRefactorings\AddMissingImports\AbstractAddMissingImportsFeatureService.cs (2)
254_text.GetLineAndOffset(previousToken.Span.Start, out var previousLine, out _); 255_text.GetLineAndOffset(currentToken.Span.Start, out var currentLine, out _);
Completion\Providers\MemberInsertingCompletionItem.cs (1)
33KeyValuePairUtil.Create("TokenSpanEnd", token.Span.End.ToString())],
DocumentationComments\AbstractDocumentationCommentSnippetService.cs (4)
103var replaceSpan = new TextSpan(token.Span.Start, spanToReplaceLength); 313var replaceSpan = token.Span; 318var start = token.Span.Start; 359var replaceSpan = new TextSpan(token.Span.Start, 0);
DocumentHighlighting\AbstractDocumentHighlightsService.cs (1)
318? new DocumentSpan(document, token.Span)
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (3)
166=> oldToken.RawKind == newToken.RawKind && oldToken.Span.Length == newToken.Span.Length && AreEquivalentImpl(oldToken, newToken); 2226rudeEditSpan = TextSpan.FromBounds(lastNewToken.Span.End, newTokensEnum.Current.SpanStart);
EmbeddedLanguages\Classification\AbstractEmbeddedLanguageClassificationService.cs (1)
122if (token.Span.IntersectsWith(_textSpan) && _owner.SyntaxTokenKinds.Contains(token.RawKind))
ExtractMethod\AbstractSyntaxTriviaService.cs (2)
36Contract.ThrowIfFalse(textSpan.Contains(tokens[TriviaLocation.AfterBeginningOfSpan].Span) && textSpan.Contains(tokens[TriviaLocation.BeforeEndOfSpan].Span));
ExtractMethod\AbstractSyntaxTriviaService.Result.cs (1)
117tokens[TriviaLocation.AfterBeginningOfSpan].Span.End <= tokens[TriviaLocation.BeforeEndOfSpan].SpanStart);
ExtractMethod\SelectionResult.cs (1)
131var span = TextSpan.FromBounds(firstToken.SpanStart, lastToken.Span.End);
ExtractMethod\SelectionValidator.cs (2)
105? Math.Max(initialSelectionInfo.LastTokenInOriginalSpan.Span.End, adjustedSpan.End) 140var textSpan = TextSpan.FromBounds(firstTokenInOriginalSpan.SpanStart, lastTokenInOriginalSpan.Span.End);
InheritanceMargin\AbstractInheritanceMarginService_Helpers.cs (1)
99if (!spanToSearch.Contains(declarationToken.Span))
QuickInfo\CommonQuickInfoProvider.cs (2)
74token.Span.IntersectsWith(context.Position)) 87token.Span.IntersectsWith(context.Position))
QuickInfo\CommonSemanticQuickInfoProvider.cs (3)
151return token.Span == linkedToken.Span ? linkedToken : default; 178services, semanticModel, token.Span, symbols, supportedPlatforms,
Rename\SymbolicRenameInfo.cs (1)
257var triggerText = sourceText.ToString(triggerToken.Span);
SignatureHelp\CommonSignatureHelpUtilities.cs (1)
56if (position < getOpenToken(argumentList).Span.End)
SimplifyTypeNames\AbstractSimplifyTypeNamesCodeFixProvider.cs (1)
49if (!token.Span.IntersectsWith(span))
Snippets\SnippetProviders\AbstractConsoleSnippetProvider.cs (1)
71return openParenToken.Span.End;
SpellCheck\AbstractSpellCheckCodeFixProvider.cs (1)
56if (token.RawKind != 0 && token.Span == span)
SpellCheck\AbstractSpellCheckSpanService.cs (2)
138AddSpan(new SpellCheckSpan(token.Span, SpellCheckKind.String)); 236AddSpan(new SpellCheckSpan(token.Span, SpellCheckKind.Identifier));
src\Analyzers\Core\Analyzers\OrderModifiers\AbstractOrderModifiersDiagnosticAnalyzer.cs (1)
82context.Tree.GetLocation(TextSpan.FromBounds(modifiers.First().SpanStart, modifiers.Last().Span.End)),
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorCodeFixProvider.cs (1)
39document, new TextSpan(typeName.Value.Span.Start, 0), forRefactoring: false, cancellationToken).ConfigureAwait(false);
src\Analyzers\Core\CodeFixes\GenerateMember\AbstractGenerateMemberCodeFixProvider.cs (1)
66if (token.Span.IntersectsWith(span))
Wrapping\AbstractCodeActionComputer.cs (2)
179var span = TextSpan.FromBounds(edit.Left.Span.End, edit.Right.Span.Start);
Wrapping\Edit.cs (2)
26if (left.Span.End > right.Span.Start)
Wrapping\SeparatedSyntaxList\AbstractSeparatedSyntaxListWrapper.cs (2)
62if (firstToken.IsMissing || lastToken.IsMissing || firstToken.Span.IsEmpty || lastToken.Span.IsEmpty)
Wrapping\SeparatedSyntaxList\SeparatedSyntaxListCodeActionComputer.cs (1)
107var afterOpenTokenOffset = OriginalSourceText.GetOffset(openToken.Span.End);
Microsoft.CodeAnalysis.VisualBasic (13)
Binding\Binder_Query.vb (5)
836operatorNameLocation = variables.GetSeparator(i - 1).Span 1152operatorNameLocation = variables.GetSeparator(i - 1).Span 2270Dim operatorNameSpan As TextSpan = left.Span 2273operatorNameSpan = TextSpan.FromBounds(operatorNameSpan.Start, right.Span.End) 2602operatorNameLocation = orderByOrderings.GetSeparator(i - 1).Span
Binding\Binder_Utils.vb (2)
71Dim endLoc As Integer = Math.Max(badKeyword.Span.End, friendToken.Span.End)
Lowering\Instrumentation\CodeCoverageInstrumenter.vb (1)
549Dim startSpan As Text.TextSpan = If(modifiers.Node IsNot Nothing, modifiers.Span, keyword.Span)
Symbols\Source\SourceFieldSymbol.vb (1)
874Return node.Span
Symbols\Source\SourceMethodSymbol.vb (2)
179Dim endLoc As Integer = Math.Max(token.Span.End, nextToken.Span.End)
Syntax\SyntaxNodeRemover.vb (2)
240Dim span = TextSpan.FromBounds(token.Span.Start, node.Span.End) 264Dim span = TextSpan.FromBounds(node.Span.Start, token.Span.End)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (16)
src\Analyzers\VisualBasic\Analyzers\RemoveUnnecessaryCast\VisualBasicRemoveUnnecessaryCastDiagnosticAnalyzer.vb (1)
36Return node.GetFirstToken().Span
src\Analyzers\VisualBasic\Analyzers\UseInferredMemberName\VisualBasicUseInferredMemberNameDiagnosticAnalyzer.vb (2)
54Dim fadeSpan = TextSpan.FromBounds(nameColonEquals.Name.SpanStart, nameColonEquals.ColonEqualsToken.Span.End) 75Dim fadeSpan = TextSpan.FromBounds(fieldInitializer.Name.SpanStart, fieldInitializer.EqualsToken.Span.End)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\ParenthesizedExpressionSyntaxExtensions.vb (3)
141If interpolation.OpenBraceToken.Span.End = node.OpenParenToken.Span.Start AndAlso 142node.OpenParenToken.Span.End = expression.Span.Start Then
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxTokenExtensions.vb (1)
227Return token.Span.IntersectsWith(position)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxTreeExtensions.vb (3)
232position = token.Span.End AndAlso 233(token.Span.Length = startLength OrElse 234(token.Span.Length > startLength AndAlso Not token.ToString().EndsWith(lastChar, StringComparison.Ordinal)))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Indentation\VisualBasicSmartTokenFormatter.vb (1)
40Dim spans = SpecializedCollections.SingletonEnumerable(TextSpan.FromBounds(previousToken.SpanStart, token.Span.End))
src\Workspaces\VisualBasic\Portable\Formatting\Rules\BaseFormattingRule.vb (2)
52Return TextSpan.FromBounds(previousToken.Span.End, endToken.FullSpan.End) 57Dim spanStart = startToken.GetPreviousToken(includeZeroWidth:=True).Span.End
src\Workspaces\VisualBasic\Portable\Formatting\Rules\NodeBasedFormattingRule.vb (3)
79AddIndentBlockOperation(operations, baseToken, startToken, endToken, TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End)) 130AddAbsolutePositionIndentBlockOperation(operations, label.LabelToken, label.LabelToken, 0, label.LabelToken.Span) 157operations.Add(FormattingOperations.CreateIndentBlockOperation(caseBlockLastToken, nextTokenAfterCase, TextSpan.FromBounds(caseBlockLastToken.Span.End, nextTokenAfterCase.SpanStart), 1, IndentBlockOption.RelativePosition))
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (9)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ContextQuery\SyntaxTokenExtensions.vb (1)
88If Not token.LeadingTrivia.Span.Contains(originalToken.Span) Then
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ContextQuery\VisualBasicSyntaxContext.vb (1)
271If targetToken.IsKind(SyntaxKind.HashToken) AndAlso targetToken.Span.End = position Then
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Indentation\SpecialFormattingOperation.vb (3)
110baseToken, startToken, endToken, TextSpan.FromBounds(baseToken.Span.End, closeBrace.Span.End), indentationDelta, IndentBlockOption.RelativePosition)) 159span = TextSpan.FromBounds(baseToken.Span.End, closeBrace.Span.End)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Indentation\VisualBasicIndentationService.Indenter.vb (4)
73Dim firstTrivia As SyntaxTrivia = indenter.Tree.GetRoot(indenter.CancellationToken).FindTrivia(tokenOpt.Value.Span.End + 1) 103If token.Span.End <= trivia.SpanStart AndAlso Not token.IsMissing Then 116If HasLinesBetween(indenter.Tree.GetText().Lines.IndexOf(token.Span.End), indenter.LineToBeIndented.LineNumber) Then 289If IsCommaInParameters(token) AndAlso (token.Span.End <= position AndAlso position <= token.GetNextToken().SpanStart) Then
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures (14)
AutomaticCompletion\AutomaticLineEnderCommandHandler.vb (3)
76If lastToken.Kind = SyntaxKind.None OrElse line.End < lastToken.Span.End Then 89If (line.Span.Contains(nonMissingToken.Span.End)) Then 91Dim endingString = text.ToString(TextSpan.FromBounds(nonMissingToken.Span.End, line.End))
AutomaticEndConstructCorrection\AutomaticEndConstructCorrector.vb (2)
114Return {New LetterOnlyTrackingSpan(startToken.Span.ToSnapshotSpan(snapshot)), New LetterOnlyTrackingSpan(endToken.Span.ToSnapshotSpan(snapshot))}
EndConstructGeneration\EndConstructCommandHandler.vb (1)
181If(nextToken.Kind <> SyntaxKind.None, nextToken, lastToken).Span.End)
EndConstructGeneration\VisualBasicEndConstructGenerationService.vb (6)
273Dim span = TextSpan.FromBounds(asSingleLine.IfKeyword.SpanStart, asSingleLine.ThenKeyword.Span.End) 374Return InsertEndTextAndUpdateCaretPosition(textView, subjectBuffer, state.CaretPosition, state.TokenToLeft.Span.End, endText) 402Return InsertEndTextAndUpdateCaretPosition(textView, subjectBuffer, state.CaretPosition, state.TokenToLeft.Span.End, endText) 430Return InsertEndTextAndUpdateCaretPosition(textView, subjectBuffer, state.CaretPosition, state.TokenToLeft.Span.End, endTagText) 454Return InsertEndTextAndUpdateCaretPosition(textView, subjectBuffer, state.CaretPosition, state.TokenToLeft.Span.End + 1, endText) 483Return InsertEndTextAndUpdateCaretPosition(textView, subjectBuffer, state.CaretPosition, state.TokenToLeft.Span.End, endText)
TextStructureNavigation\VisualBasicTextStructureNavigatorProvider.vb (2)
36If position = token.Span.End - 1 AndAlso token.Text.EndsWith("""", StringComparison.Ordinal) Then 64If token.Kind() = SyntaxKind.StringLiteralToken AndAlso position.Position = token.Span.End - 1 AndAlso token.Text.EndsWith("""", StringComparison.Ordinal) Then
Microsoft.CodeAnalysis.VisualBasic.Features (119)
BraceCompletion\InterpolatedStringBraceCompletionService.vb (1)
27Return IsValidOpeningBraceToken(token) AndAlso token.Span.End - 1 = position
BraceMatching\InterpolatedStringBraceMatcher.vb (1)
39New TextSpan(interpolatedString.DoubleQuoteToken.Span.End - 1, 1))
BraceMatching\StringLiteralBraceMatcher.vb (2)
28If position = token.SpanStart OrElse position = token.Span.End - 1 Then 32New TextSpan(token.Span.End - 1, 1))
ChangeSignature\ChangeSignatureFormattingRule.vb (1)
30New TextSpan(firstToken.SpanStart, lastToken.Span.End - firstToken.SpanStart),
CodeFixes\GenerateEndConstruct\GenerateEndConstructCodeFixProvider.vb (1)
68If Not token.Span.IntersectsWith(context.Span) Then
CodeFixes\GenerateEvent\GenerateEventCodeFixProvider.vb (1)
48If Not token.Span.IntersectsWith(context.Span) Then
CodeFixes\IncorrectExitContinue\IncorrectExitContinueCodeFixProvider.vb (1)
65If Not token.Span.IntersectsWith(span) Then
CodeFixes\IncorrectFunctionReturnType\IncorrectFunctionReturnTypeCodeFixProvider.vb (1)
48If Not token.Span.IntersectsWith(span) Then
CodeFixes\MoveToTopOfFile\MoveToTopOfFileCodeFixProvider.vb (1)
50If Not token.Span.IntersectsWith(span) Then
CodeLens\VisualBasicCodeLensMemberFinder.vb (12)
44_memberBuilder.Add(New CodeLensMember(node, node.Identifier.Span)) 49_memberBuilder.Add(New CodeLensMember(node, node.Identifier.Span)) 54_memberBuilder.Add(New CodeLensMember(node, node.Identifier.Span)) 59_memberBuilder.Add(New CodeLensMember(node, node.Identifier.Span)) 63_memberBuilder.Add(New CodeLensMember(node, node.Identifier.Span)) 67_memberBuilder.Add(New CodeLensMember(node, node.Identifier.Span)) 72_memberBuilder.Add(New CodeLensMember(node, node.NewKeyword.Span)) 76_memberBuilder.Add(New CodeLensMember(node, node.Identifier.Span)) 81_memberBuilder.Add(New CodeLensMember(node, node.Identifier.Span)) 85_memberBuilder.Add(New CodeLensMember(node, node.Identifier.Span)) 91_memberBuilder.Add(New CodeLensMember(name, name.Identifier.Span)) 97_memberBuilder.Add(New CodeLensMember(node, node.Identifier.Span))
Debugging\DataTipInfoGetter.vb (2)
34Return New DebugDataTipInfo(token.Span, Text:=Nothing) 40New DebugDataTipInfo(token.Span, Text:=Nothing),
EditAndContinue\BreakpointSpans.vb (5)
173If position >= asSingleLine.IfKeyword.SpanStart AndAlso position < asSingleLine.ThenKeyword.Span.End Then 174Return TextSpan.FromBounds(asSingleLine.IfKeyword.SpanStart, asSingleLine.ThenKeyword.Span.End) 182Return asSingleLineElse.ElseKeyword.Span 250Return TextSpan.FromBounds(node.Identifier.Span.Start, node.Initializer.Span.End) 254Return TextSpan.FromBounds(node.Identifier.Span.Start, node.AsClause.Span.End)
EditAndContinue\DeclarationBody\PropertyWithInitializerDeclarationBody.vb (1)
37Return TextSpan.FromBounds(PropertyStatement.Identifier.Span.Start, PropertyStatement.Initializer.Span.End)
EditAndContinue\DeclarationBody\PropertyWithNewClauseDeclarationBody.vb (1)
37Return TextSpan.FromBounds(PropertyStatement.Identifier.Span.Start, PropertyStatement.AsClause.Span.End)
EditAndContinue\VisualBasicEditAndContinueAnalyzer.vb (23)
319Return BreakpointSpans.TryGetClosestBreakpointSpan(token.Parent, token.SpanStart, minLength:=token.Span.Length, span) 1166Return DirectCast(node, TypeParameterSyntax).Identifier.Span 1205Return DirectCast(node, SingleLineElseClauseSyntax).ElseKeyword.Span 1208Return DirectCast(node, TryBlockSyntax).TryStatement.TryKeyword.Span 1211Return DirectCast(node, CatchBlockSyntax).CatchStatement.CatchKeyword.Span 1214Return DirectCast(node, FinallyBlockSyntax).FinallyStatement.FinallyKeyword.Span 1240Return DirectCast(node, AwaitExpressionSyntax).AwaitKeyword.Span 1244Return TextSpan.FromBounds(newWith.NewKeyword.Span.Start, 1245newWith.Initializer.WithKeyword.Span.End) 1257Return DirectCast(node, WhereClauseSyntax).WhereKeyword.Span 1260Return DirectCast(node, SelectClauseSyntax).SelectKeyword.Span 1263Return DirectCast(node, FromClauseSyntax).FromKeyword.Span 1266Return DirectCast(node, AggregateClauseSyntax).AggregateKeyword.Span 1269Return DirectCast(node, LetClauseSyntax).LetKeyword.Span 1272Return DirectCast(node, SimpleJoinClauseSyntax).JoinKeyword.Span 1276Return TextSpan.FromBounds(groupJoin.GroupKeyword.SpanStart, groupJoin.JoinKeyword.Span.End) 1279Return DirectCast(node, GroupByClauseSyntax).GroupKeyword.Span 1291Return TextSpan.FromBounds(partition.SkipOrTakeKeyword.SpanStart, partition.WhileKeyword.Span.End) 1298Return DirectCast(node, JoinConditionSyntax).EqualsKeyword.Span 1306Return TextSpan.FromBounds(ifKeyword.Span.Start, 1307If(thenKeywordOpt.RawKind <> 0, thenKeywordOpt.Span.End, condition.Span.End)) 1386Return TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End) 1399Return TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End)
ExtractMethod\Extensions.vb (6)
253Return withBlockSpan.Contains(token.Span) 264Return initializerSpan.Contains(token.Span) 273If range.UpperBound.Span.Contains(token.Span) AndAlso 283Dim span = TextSpan.FromBounds(asNewClause.NewExpression.NewKeyword.Span.End, asNewClause.NewExpression.Span.End) 284Return span.Contains(token.Span) 288If n.CheckTopLevel(token.Span) Then
GoToDefinition\VisualBasicGoToDefinitionSymbolService.vb (2)
38Return continueTarget.GetFirstToken().Span.Start 52Return exitTarget.GetLastToken().Span.End
Highlighting\KeywordHighlighters\AccessorDeclarationHighlighter.vb (1)
39highlights.Add(TextSpan.FromBounds(firstKeyword.SpanStart, .DeclarationKeyword.Span.End))
Highlighting\KeywordHighlighters\ConditionalPreprocessorHighlighter.vb (4)
27highlights.Add(TextSpan.FromBounds(.HashToken.SpanStart, .IfOrElseIfKeyword.Span.End)) 29highlights.Add(.ThenKeyword.Span) 34highlights.Add(TextSpan.FromBounds(.HashToken.SpanStart, .ElseKeyword.Span.End)) 38highlights.Add(TextSpan.FromBounds(.HashToken.SpanStart, .IfKeyword.Span.End))
Highlighting\KeywordHighlighters\ConstructorDeclarationHighlighter.vb (1)
31highlights.Add(TextSpan.FromBounds(firstKeyword.SpanStart, .NewKeyword.Span.End))
Highlighting\KeywordHighlighters\EventDeclarationHighlighter.vb (2)
32highlights.Add(TextSpan.FromBounds(firstKeyword.SpanStart, .DeclarationKeyword.Span.End)) 35highlights.Add(.ImplementsClause.ImplementsKeyword.Span)
Highlighting\KeywordHighlighters\ForLoopBlockHighlighter.vb (6)
30highlights.Add(.ForKeyword.Span) 31highlights.Add(.ToKeyword.Span) 33highlights.Add(.StepClause.StepKeyword.Span) 38highlights.Add(TextSpan.FromBounds(.ForKeyword.SpanStart, .EachKeyword.Span.End)) 39highlights.Add(.InKeyword.Span) 52highlights.Add(nextStatement.NextKeyword.Span)
Highlighting\KeywordHighlighters\MethodDeclarationHighlighter.vb (3)
37highlights.Add(TextSpan.FromBounds(firstKeyword.SpanStart, .DeclarationKeyword.Span.End)) 40highlights.Add(.HandlesClause.HandlesKeyword.Span) 44highlights.Add(.ImplementsClause.ImplementsKeyword.Span)
Highlighting\KeywordHighlighters\MultiLineIfBlockHighlighter.vb (5)
25highlights.Add(.IfKeyword.Span) 28highlights.Add(.ThenKeyword.Span) 35highlights.Add(.ElseIfKeyword.Span) 38highlights.Add(.ThenKeyword.Span) 48highlights.Add(ifBlock.ElseBlock.ElseStatement.ElseKeyword.Span)
Highlighting\KeywordHighlighters\OperatorDeclarationHighlighter.vb (1)
31highlights.Add(TextSpan.FromBounds(firstKeyword.SpanStart, .DeclarationKeyword.Span.End))
Highlighting\KeywordHighlighters\PropertyDeclarationHighlighter.vb (2)
32highlights.Add(TextSpan.FromBounds(firstKeyword.SpanStart, .DeclarationKeyword.Span.End)) 35highlights.Add(.ImplementsClause.ImplementsKeyword.Span)
Highlighting\KeywordHighlighters\RegionHighlighter.vb (2)
37highlights.Add(TextSpan.FromBounds(region.HashToken.SpanStart, region.RegionKeyword.Span.End)) 38highlights.Add(TextSpan.FromBounds(endRegion.HashToken.SpanStart, endRegion.RegionKeyword.Span.End))
Highlighting\KeywordHighlighters\SelectBlockHighlighter.vb (1)
44highlights.Add(TextSpan.FromBounds(.CaseKeyword.SpanStart, elseKeyword.Span.End))
Highlighting\KeywordHighlighters\SingleLineIfBlockHighlighter.vb (3)
23highlights.Add(ifStatement.IfKeyword.Span) 25highlights.Add(ifStatement.ThenKeyword.Span) 28highlights.Add(ifStatement.ElseClause.ElseKeyword.Span)
Highlighting\KeywordHighlighters\XmlCDataHighlighter.vb (2)
26highlights.Add(.BeginCDataToken.Span) 27highlights.Add(.EndCDataToken.Span)
Highlighting\KeywordHighlighters\XmlCommentHighlighter.vb (2)
26highlights.Add(.LessThanExclamationMinusMinusToken.Span) 27highlights.Add(.MinusMinusGreaterThanToken.Span)
Highlighting\KeywordHighlighters\XmlDocumentPrologueHighlighter.vb (2)
26highlights.Add(.LessThanQuestionToken.Span) 27highlights.Add(.QuestionGreaterThanToken.Span)
Highlighting\KeywordHighlighters\XmlEmbeddedExpressionHighlighter.vb (2)
26highlights.Add(.LessThanPercentEqualsToken.Span) 27highlights.Add(.PercentGreaterThanToken.Span)
Highlighting\KeywordHighlighters\XmlProcessingInstructionHighlighter.vb (2)
26highlights.Add(.LessThanQuestionToken.Span) 27highlights.Add(.QuestionGreaterThanToken.Span)
Highlighting\KeywordHighlightingHelpers.vb (6)
33highlights.Add(.ReturnKeyword.Span) 87If Not previousToken.Span.IsEmpty Then 93Dim index = highlights.FindIndex(Function(s) s.Contains(previousToken.Span)) 96highlights(index) = TextSpan.FromBounds(span.Start, .AwaitKeyword.Span.End) 103highlights.Add(.AwaitKeyword.Span) 118highlights.Add(.YieldKeyword.Span)
QuickInfo\VisualBasicSemanticQuickInfoProvider.vb (2)
197Return QuickInfoItem.Create(token.Span, sections:=ImmutableArray.Create(QuickInfoSection.Create(QuickInfoSectionKinds.Description, ImmutableArray.Create(New TaggedText(TextTags.Text, VBFeaturesResources.Multiple_Types))))) 240token.Span,
src\Analyzers\VisualBasic\Analyzers\RemoveUnnecessaryCast\VisualBasicRemoveUnnecessaryCastDiagnosticAnalyzer.vb (1)
36Return node.GetFirstToken().Span
src\Analyzers\VisualBasic\Analyzers\UseInferredMemberName\VisualBasicUseInferredMemberNameDiagnosticAnalyzer.vb (2)
54Dim fadeSpan = TextSpan.FromBounds(nameColonEquals.Name.SpanStart, nameColonEquals.ColonEqualsToken.Span.End) 75Dim fadeSpan = TextSpan.FromBounds(fieldInitializer.Name.SpanStart, fieldInitializer.EqualsToken.Span.End)
Structure\Providers\CollectionInitializerStructureProvider.vb (1)
39nextToken.Span.End,
Structure\Providers\ObjectCreationInitializerStructureProvider.vb (1)
34textSpan:=TextSpan.FromBounds(previousToken.Span.End, node.Span.End),
Structure\VisualBasicStructureHelpers.vb (1)
116hintSpan:=TextSpan.FromBounds(startPosition, hintTextEndToken.Span.End),
Wrapping\SeparatedSyntaxList\VisualBasicArgumentWrapper.vb (1)
68Dim span = TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End)
Wrapping\SeparatedSyntaxList\VisualBasicParameterWrapper.vb (1)
60Dim headerSpan = TextSpan.FromBounds(firstToken.SpanStart, lastToken.Span.End)
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (2)
FlowAnalysis\FlowTestBase.vb (2)
175While startToken.Span.End <= region.Start 197Dim endPosition = endToken.Span.End
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (34)
Parser\ParseExpression.vb (1)
250Assert.True(exp.TypeArgumentList.CloseParenToken.Span.IsEmpty)
Scanner\ScannerTests.vb (3)
1121Assert.Equal(3, tk.Span.Length) 1128Assert.Equal(2, tk.Span.Length) 1135Assert.Equal(2, tk.Span.Length)
Syntax\SyntaxAnnotationTests.vb (2)
579Assert.Equal(oldToken.Span, annotatedToken.Span)
TestSyntaxNodes.vb (28)
353Assert.True(tree.FullSpan.Contains(tree.Span)) 365Assert.Equal(tree.Span.End, tree.FullSpan.End) 367VerifyListSpans(followingTrivia, New TextSpan(tree.Span.End, (tree.FullSpan.End - tree.Span.End))) 382Assert.Equal(New TextSpan(1, 1), binop.OperatorToken.Span) 487Assert.Equal(5, l(0).Span.End) 496Assert.Equal(9, param.Modifiers(0).Span.End) 504Assert.Equal(5, param.Modifiers(0).Span.End) 522Assert.Equal(5, l(0).Span.End) 524Assert.Equal(14, l(1).Span.End) 526Assert.Equal(20, l(2).Span.End) 537Assert.Equal(9, param.Modifiers(0).Span.End) 539Assert.Equal(18, param.Modifiers(1).Span.End) 541Assert.Equal(24, param.Modifiers(2).Span.End) 551Assert.Equal(9, param.Modifiers(0).Span.End) 553Assert.Equal(18, param.Modifiers(1).Span.End) 555Assert.Equal(24, param.Modifiers(2).Span.End) 688Assert.Equal(1, tok.Span.End) 704Assert.Equal(1, tok.Span.End) 731Assert.Equal(10, tok.Span.End) 771Assert.Equal(5, keyword.Span.Length) 783Assert.Equal(5, keyword.Span.Length) 792Assert.Equal(7, keyword.Span.Length) 803Assert.Equal(7, keyword.Span.Length) 923Assert.Equal(0, eof.Span.Length) 990Assert.Equal(6, kwModule.Span.Length) 996Assert.Equal(6, kwModule.Span.Length) 2271Assert.Equal(classStatement, root.FindNode(classStatement.Identifier.Span, findInsideTrivia:=False))
Microsoft.CodeAnalysis.VisualBasic.Workspaces (74)
Classification\SyntaxClassification\IdentifierNameSyntaxClassifier.vb (1)
33result.Add(New ClassifiedSpan(ClassificationTypeNames.Keyword, identifier.Span))
Classification\SyntaxClassification\ImportAliasClauseSyntaxClassifier.vb (1)
35result.Add(New ClassifiedSpan(token.Span, classification))
Classification\SyntaxClassification\NameSyntaxClassifier.vb (14)
106classifiedSpan = New ClassifiedSpan(GetNameToken(node).Span, ClassificationTypeNames.NamespaceName) 112classifiedSpan = New ClassifiedSpan(GetNameToken(node).Span, classification) 116classifiedSpan = New ClassifiedSpan(GetNameToken(node).Span, ClassificationTypeNames.EventName) 119classifiedSpan = New ClassifiedSpan(GetNameToken(node).Span, ClassificationTypeNames.PropertyName) 124classifiedSpan = New ClassifiedSpan(GetNameToken(node).Span, classification) 128classifiedSpan = New ClassifiedSpan(GetNameToken(node).Span, ClassificationTypeNames.ParameterName) 133classifiedSpan = New ClassifiedSpan(GetNameToken(node).Span, classification) 143classifiedSpan = New ClassifiedSpan(token.Span, classification) 158classifiedSpan = New ClassifiedSpan(GetNameToken(node).Span, ClassificationTypeNames.Keyword) 180classifiedSpan = New ClassifiedSpan(token.Span, ClassificationTypeNames.Keyword) 187classifiedSpan = New ClassifiedSpan(token.Span, ClassificationTypeNames.Keyword) 257result.Add(New ClassifiedSpan(token.Span, ClassificationTypeNames.Keyword)) 284result.Add(New ClassifiedSpan(methodStatement.Identifier.Span, ClassificationTypeNames.ExtensionMethodName)) 292result.Add(New ClassifiedSpan(node.LabelToken.Span, ClassificationTypeNames.LabelName))
Classification\SyntaxClassification\OperatorOverloadSyntaxClassifier.vb (2)
50Return DirectCast(syntax, BinaryExpressionSyntax).OperatorToken.Span 52Return DirectCast(syntax, UnaryExpressionSyntax).OperatorToken.Span
Classification\Worker.vb (4)
48If token.Width() > 0 AndAlso _textSpan.OverlapsWith(token.Span) Then 49AddClassification(token.Span, classificationType) 85Dim span = token.Span 90AddClassification(token.Span, type)
CodeCleanup\Providers\AddMissingTokensCodeCleanupProvider.vb (1)
451Dim span = originalToken.Span
CodeCleanup\Providers\NormalizeModifiersOrOperatorsCodeCleanupProvider.vb (1)
271Dim span = token.Span
FindSymbols\VisualBasicDeclaredSymbolInfoFactoryService.vb (9)
170blockStatement.Identifier.Span, 194enumStatement.Identifier.Span, 231constructor.NewKeyword.Span, 249delegateDecl.Identifier.Span, 263enumMember.Identifier.Span, 277eventDecl.Identifier.Span, 293funcDecl.Identifier.Span, 311propertyDecl.Identifier.Span, 329modifiedIdentifier.Identifier.Span,
Formatting\Rules\BaseFormattingRule.vb (2)
52Return TextSpan.FromBounds(previousToken.Span.End, endToken.FullSpan.End) 57Dim spanStart = startToken.GetPreviousToken(includeZeroWidth:=True).Span.End
Formatting\Rules\NodeBasedFormattingRule.vb (3)
79AddIndentBlockOperation(operations, baseToken, startToken, endToken, TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End)) 130AddAbsolutePositionIndentBlockOperation(operations, label.LabelToken, label.LabelToken, 0, label.LabelToken.Span) 157operations.Add(FormattingOperations.CreateIndentBlockOperation(caseBlockLastToken, nextTokenAfterCase, TextSpan.FromBounds(caseBlockLastToken.Span.End, nextTokenAfterCase.SpanStart), 1, IndentBlockOption.RelativePosition))
ObsoleteSymbol\VisualBasicObsoleteSymbolService.vb (1)
53result.Add(token.Span)
Rename\VisualBasicRenameRewriterLanguageService.vb (17)
294AddModifiedSpan(annotation.OriginalSpan, New TextSpan(token.Span.Start, newToken.Span.Length)) 303Dim symbols = RenameUtilities.GetSymbolsTouchingPosition(token.Span.Start, _semanticModel, _solution.Services, _cancellationToken) 306Dim prefix = If(isRenameLocation AndAlso Me._renameLocations(token.Span).IsRenamableAccessor, newToken.ValueText.Substring(0, newToken.ValueText.IndexOf("_"c) + 1), String.Empty) 354Dim oldSpan = token.Span 356AddModifiedSpan(oldSpan, newToken.Span) 370token.Span, 381newToken = Me._renameAnnotations.WithAdditionalAnnotations(newToken, renameAnnotation, New RenameTokenSimplificationAnnotation() With {.OriginalTextSpan = token.Span}) 391Return Me._renameLocations.ContainsKey(token.Span) 419Dim shouldCheckTrivia = Me._stringAndCommentTextSpans.ContainsKey(oldToken.Span) 493identifierToken.Span, 593Dim oldSpan = oldToken.Span 595AddModifiedSpan(oldSpan, newToken.Span) 628(Me._isProcessingStructuredTrivia = 0 AndAlso Not Me._stringAndCommentTextSpans.TryGetValue(oldToken.Span, subSpansToReplace)) Then 645newToken = newToken.CopyAnnotationsTo(Me._renameAnnotations.WithAdditionalAnnotations(newIdentifierToken, New RenameTokenSimplificationAnnotation() With {.OriginalTextSpan = oldToken.Span})) 646AddModifiedSpan(oldToken.Span, newToken.Span)
Simplification\Reducers\VisualBasicEscapingReducer.vb (1)
155Dim endLineOfQuery = text.Lines.GetLineFromPosition(lastTokenOfQuery.Span.End).LineNumber
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\ParenthesizedExpressionSyntaxExtensions.vb (3)
141If interpolation.OpenBraceToken.Span.End = node.OpenParenToken.Span.Start AndAlso 142node.OpenParenToken.Span.End = expression.Span.Start Then
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxTokenExtensions.vb (1)
227Return token.Span.IntersectsWith(position)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxTreeExtensions.vb (3)
232position = token.Span.End AndAlso 233(token.Span.Length = startLength OrElse 234(token.Span.Length > startLength AndAlso Not token.ToString().EndsWith(lastChar, StringComparison.Ordinal)))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Indentation\VisualBasicSmartTokenFormatter.vb (1)
40Dim spans = SpecializedCollections.SingletonEnumerable(TextSpan.FromBounds(previousToken.SpanStart, token.Span.End))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ContextQuery\SyntaxTokenExtensions.vb (1)
88If Not token.LeadingTrivia.Span.Contains(originalToken.Span) Then
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ContextQuery\VisualBasicSyntaxContext.vb (1)
271If targetToken.IsKind(SyntaxKind.HashToken) AndAlso targetToken.Span.End = position Then
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Indentation\SpecialFormattingOperation.vb (3)
110baseToken, startToken, endToken, TextSpan.FromBounds(baseToken.Span.End, closeBrace.Span.End), indentationDelta, IndentBlockOption.RelativePosition)) 159span = TextSpan.FromBounds(baseToken.Span.End, closeBrace.Span.End)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Indentation\VisualBasicIndentationService.Indenter.vb (4)
73Dim firstTrivia As SyntaxTrivia = indenter.Tree.GetRoot(indenter.CancellationToken).FindTrivia(tokenOpt.Value.Span.End + 1) 103If token.Span.End <= trivia.SpanStart AndAlso Not token.IsMissing Then 116If HasLinesBetween(indenter.Tree.GetText().Lines.IndexOf(token.Span.End), indenter.LineToBeIndented.LineNumber) Then 289If IsCommaInParameters(token) AndAlso (token.Span.End <= position AndAlso position <= token.GetNextToken().SpanStart) Then
Microsoft.CodeAnalysis.Workspaces (112)
CodeCleanup\AbstractCodeCleanerService.cs (9)
260return nextToken.GetPreviousToken(includeZeroWidth: true, includeSkipped: true, includeDirectives: true, includeDocumentationComments: true).Span.End; 263return nextToken.Span.End; 338var start = intervalTree.HasIntervalThatOverlapsWith(previousToken.SpanStart, previousToken.Span.Length) 343var end = intervalTree.HasIntervalThatOverlapsWith(nextToken.SpanStart, nextToken.Span.Length) 344? nextToken.Span.End 345: endToken.Span.End; 389if (startToken.Span.End <= endToken.SpanStart) 391return TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End); 397return startToken.Span;
FindSymbols\FindLiterals\FindLiteralsSearchEngine.cs (1)
147await _progress.OnReferenceFoundAsync(document, token.Span, cancellationToken).ConfigureAwait(false);
FindSymbols\FindReferences\FindReferenceCache.cs (1)
201var span = token.Span;
FindSymbols\SymbolFinder.cs (1)
102token.Span.IntersectsWith(position))
ObsoleteSymbol\AbstractObsoleteSymbolService.cs (8)
114if (!aliasToken.Span.IsEmpty) 119AddResult(aliasToken.Span); 127if (!creationKeyword.Span.IsEmpty) 137AddResult(creationKeyword.Span); 143if (!creationKeyword.Span.IsEmpty) 152AddResult(creationKeyword.Span); 177AddResult(token.Span); 183AddResult(token.Span);
ReassignedVariable\AbstractReassignedVariableService.cs (3)
138result.Add(syntaxFacts.GetIdentifierOfParameter(parameterSyntax).Span); 145result.Add(GetIdentifierOfVariable(variable).Span); 152result.Add(GetIdentifierOfSingleVariableDesignation(designation).Span);
Rename\SymbolicRenameLocations.ReferenceProcessing.cs (4)
371.Where(t => syntaxFactsService.IsStringLiteralOrInterpolatedStringLiteral(t) && t.Span.Length >= renameTextLength) 372.Select(t => Tuple.Create(t.ToString(), t.Span.Start, t.Span)); 390.Select(t => Tuple.Create(t.ToString(), t.Span.Start, t.Token.Span));
Shared\Extensions\SemanticModelExtensions.cs (1)
158return new TokenSemanticInfo(declaredSymbol, preprocessingSymbol, aliasSymbol, allSymbols, type, convertedType, token.Span);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (2)
118Debug.Assert(lastVC.Span.End == token.Span.End - "\"".Length, "Last span has to end right before the end of the string token."); 122Debug.Assert(lastVC.Span.End == token.Span.End - "\"u8".Length, "Last span has to end right before the end of the string token.");
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SourceTextExtensions_SharedWithCodeStyle.cs (1)
86text.AreOnSameLine(token1.Span.End, token2.SpanStart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (10)
555if (token.Span.Length > 0 && position <= token.Span.End) 585if (token.Span.Length > 0 && token.SpanStart <= position) 629else if (token.Span.End <= position) 638while (token.RawKind != 0 && token.Span.End <= position && token.Span.End <= root.FullSpan.End); 641if (token.Span.Length == 0) 674else if (token.Span.End < position) 680if (token.Span.Length == 0) 964while (fullSpan.Contains(current.Span))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTokenExtensions.cs (2)
53=> token.Span.Length; 66previousToken.Span.End == position)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs (4)
80if ((token.Span.Contains(position) || token.Span.End == position) && predicate(semanticModel, token)) 87if (token.Span.End == position && predicate(semanticModel, token)) 153if (token.Span.End == position)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\BottomUpBaseIndentationFinder.cs (2)
59if (token.Span.End <= operation.TextSpan.Start && 374if (lastVisibleToken.Span.End <= position && operation.TextSpan.End == position)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.cs (4)
449var span = token.Span; 470var span = token.Span; 644var spanBetweenTwoTokens = TextSpan.FromBounds(token1.SpanStart, token2.Span.End); 659var spanBetweenTwoTokens = TextSpan.FromBounds(token1.SpanStart, token2.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (1)
69var span = TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (4)
184nodeOperations.AlignmentOperation.Sort(static (o1, o2) => o1.BaseToken.Span.CompareTo(o2.BaseToken.Span)); 339var endPosition = this.TreeData.IsLastToken(_endToken) ? this.TreeData.EndPosition : _endToken.Span.End; 458var spanBetweenTokens = TextSpan.FromBounds(token1.Span.End, token2.SpanStart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (1)
337var spanBetweenTokens = TextSpan.FromBounds(previousToken.Token.Span.End, currentToken.Token.SpanStart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormattingResult.cs (1)
78var span = TextSpan.FromBounds(token1.RawKind == 0 ? this.TreeInfo.StartPosition : token1.Span.End, token2.RawKind == 0 ? this.TreeInfo.EndPosition : token2.SpanStart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenData.cs (2)
76var end = this.Token.Span.End - other.Token.Span.End;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (5)
211if (token1.Span.End > token2.SpanStart) 390Debug.Assert(token1.Token.Span.End <= token2.Token.SpanStart); 392Debug.Assert((token1.IndexInStream >= 0 && token2.IndexInStream >= 0) || token1.Token.Equals(token2.Token.GetPreviousToken(includeZeroWidth: true)) || token2.Token.LeadingTrivia.Span.Contains(token1.Token.Span)); 415Debug.Assert(token1.Token.Span.End <= token2.Token.SpanStart); 417Debug.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.NodeAndText.cs (2)
44return _text.ToString(TextSpan.FromBounds(token1.Span.End, token1.FullSpan.End)); 47return _text.ToString(TextSpan.FromBounds(token1.Span.End, token2.SpanStart));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
305return TextSpan.FromBounds(firstToken.SpanStart, lastToken.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\BaseIndentationFormattingRule.cs (8)
157if (span.End < token1.Span.Start) 162if (token2.Span.End < span.Start) 174var start = token1.Span.End; 177if (span.Start <= token1.Span.Start) 180start = token1.Span.End; 190var end = token2.Span.Start; 193if (token2.Span.End <= span.End) 196end = token2.Span.Start;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\FormattingOperations.cs (3)
31=> CreateAnchorIndentationOperation(anchorToken, endToken, TextSpan.FromBounds(anchorToken.Span.End, endToken.Span.End)); 43=> CreateSuppressOperation(startToken, endToken, TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End), option);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\IndentBlockOperation.cs (1)
39Contract.ThrowIfFalse(baseToken.Span.End <= textSpan.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (3)
206return this.Token1.Span.End; 474if (ContainsOnlyWhitespace(lastToken.Span.End, lastToken.FullSpan.End)) 502for (var i = span.Start - this.Token1.Span.End; i < span.Length; i++)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (1)
97return Math.Min(afterAttributesToken.Span.Start, node.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SelectedMembers\AbstractSelectedMembers.cs (3)
155if (textSpan.OverlapsWith(id.Span)) 176position >= token.Span.End && 177text.AreOnSameLine(position, token.Span.End))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (1)
459var startOfNodeWithoutAttributes = Math.Min(afterAttributesToken.Span.Start, endOfNode);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\CommonFormattingHelpers.cs (9)
64if (currentOne.Item1.SpanStart <= previousOne.Item2.Span.End) 67previousOne = ValueTuple.Create(previousOne.Item1, previousOne.Item2.Span.End < currentOne.Item2.Span.End ? currentOne.Item2 : previousOne.Item2); 114if (endToken.Span.End < textSpan.End) 124Contract.ThrowIfFalse(startToken.Equals(endToken) || startToken.Span.End <= endToken.SpanStart); 158=> (token1.RawKind == 0) ? text.ToString(TextSpan.FromBounds(0, token2.SpanStart)) : text.ToString(TextSpan.FromBounds(token1.Span.End, token2.SpanStart)); 300return previousToken.Span.End; 318return previousToken.Span.End; 366var endPosition = endToken.RawKind == 0 ? root.Span.End : endToken.Span.End;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService_FindDeclaration.cs (1)
53return TextSpan.FromBounds(start.SpanStart, end.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\AbstractRefactoringHelpersService.cs (12)
164if (tokenOnLocation.RawKind == syntaxKinds.CommaToken && location >= tokenOnLocation.Span.End) 184else if (previousToken != default && previousToken.Span.End == commaToken.Span.Start) 191var tokenToRight = tokenOnLocation.Span.Contains(location) 200var previousToken = tokenOnLocation.Span.End == location 204tokenToLeft = previousToken.Span.End == location 219if (tokenOnLocation.Span.Start >= location) 236var tokenLine = sourceText.Lines.GetLineFromPosition(tokenOnLocation.Span.Start); 270var location = tokenToLeft.Span.End; 288if (leftNode.GetLastToken().Span.End != location && leftNode.Span.End != location) 294tokenToLeft = tokenToLeft.Span.IsEmpty 309var location = tokenToRightOrIn.Span.Start;
Microsoft.CodeAnalysis.Workspaces.UnitTests (1)
CodeCleanup\Extensions.cs (1)
23return TextSpan.FromBounds(previousToken.SpanStart, endToken.Span.End);
Microsoft.VisualStudio.LanguageServices (4)
LanguageService\AbstractLanguageService`2.IVsLanguageTextOps.cs (1)
97start = prevToken.Span.Start;
Venus\ContainedDocument.cs (3)
975if (token.Span.Start == end && service != null) 977if (service.TryGetCorrespondingOpenBrace(token, out var openBrace) && !textSpan.Contains(openBrace.Span)) 999if (token.Span.End == textSpan.End && syntaxFact != null)
Microsoft.VisualStudio.LanguageServices.CSharp (20)
CodeModel\CSharpCodeModelService.NodeLocator.cs (20)
139var openBraceLine = text.Lines.GetLineFromPosition(openBrace.Span.End); 140var textAfterBrace = text.ToString(TextSpan.FromBounds(openBrace.Span.End, openBraceLine.End)); 144: new VirtualTreePoint(openBrace.SyntaxTree, text, openBrace.Span.End); 202return new VirtualTreePoint(openBrace.SyntaxTree, text, openBrace.Span.End); 900endPosition = node.AttributeLists.Last().GetLastToken().Span.End; 908endPosition = node.Identifier.Span.End; 941endPosition = node.AttributeLists.Last().GetLastToken().Span.End; 958endPosition = ((MethodDeclarationSyntax)node).Identifier.Span.End; 961endPosition = ((ConstructorDeclarationSyntax)node).Identifier.Span.End; 964endPosition = ((DestructorDeclarationSyntax)node).Identifier.Span.End; 967endPosition = ((ConversionOperatorDeclarationSyntax)node).ImplicitOrExplicitKeyword.Span.End; 970endPosition = ((OperatorDeclarationSyntax)node).OperatorToken.Span.End; 973endPosition = node.GetFirstTokenAfterAttributes().Span.End; 1122endPosition = node.Identifier.Span.End; 1237endPosition = node.AttributeLists.Last().GetLastToken().Span.End; 1248endPosition = node.Identifier.Span.End; 1279endPosition = field.AttributeLists.Last().GetLastToken().Span.End; 1290endPosition = node.Identifier.Span.End; 1320endPosition = node.AttributeLists.Last().GetLastToken().Span.End; 1331endPosition = node.Identifier.Span.End;
Microsoft.VisualStudio.LanguageServices.VisualBasic (36)
CodeModel\VisualBasicCodeModelService.NodeLocator.vb (12)
265startPosition = attributes.Last().GreaterThanToken.Span.End 365startPosition = typeBlock.BlockStatement.Identifier.Span.End 436startPosition = enumBlock.EnumStatement.Identifier.Span.End 557endPosition = declareStatement.Identifier.Span.End 624startPosition = DirectCast(methodBlock.BlockStatement, SubNewStatementSyntax).NewKeyword.Span.End 627startPosition = DirectCast(methodBlock.BlockStatement, MethodStatementSyntax).Identifier.Span.End 629startPosition = DirectCast(methodBlock.BlockStatement, OperatorStatementSyntax).OperatorToken.Span.End 677endPosition = methodStatement.Identifier.Span.End 750startPosition = propertyStatement.Identifier.Span.End 873startPosition = eventStatement.Identifier.Span.End 948endPosition = delegateStatement.Identifier.Span.End 1158endPosition = enumMember.Identifier.Span.End
CodeModel\VisualBasicCodeModelService.vb (2)
4072position = methodStatement.ParameterList.CloseParenToken.Span.End 4133text = text.Replace(TextSpan.FromBounds(clauseItemToRemove.SpanStart, methodStatement.HandlesClause.Events.GetSeparator(0).Span.End), String.Empty)
Help\VisualBasicHelpContextService.vb (2)
47If token.Span.IntersectsWith(span) OrElse token.GetAncestor(Of XmlElementSyntax)() IsNot Nothing Then 48Dim visitor = New Visitor(token.Span, Await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(False), document.Project.Solution.WorkspaceKind <> WorkspaceKind.MetadataAsSource, Me, cancellationToken)
Help\VisualBasicHelpContextService.Visitor.vb (20)
169If node.ThenKeyword.Span.IntersectsWith(_span) Then 177If node.ThenKeyword.Span.IntersectsWith(_span) Then 185If node.ThenKeyword.Span.IntersectsWith(_span) Then 253If node.InKeyword.Span.IntersectsWith(_span) Then 255ElseIf node.EachKeyword.Span.IntersectsWith(_span) Then 263If node.ToKeyword.Span.IntersectsWith(_span) Then 265ElseIf node.StepClause.StepKeyword.Span.IntersectsWith(_span) Then 277If node.VarianceKeyword.Span.IntersectsWith(_span) Then 303If node.IntoKeyword.Span.IntersectsWith(_span) Then 311If node.OnKeyword.Span.IntersectsWith(_span) Then 313ElseIf node.IntoKeyword.Span.IntersectsWith(_span) Then 376ElseIf node.Identifier.Span.IntersectsWith(_span) AndAlso 415If node.KeyKeyword.Span.IntersectsWith(_span) Then 520If node.Name.Span.IntersectsWith(_span) Then 771If modifier.Span.IntersectsWith(_span) Then 831If node.OfKeyword.Span.IntersectsWith(_span) Then 924If node.InKeyword.Span.IntersectsWith(_span) Then 933If node.OperatorToken.Span.IntersectsWith(_span) Then 937If node.DeclarationKeyword.Span.IntersectsWith(_span) Then 948If Not token.Span.IntersectsWith(_span) Then