1060 references to Span
ConfigurationSchemaGenerator (1)
RuntimeSource\Configuration.Binder\Specs\InterceptorInfo.cs (1)
180TextSpan memberNameSpan = memberAccessExprSyntax.Name.Span;
Microsoft.Analyzers.Extra (1)
CallAnalysis\Fixers\LegacyLoggingFixer.cs (1)
326return (doc, (root!.FindNode(invocationExpression.Span) as ExpressionSyntax)!);
Microsoft.AspNetCore.App.Analyzers (1)
Infrastructure\VirtualChars\CSharpVirtualCharService.cs (1)
200var indentationLength = parentSourceText.Lines.GetLineFromPosition(parentExpression.Span.End).GetFirstNonWhitespaceOffset() ?? 0;
Microsoft.AspNetCore.Http.RequestDelegateGenerator (1)
StaticRouteHandlerModel\Endpoint.cs (1)
162var invocationNameSpan = memberAccessorExpression.Name.Span;
Microsoft.CodeAnalysis (13)
Diagnostic\SourceLocation.cs (1)
27: this(node.SyntaxTree, node.Span)
DiagnosticAnalyzer\AnalysisContextInfo.cs (3)
112var lineSpan = text?.Lines?.GetLinePositionSpan(_node.Span); 115sb.AppendLine($"{nameof(SyntaxNode)}: {GetFlattenedNodeText(_node)} [{_node.GetType().Name}]@{_node.Span} {(lineSpan.HasValue ? lineSpan.Value.ToString() : string.Empty)}"); 125var lastEnd = node.Span.Start;
DiagnosticAnalyzer\AnalyzerExecutor.cs (2)
1469_isGeneratedCodeLocation(node.SyntaxTree, node.Span, cancellationToken)) 1481_isGeneratedCodeLocation(operation.Syntax.SyntaxTree, operation.Syntax.Span, cancellationToken))
Operations\OperationExtensions.cs (1)
63return model.GetDiagnostics(operation.Syntax.Span, cancellationToken).Any(static d => d.DefaultSeverity == DiagnosticSeverity.Error);
Syntax\SyntaxList`1.cs (2)
185return TextSpan.FromBounds(this[0].Span.Start, this[this.Count - 1].Span.End);
Syntax\SyntaxNode.cs (2)
113/// Same as accessing <see cref="TextSpan.Start"/> on <see cref="Span"/>. 675return this.SyntaxTree.GetLocation(this.Span);
Syntax\SyntaxNodeOrToken.cs (1)
237return _nodeOrParent.Span;
Syntax\SyntaxNodeOrTokenList.cs (1)
172public TextSpan Span => _node?.Span ?? default(TextSpan);
Microsoft.CodeAnalysis.CodeStyle (39)
src\Analyzers\Core\Analyzers\PopulateSwitch\AbstractPopulateSwitchDiagnosticAnalyzer.cs (1)
68if (switchBlock.SyntaxTree.OverlapsHiddenPosition(switchBlock.Span, context.CancellationToken))
src\Analyzers\Core\Analyzers\RemoveUnnecessaryCast\AbstractRemoveUnnecessaryCastDiagnosticAnalyzer.cs (1)
66if (tree.OverlapsHiddenPosition(node.Span, cancellationToken))
src\Analyzers\Core\Analyzers\RemoveUnnecessaryImports\AbstractRemoveUnnecessaryImportsDiagnosticAnalyzer.cs (3)
153textSpan = TextSpan.FromBounds(node.Span.Start, nodeEnd); 167textSpan = TextSpan.FromBounds(node.Span.Start, nodeEnd); 181var end = node.Span.End;
src\Analyzers\Core\Analyzers\SimplifyInterpolation\AbstractSimplifyInterpolationHelpers.cs (3)
97unnecessarySpans.AddRange(invocation.Syntax.Span 112unnecessarySpans.AddRange(invocation.Syntax.Span 220unnecessarySpans.AddRange(invocation.Syntax.Span
src\Analyzers\Core\Analyzers\UseAutoProperty\AbstractUseAutoPropertyAnalyzer.cs (1)
212if (node is TPropertyDeclaration or TFieldDeclaration && context.ShouldAnalyzeSpan(node.Span, node.SyntaxTree))
src\Analyzers\Core\Analyzers\UseCollectionInitializer\UseCollectionInitializerHelpers.cs (2)
37syntaxTree.GetLocation(TextSpan.FromBounds(arguments.Last().FullSpan.End, match.Span.End))); 49syntaxTree.GetLocation(TextSpan.FromBounds(expression.FullSpan.End, match.Span.End)));
src\Analyzers\Core\Analyzers\UseObjectInitializer\AbstractUseObjectInitializerDiagnosticAnalyzer.cs (1)
149: syntaxFacts.GetExpressionOfMemberAccessExpression(match.MemberAccessExpression)!.Span.End;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (5)
196=> node.Span.Length; 301var fullSpan = nodes.First().Span; 306Math.Max(fullSpan.End, node.Span.End)); 313=> node.OverlapsHiddenPosition(node.Span, cancellationToken); 320var start = startNode.Span.End;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (2)
79node.DescendantNodesAndSelf(n => n != previous && n.Span.IntersectsWith(span) && !span.Contains(n.Span))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (2)
29if (node.Parent.Span != node.Span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\BaseIndentationFormattingRule.cs (1)
41else if (node.Span.Contains(_span))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Helpers\RemoveUnnecessaryImports\AbstractUnnecessaryImportsProvider.cs (3)
41=> x?.Span == y?.Span; 44=> obj.Span.GetHashCode();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (4)
59if (holes.Any(static (h, position) => h.Span.Contains(position) && position > h.Span.Start, position)) 94var endOfAttributeLists = attributeList.Last().Span.End; 97return Math.Min(afterAttributesToken.Span.Start, node.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SelectedMembers\AbstractSelectedMembers.cs (1)
111if (textSpan.Contains(member.Span))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\AbstractDocumentationCommentService.cs (1)
74var sb = new StringBuilder(summaryElement.Span.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (6)
164var span = TextSpan.FromBounds(nodes.First().Span.Start, nodes.Last().Span.End); 179=> ContainsInterleavedDirective(syntaxFacts, node.Span, node, cancellationToken); 455var endOfAttributeLists = attributeList.Last().Span.End; 458var endOfNode = node.Span.End; 464return node.Span;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AbstractSpeculationAnalyzer.cs (1)
775!forEachExpression.Span.Contains(OriginalExpression.SpanStart))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\CommonFormattingHelpers.cs (1)
366var endPosition = endToken.RawKind == 0 ? root.Span.End : endToken.Span.End;
Microsoft.CodeAnalysis.CodeStyle.Fixes (22)
src\Analyzers\Core\CodeFixes\AddAnonymousTypeMemberName\AbstractAddAnonymousTypeMemberNameCodeFixProvider.cs (1)
59if (node?.Span != span)
src\Analyzers\Core\CodeFixes\AddExplicitCast\Fixer.cs (1)
211if (newRoot.FindNode(targetNode.Span).GetAncestorOrThis<TArgumentListSyntax>() is TArgumentListSyntax newArgumentList)
src\Analyzers\Core\CodeFixes\RemoveUnusedParametersAndValues\AbstractRemoveUnusedValuesCodeFixProvider.cs (1)
846var spansToFormat = originalDeclStatementsToMoveOrRemove.Select(s => s.Span);
src\Analyzers\Core\CodeFixes\UseConditionalExpression\AbstractUseConditionalExpressionCodeFixProvider.cs (3)
149if (condition.Span.Length + trueSyntax.Span.Length + falseSyntax.Span.Length > formattingOptions.ConditionalExpressionWrappingLength)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (1)
221var beforeMember = declarationList.FirstOrDefault(m => m.Span.End >= info.Context.BeforeThisLocation.SourceSpan.End);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\AbstractRefactoringHelpersService.cs (4)
28if (!allowEmptyNodes && node.Span.IsEmpty) 288if (leftNode.GetLastToken().Span.End != location && leftNode.Span.End != location) 334if (rightNode.Span.Start != location) 538var argumentStartLine = sourceText.Lines.GetLineFromPosition(typedAncestor.Span.Start).LineNumber;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\CodeRefactoringHelpers.cs (6)
51if (selection.IsEmpty || node.Span.IsEmpty) 57if (selection.Contains(node.Span)) 84var beginningNode = node.FindToken(node.Span.Start).Parent; 85var endNode = node.FindToken(node.Span.End - 1).Parent; 96return beginningNode.Span.End <= selection.Start || endNode.Span.Start >= selection.End;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.State.cs (1)
172var affectedSpan = TextSpan.FromBounds(previousToken.SpanStart, FirstStatementAffectedInInnermostBlock.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\RemoveUnnecessaryImports\AbstractRemoveUnnecessaryImportsService.cs (3)
48=> x?.Span == y?.Span; 51=> obj.Span.GetHashCode();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\Simplifiers\AbstractMemberAccessExpressionSimplifier.cs (1)
71return !semanticModel.SyntaxTree.OverlapsHiddenPosition(memberAccessExpression.Span, cancellationToken) &&
Microsoft.CodeAnalysis.CSharp (51)
Binder\BinderFactory.BinderFactoryVisitor.cs (1)
1066TextSpan containingSpan = containingNode.Span;
CodeGen\CodeGenerator.cs (1)
493EmitSequencePoint(syntax.SyntaxTree, syntax.Span);
Compilation\CSharpCompilation.cs (4)
244return IsNullableAnalysisEnabledIn((CSharpSyntaxTree)syntax.SyntaxTree, syntax.Span); 2777TryAdd(new ImportInfo(syntax.SyntaxTree, syntax.Kind(), syntax.Span), default); 4574return loc1.Span.Start - loc2.Span.Start;
Compilation\CSharpSemanticModel.cs (2)
1322if (betterPosition < node.Span.End) 2208var binder = this.GetEnclosingBinder(boundExpr.Syntax.Span.Start);
Compilation\SpeculativeSemanticModelWithMemberModel.cs (3)
155!Root.Span.Contains(attributeOrParameter.Span)) 189if (defaultValueSyntax != null && defaultValueSyntax.FullSpan.Contains(node.Span))
Compilation\SyntaxTreeSemanticModel.cs (5)
773return ((CSharpSyntaxTree)speculativeSyntax.SyntaxTree).IsNullableAnalysisEnabled(speculativeSyntax.Span) ?? 848var span = node.Span; 1401return GetDeclaredMember(container, declarationSyntax.Span, isKnownToBeANamespace: false, name) as NamedTypeSymbol; 1590return (this.GetDeclaredMember(container, declarationSyntax.Span, isKnownToBeANamespace: false) as MethodSymbol).GetPublicSymbol(); 2351return this.GetDeclaredMember(container, declarationSyntax.Span, isKnownToBeANamespace: false, name);
Compiler\UnprocessedDocumentationCommentFinder.cs (1)
56if (node.Span.Length > 0)
FlowAnalysis\AbstractFlowPass.cs (1)
203int endLocation = lastInRegion.Syntax.Span.End;
FlowAnalysis\AlwaysAssignedWalker.cs (3)
84if (IsInside && pending.Branch != null && !RegionContains(pending.Branch.Syntax.Span)) 106if (node.Syntax != null && RegionContains(node.Syntax.Span)) _labelsInside.Add(label); 136if (branch.Branch != null && RegionContains(branch.Branch.Syntax.Span) && !_labelsInside.Contains(branch.Label))
FlowAnalysis\ControlFlowPass.cs (1)
266statement.Syntax.Span.Length != 0)
FlowAnalysis\DataFlowsInWalker.cs (4)
85if (!gotoStmt.WasCompilerGenerated && !targetStmt.WasCompilerGenerated && !RegionContains(gotoStmt.Syntax.Span) && RegionContains(targetStmt.Syntax.Span)) 106if (RegionContains(node.Span)) 121if (node != null && node is ReturnStatementSyntax && RegionContains(node.Span))
FlowAnalysis\DefiniteAssignment.cs (1)
1217(symbol.TryGetFirstLocation() is var location && (location is null || node.Span.End < location.SourceSpan.Start)))
FlowAnalysis\EntryPointsWalker.cs (2)
61if (!gotoStmt.WasCompilerGenerated && !targetStmt.WasCompilerGenerated && RegionContains(targetStmt.Syntax.Span) && !RegionContains(gotoStmt.Syntax.Span))
FlowAnalysis\ExitPointsWalker.cs (1)
124if (pending.Branch == null || !RegionContains(pending.Branch.Syntax.Span)) continue;
FlowAnalysis\ReadWriteWalker.cs (10)
142if (!IsInside && node.Span.Contains(RegionSpan) && (expr.Kind == BoundKind.FieldAccess)) 186if (RegionContains(receiverSyntax.Span)) 192if (RegionContains(receiverSyntax.Span)) 198if (RegionContains(receiverSyntax.Span)) 204if (RegionContains(receiverSyntax.Span)) 210if (RegionContains(receiverSyntax.Span)) 216if (receiver.Type.IsStructType() && receiverSyntax.Span.OverlapsWith(RegionSpan)) 222if (receiverSyntax.Span.OverlapsWith(RegionSpan)) 254if (!IsInside && node.Syntax != null && node.Syntax.Span.Contains(RegionSpan)) 264if (!IsInside && node.Syntax != null && node.Syntax.Span.Contains(RegionSpan))
FlowAnalysis\RegionAnalysisContext.cs (1)
45firstInRegion.Syntax.SpanStart > lastInRegion.Syntax.Span.End;
Lowering\Instrumentation\CodeCoverageInstrumenter.cs (2)
620return syntax.Span; 627var originalSpan = syntax.Span;
src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpDeclarationComputer.cs (1)
30(node, level) => !node.Span.OverlapsWith(span) || InvalidLevel(level),
Symbols\NamespaceOrTypeSymbol.cs (1)
227if (loc.IsInSource && loc.SourceTree == syntax.SyntaxTree && syntax.Span.Contains(loc.SourceSpan))
Symbols\Source\SourceConstructorSymbolBase.cs (1)
197span = ctorInitializer.Span;
Syntax\SimpleSyntaxReference.cs (1)
34return _node.Span;
Syntax\SyntaxNodeRemover.cs (3)
306this.AddDirectives(node, GetRemovedSpan(node.Span, node.FullSpan)); 344var span = TextSpan.FromBounds(token.Span.Start, node.Span.End); 378var span = TextSpan.FromBounds(node.Span.Start, token.Span.End);
Syntax\SyntaxReplacer.cs (1)
377: base(originalNode.Span, editKind, false, originalNode.IsPartOfStructuredTrivia())
Microsoft.CodeAnalysis.CSharp.CodeStyle (54)
src\Analyzers\CSharp\Analyzers\AddAccessibilityModifiers\CSharpAddAccessibilityModifiersDiagnosticAnalyzer.cs (1)
40if (!context.ShouldAnalyzeSpan(member.Span))
src\Analyzers\CSharp\Analyzers\AddBraces\CSharpAddBracesDiagnosticAnalyzer.cs (2)
133var ifStatementSpanWithoutElse = TextSpan.FromBounds(statement.Span.Start, embeddedStatement.Span.End);
src\Analyzers\CSharp\Analyzers\ConvertNamespace\ConvertToFileScopedNamespaceDiagnosticAnalyzer.cs (1)
58: declaration.SyntaxTree.GetLocation(TextSpan.FromBounds(declaration.SpanStart, declaration.Name.Span.End));
src\Analyzers\CSharp\Analyzers\InlineDeclaration\CSharpInlineDeclarationDiagnosticAnalyzer.cs (4)
152if (!context.ShouldAnalyzeSpan(localDeclaration.Span)) 364var localStatementStart = localStatement.Span.Start; 365var argumentNodeStart = argumentNode.Span.Start; 373var descendentStart = descendentNode.Span.Start;
src\Analyzers\CSharp\Analyzers\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessAnalyzer.cs (4)
137[Location.Create(tree, ifStatement.Span), Location.Create(tree, expressionStatement.Span)], 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)
33BinaryExpressionSyntax binary => TextSpan.FromBounds(binary.OperatorToken.SpanStart, node.Span.End),
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (1)
225var endReportSpan = TextSpan.FromBounds(invokedExpression.Span.End, anonymousFunction.Span.End);
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\CSharpRemoveUnnecessaryNullableDirectiveDiagnosticAnalyzer.cs (6)
127|| !possibleNullableImpactIntervalTree.HasIntervalThatOverlapsWith(currentOptionsDirective.Span.End, nullableDirectiveTrivia.SpanStart - currentOptionsDirective.Span.End)) 148possibleNullableImpactIntervalTree.AddIntervalInPlace(directive.Span); 159|| !possibleNullableImpactIntervalTree.HasIntervalThatOverlapsWith(currentOptionsDirective.Span.End, root.Span.End - currentOptionsDirective.Span.End))
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\NullableImpactingSpanWalker.cs (4)
47if (node.Span.End < _positionOfFirstReducingNullableDirective) 52if (_ignoredSpans.HasIntervalThatContains(node.SpanStart, node.Span.Length)) 135SpansBuilder.Add(predefinedType.Span); 153SpansBuilder.Add(node.Span);
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForArrayDiagnosticAnalyzer.cs (1)
221? arrayCreationExpression.Type.Span.End
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs (1)
303text.Lines.GetLineFromPosition(expression.SpanStart).LineNumber + 1 == text.Lines.GetLineFromPosition(expression.Span.End).LineNumber &&
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForStackAllocDiagnosticAnalyzer.cs (1)
112expression.Type.Span.End)));
src\Analyzers\CSharp\Analyzers\UseImplicitOrExplicitType\CSharpTypeStyleDiagnosticAnalyzerBase.cs (1)
55context.ReportDiagnostic(CreateDiagnostic(descriptor, declarationStatement, declaredType.StripRefIfNeeded().Span, typeStyle.Notification, context.Options));
src\Analyzers\CSharp\Analyzers\UseLocalFunction\CSharpUseLocalFunctionDiagnosticAnalyzer.cs (3)
180if (context.ShouldAnalyzeSpan(localDeclaration.Span)) 184&& context.ShouldAnalyzeSpan(anonymousFunctionStatement!.Span)) 247var descendentStart = descendentNode.Span.Start;
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.Analyzer.cs (6)
160if (forStatement.Condition is null || !forStatement.Condition.Span.Contains(_comparison.Span)) 256if (node.SpanStart < _localStatement.Span.End) 260if (node.Span.End >= _comparison.SpanStart) 354var scopeSpan = scope.Span; 368if (descendentNodeSpanStart >= comparisonSpanStart && scopeSpan.Contains(descendentNode.Span))
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.cs (3)
117if (!syntaxContext.ShouldAnalyzeSpan(localStatement.Span)) 217descendentNode.Span.IntersectsWith(comparisonEnclosingBlock.Span) &&
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpIsAndCastCheckDiagnosticAnalyzer.cs (1)
84if (!syntaxContext.ShouldAnalyzeSpan(localDeclarationStatement.Span))
src\Analyzers\CSharp\Analyzers\UseUtf8StringLiteral\UseUtf8StringLiteralDiagnosticAnalyzer.cs (1)
124var span = TextSpan.FromBounds(elements[0].Syntax.SpanStart, elements[^1].Syntax.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\CSharpVirtualCharService.cs (1)
189var indentationLength = parentSourceText.Lines.GetLineFromPosition(parentExpression.Span.End).GetFirstNonWhitespaceOffset() ?? 0;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\BlockSyntaxExtensions.cs (3)
73conditionalDirectives.Last().Span.End >= block.CloseBraceToken.Span.End) 79if (conditionalDirectives.Last().Span.End <= statement.Span.Start)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (1)
559var matchSpan = match.Span;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\CSharpTriviaFormatter.DocumentationCommentExteriorCommentRewriter.cs (1)
76trivia.Span.End == currentParent.Span.End)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (6)
726if (useFullSpan || node.Span.Contains(position)) 956if (node.Span.IsEmpty) 987(constructor.Initializer != null && constructor.Initializer.Span.Contains(span)); 991return property.AccessorList != null && property.AccessorList.Span.Contains(span); 993return @enum.EqualsValue != null && @enum.EqualsValue.Span.Contains(span); 995return field.Declaration != null && field.Declaration.Span.Contains(span);
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (11)
src\Analyzers\CSharp\CodeFixes\AddInheritdoc\AddInheritdocCodeFixProvider.cs (1)
97var indentation = sourceText.GetLeadingWhitespaceOfLineAtPosition(node.Span.Start);
src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (1)
165lastRawStringLiteralData = (stringNode, ComputeCommonIndentationLength(text.Lines.GetLineFromPosition(stringNode.Span.End)));
src\Analyzers\CSharp\CodeFixes\Iterator\CSharpAddYieldCodeFixProvider.cs (1)
106var symbol = model.GetEnclosingSymbol(node.Span.Start, cancellationToken);
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (1)
766totalLength += component.Span.Length;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\CompilationUnitSyntaxExtensions.cs (3)
43var end = usings.Last().Span.End; 52var end = rootUsings.Last().Span.End; 60: root.Span.End;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\CSharpSyntaxContext.cs (1)
519lockStatement.Statement.Span.Contains(position))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\TypeDeclarationSyntaxExtensions.cs (1)
47start = members.Last().Span.End;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpRemoveUnnecessaryImportsService.cs (1)
67spansToFormat.Add(TextSpan.FromBounds(baseNamespace.Name.Span.End, firstMemberB.SpanStart));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (1)
2217if (descendant.SpanStart <= afterNode.Span.End)
Microsoft.CodeAnalysis.CSharp.EditorFeatures (46)
AutomaticCompletion\AutomaticLineEnderCommandHandler.cs (1)
613IndexerDeclarationSyntax indexerNode => indexerNode.ParameterList.Span.End,
AutomaticCompletion\AutomaticLineEnderCommandHandler_Helpers.cs (11)
51newNodeAfterInsertion.Span, 83newNodeAfterInsertion.Span, 643&& !tryStatementNode.Block.Span.Contains(caretPosition); 648&& !catchClauseSyntax.Block.Span.Contains(caretPosition); 653&& !finallyClauseNode.Block.Span.Contains(caretPosition); 657&& !checkedStatementNode.Block.Span.Contains(caretPosition); 749return baseMethodBody.Span.Contains(caretPosition); 754return localFunctionBody.Span.Contains(caretPosition); 803&& accessorDeclarationNode.Body.Span.Contains(caretPosition); 815return accessorList.Span.Contains(caretPosition) && accessorList.Accessors.IsEmpty(); 830&& accessorList.Span.Contains(caretPosition)
CompleteStatement\CompleteStatementCommandHandler.cs (11)
234var newCaretPosition = currentNode.Span.End; 316return (caret >= condition.Span.Start && caret <= condition.Span.End); 439return caretPosition > condition.SpanStart && caretPosition <= condition.Span.End; 448return caretPosition > declaration.Span.Start && caretPosition <= declaration.Span.End; 466relocatedPosition = forStatementSyntax.Initializers[separatorIndex].Span.End; 501return caret.Position <= currentNode.Span.End; 507return caret.Position <= currentNode.Span.End; 513return caret.Position < currentNode.Span.End - 2; 516return caret.Position < currentNode.Span.End;
Interactive\CSharpSendToInteractiveSubmissionProvider.cs (5)
40? [expandedNode.Span] 73if (startNode.Span.Contains(endNode.Span)) 77else if (endNode.Span.Contains(startNode.Span))
RawStringLiteral\RawStringLiteralCommandHandler_Return.cs (2)
228var index = expression.Span.End; 240var index = expression.Span.Start;
StringCopyPaste\KnownSourcePasteProcessor.cs (2)
232if (beforeSelection && interpolation.Span.End > _selectionSpanBeforePaste.Start) 235if (!beforeSelection && interpolation.Span.Start < _selectionSpanBeforePaste.End)
StringCopyPaste\StringCopyPasteCommandHandler.cs (4)
250var lastLine = textBeforePaste.Lines.GetLineFromPosition(stringExpressionBeforePaste.Span.End); 282var spanAfterPaste = MapSpan(stringExpressionBeforePaste.Span, snapshotBeforePaste, snapshotAfterPaste); 283return spanAfterPaste == stringExpressionAfterPaste.Span; 303var spanAfterPaste = MapSpan(stringExpressionBeforePaste.Span, snapshotBeforePaste, snapshotAfterPaste);
StringCopyPaste\StringCopyPasteData.cs (2)
150if (interpolatedContent.Span.OverlapsWith(selectionSpan)) 156if (!selectionSpan.Contains(interpolation.Span))
StringCopyPaste\StringInfo.cs (8)
91var end = SkipU8Suffix(text, literal.Span.End); 105endDelimiterSpan: TextSpan.FromBounds(end, literal.Span.End), 146TextSpan.FromBounds(rawEnd, literal.Span.End), 167var end = SkipU8Suffix(text, literal.Span.End); 176endDelimiterSpan: TextSpan.FromBounds(end, literal.Span.End), 197var end = SkipU8Suffix(text, interpolatedString.Span.End); 210currentPosition = content.Span.End; 220endDelimiterSpan: TextSpan.FromBounds(interpolatedString.StringEndToken.SpanStart, interpolatedString.Span.End),
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (5)
CodeActions\PreviewExceptionTests.cs (1)
110var span = document.GetSyntaxRootAsync().Result.Span;
CodeActions\PreviewTests.cs (1)
95var span = document.GetSyntaxRootAsync().Result.Span;
ExtractMethod\ExtractMethodBase.cs (1)
206var validator = new CSharpSelectionValidator(semanticDocument, node.Span, localFunction: false);
TypeInferrer\TypeInferrerTests.cs (2)
40inferredType = typeInference.InferType(await document.ReuseExistingSpeculativeModelAsync(node?.Span ?? textSpan, CancellationToken.None), node, objectAsDefault: true, cancellationToken: CancellationToken.None); 78if (currentNode is ExpressionSyntax result && result.Span == textSpan)
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (21)
Diagnostics\DiagnosticAnalyzerTests.cs (1)
4326: localDeclaration.Span;
Diagnostics\GetDiagnosticsTests.cs (3)
783var span = localDecl.Span; 1062var span = localDecl.Span; 1553var result = await compilationWithAnalyzers.GetAnalysisResultAsync(model1, filterSpan: localDecl.Span, CancellationToken.None);
FlowAnalysis\FlowTestBase.cs (6)
127if (expr.SpanStart >= start && expr.Span.End <= end) 148if (expr.SpanStart >= start && expr.Span.End <= end) 180if (expr.SpanStart >= start && expr.Span.End <= end) 206if (firstStatement != null && stmt.Span.End <= end && stmt.Parent == firstStatement.Parent) 218return GetSyntaxNodeList(tree).OfType<T>().Where(n => n.Span.Contains(offset)).FirstOrDefault(); 224return GetSyntaxNodeList(tree).OfType<T>().Where(n => n.Span.Contains(offset)).Last();
FlowAnalysis\RegionAnalysisTests.cs (1)
7910Assert.Equal(0, stmt.Span.Length);
Semantics\OutVarTests.cs (10)
1079if (typeofExpression?.Type?.FullSpan.Contains(decl.Span) == true) 1210if (dataFlowParent.Span.Contains(reference.Span) && reference.SpanStart > decl.SpanStart) 1261if (!dataFlowParent.Span.Contains(reference.Span)) 1298if (!dataFlowParent.Span.Contains(reference.Span) && 1299(containingReturnOrThrow == null || containingReturnOrThrow.Span.Contains(reference.SpanStart)) && 1319if (!dataFlowParent.Span.Contains(reference.Span))
Microsoft.CodeAnalysis.CSharp.Features (196)
ChangeSignature\CSharpChangeSignatureService.cs (1)
142if (!matchingNode.Span.IntersectsWith(position))
CodeRefactorings\EnableNullable\EnableNullableCodeRefactoringProvider.cs (1)
248if (firstSemanticToken.IsKind(SyntaxKind.None) || firstSemanticToken.SpanStart > nullableDirective.Span.End)
CodeRefactorings\SyncNamespace\CSharpChangeNamespaceService.cs (2)
53containerSpan = container.Span; 359if (!compilationUnit.Span.Contains(span))
CodeRefactorings\SyncNamespace\CSharpSyncNamespaceCodeRefactoringProvider.cs (1)
44if (namespaceDeclaration.Name.Span.IntersectsWith(position))
CodeRefactorings\UseExplicitOrImplicitType\AbstractUseTypeCodeRefactoringProvider.cs (1)
68declaredType.Span);
CodeRefactorings\UseRecursivePatterns\UseRecursivePatternsCodeRefactoringProvider.cs (1)
605if (!fixAllSpans.Any(fixAllSpan => fixAllSpan.Contains(originalNode.Span)))
Completion\CompletionProviders\AttributeNamedParameterCompletionProvider.cs (2)
207argumentList.Arguments.Where(a => a.Span.End <= position) 211argumentList.Arguments.Where(a => a.Span.End <= position)
Completion\CompletionProviders\AwaitCompletionProvider.cs (2)
121return node.Span.Contains(position); 123return node.Span.IntersectsWith(position);
Completion\CompletionProviders\ExplicitInterfaceTypeCompletionProvider.cs (1)
80if (typeNode.Parent is TypeSyntax parentType && parentType.Span.End < position)
Completion\CompletionProviders\NamedParameterCompletionProvider.cs (1)
144var existingArguments = argumentList.Arguments.Where(a => a.Span.End <= position && a.NameColon != null)
ConvertLinq\CSharpConvertLinqQueryToForEachProvider.cs (1)
93!_semanticModel.GetDiagnostics(_source.Span, _cancellationToken).Any(static diagnostic => diagnostic.DefaultSeverity == DiagnosticSeverity.Error))
ConvertNamespace\ConvertNamespaceCodeRefactoringProvider.cs (1)
82return position <= namespaceDeclaration.Name.Span.End;
ConvertToRawString\ConvertInterpolatedStringToRawStringCodeRefactoringProvider.cs (2)
357var interpolation = stringExpression.Contents.OfType<InterpolationSyntax>().Single(i => i.Span.Contains(start)); 505var descendantSpan = descendant.Span;
Copilot\CSharpCopilotCodeFixProvider.cs (1)
82if (containingMethod?.Span.IntersectsWith(context.Span) is true)
Debugging\DataTipInfoGetter.cs (5)
42return new DebugDataTipInfo(typeSyntax.Span, text); 54: new DebugDataTipInfo(expression.Span, type.ToNameDisplayString()); 68: TextSpan.FromBounds(current.SpanStart, expression.Span.End); 78return new DebugDataTipInfo(expression.Span, fullExpressionSpan ?? expression.Span, Text: null, kind);
EditAndContinue\BreakpointSpans.cs (11)
178return (methodDeclaration.Body != null) ? CreateSpanForBlock(methodDeclaration.Body, position) : methodDeclaration.ExpressionBody?.Expression.Span; 342return property.ExpressionBody.Expression.Span; 348return property.Initializer.Value.Span; 363return indexer.ExpressionBody.Expression.Span; 444return constructorSyntax.ExpressionBody.Expression.Span; 457return constructorSyntax.ExpressionBody.Expression.Span; 486return TextSpan.FromBounds(typeDeclaration.Identifier.SpanStart, typeDeclaration.ParameterList.Span.End); 506=> baseTypeSyntax.Span; 545=> accessor.Span; 615if (position < doStatement.Statement.Span.Start) 681return ((ForEachVariableStatementSyntax)statement).Variable.Span;
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (39)
101declarations = (recordDeclaration.ParameterList != null && activeSpan.OverlapsWith(recordDeclaration.ParameterList.Span)) 297Debug.Assert(position == switchExpression.Span.Start); 353ForEachPart.Expression => node.Expression.Span, 361ForEachPart.VariableDeclaration => TextSpan.FromBounds(node.Variable.SpanStart, node.Variable.Span.End), 363ForEachPart.Expression => node.Expression.Span, 370SwitchExpressionPart.WholeExpression => node.Span, 610span = ((ArrowExpressionClauseSyntax)node).Expression.Span; 663span = ((SwitchExpressionArmSyntax)node).Expression.Span; 1283oldTypeDeclaration.TypeParameterList?.Span != newTypeDeclaration.TypeParameterList?.Span; 1287oldTypeDeclaration.ParameterList?.Span != newTypeDeclaration.ParameterList?.Span) 1608=> TryGetDiagnosticSpanImpl(node, editKind) ?? node.Span; 1635return node.Span; 1639return node.Span; 1644return TextSpan.FromBounds(ns.NamespaceKeyword.SpanStart, ns.Name.Span.End); 1679return node.Span; 1714return node.Span; 1727return TextSpan.FromBounds(constraint.WhereKeyword.SpanStart, constraint.Constraints.Last().Span.End); 1743return node.Span; 1755return node.Span; 1792return node.Span; 1807(switchStatement.CloseParenToken != default) ? switchStatement.CloseParenToken.Span.End : switchStatement.Expression.Span.End); 1810return ((SwitchSectionSyntax)node).Labels.Last().Span; 1855return node.Span; 1859return CombineSpans(localDeclarationStatement.AwaitKeyword.Span, localDeclarationStatement.UsingKeyword.Span, node.Span); 1869return CombineSpans(parenthesizedLambda.ReturnType?.Span ?? default, parenthesizedLambda.ParameterList.Span, defaultSpan: default); 1872return ((SimpleLambdaExpressionSyntax)node).Parameter.Span; 1907return node.Span; 1926return node.Span; 1963return lambda.Span; 2692return tryStatement.Finally.Span; 2698? tryStatement.Finally.Span.End 2699: tryStatement.Catches.Last().Span.End); 2703return node.Span; 2708return tryStatement.Span; 2733diagnosticContext.Report(RudeEditKind.AwaitStatementUpdate, newContainingStatementPart.Span); 2954AddAroundActiveStatementRudeDiagnostic(diagnostics, oldCheckedStatement, newCheckedStatement, newActiveStatement.Span);
EditAndContinue\DeclarationBody\PropertyOrIndexerAccessorDeclarationBody.cs (1)
65=> ExplicitBody?.Span ?? HeaderActiveStatementSpan;
EncapsulateField\CSharpEncapsulateFieldService.cs (2)
129.DescendantNodes(d => d.Span.IntersectsWith(span)) 131.Where(n => n.Span.IntersectsWith(span));
ExtractMethod\CSharpMethodExtractor.cs (4)
65if (!OriginalSelectionResult.OriginalSpan.Contains(anonymousFunction.Span)) 80if (!OriginalSelectionResult.OriginalSpan.Contains(localFunction.Span)) 133if (OriginalSelectionResult.FinalSpan.Contains(memberNode.Span)) 154return node.Span.Contains(OriginalSelectionResult.OriginalSpan);
ExtractMethod\CSharpSelectionValidator.cs (2)
290if (variable.Initializer != null && variable.Initializer.Span.Contains(span)) 330var expressionBodiedMemberBody = TextSpan.FromBounds(expressionBodiedMember.Expression.SpanStart, expressionBodiedMember.Expression.Span.End);
ExtractMethod\Extensions.cs (3)
78return constructorInitializer.ContainsInArgument(node.Span); 92return initializer.ArgumentList.Arguments.Any(a => a.Span.Contains(textSpan)); 140return equal.Value != null && equal.Value.Span.Contains(node.Span);
GenerateMember\GenerateVariable\CSharpGenerateVariableService.cs (1)
154var startIndex = identifierName.Span.Start - localRoot.Span.Start;
GenerateType\CSharpGenerateTypeService.cs (1)
565? semanticModel.SyntaxTree.GetLocation(new TextSpan(lastMember.Span.End, 0))
InlineHints\CSharpInlineParameterNameHintsService.cs (2)
55buffer.Add((argument.Span.Start, argument, parameter, GetKind(argument.Expression))); 82buffer.Add((argument.Span.Start, argument, parameter, GetKind(argument.Expression)));
IntroduceVariable\CSharpIntroduceVariableService_IntroduceLocal.cs (2)
433var localFunctions = innermostCommonBlock.DescendantNodes().Where(node => node.IsKind(SyntaxKind.LocalFunctionStatement) && matches.Any(match => match.Span.OverlapsWith(node.Span)));
LanguageServices\CSharpSymbolDisplayService.SymbolDescriptionBuilder.cs (1)
244LanguageServices, semanticModel, equalsValue.Value.Span,
NavigationBar\CSharpNavigationBarItemService.cs (2)
228var spanEnd = declaringNode.Span.End; 266return declaringNode.Span;
QuickInfo\CSharpDiagnosticAnalyzerQuickInfoProvider.cs (2)
86return GetQuickInfoFromSupportedDiagnosticsOfProjectAnalyzers(document, errorCode, errorCodeNode.Span); 124return GetQuickInfoFromSupportedDiagnosticsOfProjectAnalyzers(document, errorCode, suppressMessageCheckIdArgument.Span);
SignatureHelp\AttributeSignatureHelpProvider.cs (1)
70expression.ArgumentList.Span.Contains(token.SpanStart) &&
SignatureHelp\ConstructorInitializerSignatureHelpProvider.cs (1)
65expression.ArgumentList.Span.Contains(token.SpanStart) &&
SignatureHelp\ElementAccessExpressionSignatureHelpProvider.cs (4)
121return TextSpan.FromBounds(conditional.Span.Start, openBracket.FullSpan.End); 295return expression.ArgumentList.Span.Contains(token.SpanStart) && 344return TextSpan.FromBounds(expression.SpanStart, openBracket.Parent.Span.End); 380return expression.ArgumentList.Span.Contains(token.SpanStart) &&
SignatureHelp\GenericNameSignatureHelpProvider.cs (1)
73node.TypeArgumentList.Span.Contains(token.SpanStart) &&
SignatureHelp\InitializerExpressionSignatureHelpProvider.cs (1)
54=> expression.Span.Contains(token.SpanStart) && token != expression.CloseBraceToken;
SignatureHelp\InvocationExpressionSignatureHelpProvider.cs (1)
61return expression.ArgumentList.Span.Contains(token.SpanStart) &&
SignatureHelp\LightweightOverloadResolution.cs (1)
236=> expression.Span.IsEmpty;
SignatureHelp\ObjectCreationExpressionSignatureHelpProvider.cs (1)
58expression.ArgumentList.Span.Contains(token.SpanStart) &&
SignatureHelp\PrimaryConstructorBaseTypeSignatureHelpProvider.cs (1)
62expression.ArgumentList.Span.Contains(token.SpanStart) &&
SignatureHelp\TupleConstructionSignatureHelpProvider.cs (3)
70if (!currentSpan.Contains(expression.Span)) 89if (!currentSpan.Contains(expression.Span)) 162return CreateSignatureHelpItems(items, targetExpression.Span, state, selectedItemIndex: null, parameterIndexOverride: -1);
SplitStringLiteral\InterpolatedStringSplitter.cs (3)
45if (content.Span.End <= CursorPosition) 50else if (content.Span.Start >= CursorPosition) 59afterSplitContents.Insert(0, CreateInterpolatedStringText(CursorPosition, content.Span.End));
src\Analyzers\CSharp\Analyzers\AddAccessibilityModifiers\CSharpAddAccessibilityModifiersDiagnosticAnalyzer.cs (1)
40if (!context.ShouldAnalyzeSpan(member.Span))
src\Analyzers\CSharp\Analyzers\AddBraces\CSharpAddBracesDiagnosticAnalyzer.cs (2)
133var ifStatementSpanWithoutElse = TextSpan.FromBounds(statement.Span.Start, embeddedStatement.Span.End);
src\Analyzers\CSharp\Analyzers\ConvertNamespace\ConvertToFileScopedNamespaceDiagnosticAnalyzer.cs (1)
58: declaration.SyntaxTree.GetLocation(TextSpan.FromBounds(declaration.SpanStart, declaration.Name.Span.End));
src\Analyzers\CSharp\Analyzers\InlineDeclaration\CSharpInlineDeclarationDiagnosticAnalyzer.cs (4)
152if (!context.ShouldAnalyzeSpan(localDeclaration.Span)) 364var localStatementStart = localStatement.Span.Start; 365var argumentNodeStart = argumentNode.Span.Start; 373var descendentStart = descendentNode.Span.Start;
src\Analyzers\CSharp\Analyzers\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessAnalyzer.cs (4)
137[Location.Create(tree, ifStatement.Span), Location.Create(tree, expressionStatement.Span)], 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)
33BinaryExpressionSyntax binary => TextSpan.FromBounds(binary.OperatorToken.SpanStart, node.Span.End),
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (1)
225var endReportSpan = TextSpan.FromBounds(invokedExpression.Span.End, anonymousFunction.Span.End);
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\CSharpRemoveUnnecessaryNullableDirectiveDiagnosticAnalyzer.cs (6)
127|| !possibleNullableImpactIntervalTree.HasIntervalThatOverlapsWith(currentOptionsDirective.Span.End, nullableDirectiveTrivia.SpanStart - currentOptionsDirective.Span.End)) 148possibleNullableImpactIntervalTree.AddIntervalInPlace(directive.Span); 159|| !possibleNullableImpactIntervalTree.HasIntervalThatOverlapsWith(currentOptionsDirective.Span.End, root.Span.End - currentOptionsDirective.Span.End))
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\NullableImpactingSpanWalker.cs (4)
47if (node.Span.End < _positionOfFirstReducingNullableDirective) 52if (_ignoredSpans.HasIntervalThatContains(node.SpanStart, node.Span.Length)) 135SpansBuilder.Add(predefinedType.Span); 153SpansBuilder.Add(node.Span);
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForArrayDiagnosticAnalyzer.cs (1)
221? arrayCreationExpression.Type.Span.End
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs (1)
303text.Lines.GetLineFromPosition(expression.SpanStart).LineNumber + 1 == text.Lines.GetLineFromPosition(expression.Span.End).LineNumber &&
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForStackAllocDiagnosticAnalyzer.cs (1)
112expression.Type.Span.End)));
src\Analyzers\CSharp\Analyzers\UseLocalFunction\CSharpUseLocalFunctionDiagnosticAnalyzer.cs (3)
180if (context.ShouldAnalyzeSpan(localDeclaration.Span)) 184&& context.ShouldAnalyzeSpan(anonymousFunctionStatement!.Span)) 247var descendentStart = descendentNode.Span.Start;
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.Analyzer.cs (6)
160if (forStatement.Condition is null || !forStatement.Condition.Span.Contains(_comparison.Span)) 256if (node.SpanStart < _localStatement.Span.End) 260if (node.Span.End >= _comparison.SpanStart) 354var scopeSpan = scope.Span; 368if (descendentNodeSpanStart >= comparisonSpanStart && scopeSpan.Contains(descendentNode.Span))
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.cs (3)
117if (!syntaxContext.ShouldAnalyzeSpan(localStatement.Span)) 217descendentNode.Span.IntersectsWith(comparisonEnclosingBlock.Span) &&
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpIsAndCastCheckDiagnosticAnalyzer.cs (1)
84if (!syntaxContext.ShouldAnalyzeSpan(localDeclarationStatement.Span))
src\Analyzers\CSharp\Analyzers\UseUtf8StringLiteral\UseUtf8StringLiteralDiagnosticAnalyzer.cs (1)
124var span = TextSpan.FromBounds(elements[0].Syntax.SpanStart, elements[^1].Syntax.Span.End);
src\Analyzers\CSharp\CodeFixes\AddInheritdoc\AddInheritdocCodeFixProvider.cs (1)
97var indentation = sourceText.GetLeadingWhitespaceOfLineAtPosition(node.Span.Start);
src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (1)
165lastRawStringLiteralData = (stringNode, ComputeCommonIndentationLength(text.Lines.GetLineFromPosition(stringNode.Span.End)));
src\Analyzers\CSharp\CodeFixes\Iterator\CSharpAddYieldCodeFixProvider.cs (1)
106var symbol = model.GetEnclosingSymbol(node.Span.Start, cancellationToken);
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (1)
766totalLength += component.Span.Length;
src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpDeclarationComputer.cs (1)
30(node, level) => !node.Span.OverlapsWith(span) || InvalidLevel(level),
StringIndentation\CSharpStringIndentationService.cs (4)
118builder.Add(interpolation.Span); 129if (content is InterpolationSyntax && content.Span.Contains(sourceSpan)) 143var holeEndLine = text.Lines.GetLineFromPosition(interpolation.Span.End).LineNumber; 162var lastLine = text.Lines.GetLineFromPosition(expression.Span.End);
Structure\CSharpStructureHelpers.cs (1)
324node.Span,
Structure\Providers\AnonymousObjectCreationExpressionStructureProvider.cs (2)
38textSpan: TextSpan.FromBounds(node.NewKeyword.Span.End, node.Span.End), 39hintSpan: node.Span,
Structure\Providers\ArgumentListStructureProvider.cs (1)
24node.Span));
Structure\Providers\ArrowExpressionClauseStructureProvider.cs (2)
27textSpan: TextSpan.FromBounds(previousToken.Span.End, node.Parent.Span.End), 28hintSpan: node.Parent.Span,
Structure\Providers\BlockSyntaxStructureProvider.cs (4)
140textSpan: node.Span, 141hintSpan: node.Span, 168return node.Span; 189return node.Span.End;
Structure\Providers\CollectionExpressionStructureProvider.cs (2)
40: node.Span.End; 61var textSpan = TextSpan.FromBounds(previousToken.Span.End, node.Span.End);
Structure\Providers\InitializerExpressionStructureProvider.cs (3)
42: node.Span.End; 64textSpan: TextSpan.FromBounds(previousToken.Span.End, node.Span.End), 65hintSpan: node.Parent.Span,
Structure\Providers\InterpolatedStringExpressionStructureProvider.cs (2)
29textSpan: node.Span, 30hintSpan: node.Span,
Structure\Providers\RegionDirectiveStructureProvider.cs (1)
19var prefixLength = kw.Span.End - simpleDirective.Span.Start;
Structure\Providers\StringLiteralExpressionStructureProvider.cs (3)
29textSpan: node.Span, 30hintSpan: node.Span, 48var span = node.Span;
Structure\Providers\SwitchStatementStructureProvider.cs (4)
24textSpan: TextSpan.FromBounds(node.CloseParenToken != default ? node.CloseParenToken.Span.End : node.Expression.Span.End, node.CloseBraceToken.Span.End), 25hintSpan: node.Span, 33var end = section.Statements.Last().Span.End; 38hintSpan: section.Span,
UseExpressionBody\UseExpressionBodyCodeRefactoringProvider.cs (2)
130declaration.Span); 143declaration.Span);
UsePatternMatching\CSharpIsAndCastCheckWithoutNameDiagnosticAnalyzer.cs (3)
171if (node.Span.End >= type.Span.End) 205var diagnostics = updatedSemanticModel.GetDiagnostics(currentNode.Span, cancellationToken);
Wrapping\SeparatedSyntaxList\CSharpCollectionExpressionWrapper.cs (1)
53return listSyntax.Span.Contains(position);
Wrapping\SeparatedSyntaxList\CSharpInitializerExpressionWrapper.cs (1)
53return listSyntax.Span.Contains(position);
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (1)
EditAndContinue\BreakpointSpansTests.cs (1)
95var endPosition = root.Span.End;
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (15)
Semantics\GlobalUsingDirectiveTests.cs (4)
4979Assert.Equal("alias1=C1", model.GetSpeculativeAliasInfo(tree.GetRoot().Span.End, alias1, SpeculativeBindingOption.BindAsExpression).ToTestDisplayString()); 4980Assert.Equal("alias1=C1", model.GetSpeculativeAliasInfo(tree.GetRoot().Span.End, alias1, SpeculativeBindingOption.BindAsTypeOrNamespace).ToTestDisplayString()); 4984Assert.Equal("alias1=C1", model.GetSpeculativeAliasInfo(tree.GetRoot().Span.End, alias1, SpeculativeBindingOption.BindAsExpression).ToTestDisplayString()); 4985Assert.Equal("alias1=C1", model.GetSpeculativeAliasInfo(tree.GetRoot().Span.End, alias1, SpeculativeBindingOption.BindAsTypeOrNamespace).ToTestDisplayString());
Semantics\NullableContextTests.cs (1)
735bool actualAnalysis = tree.IsNullableAnalysisEnabled(methodDeclaration.Span).Value;
Semantics\QueryTests.cs (3)
3424bool success = model.TryGetSpeculativeSemanticModel(methodM.Body.Statements[1].Span.End, queryStatement, out speculativeModel); 3468bool success = model.TryGetSpeculativeSemanticModel(methodM.Body.Statements[1].Span.End, queryStatement, out speculativeModel); 3554bool success = model.TryGetSpeculativeSemanticModel(methodM.Body.Statements[0].Span.End, queryStatement, out speculativeModel);
Semantics\TopLevelStatementsTests.cs (7)
2925model1.GetDiagnostics(nameRef.Ancestors().OfType<StatementSyntax>().First().Span).Verify( 2947model2.GetDiagnostics(nameRef.Ancestors().OfType<StatementSyntax>().First().Span).Verify( 8653for (int i = id.SpanStart; i <= id.Span.End; i++) 8675for (int i = id.SpanStart; i <= id.Span.End; i++) 8697for (int i = id.SpanStart; i <= id.Span.End; i++) 9707model.TryGetSpeculativeSemanticModel(root.DescendantNodes().Single(n => n is ExpressionStatementSyntax { Parent: GlobalStatementSyntax }).Span.End, nodeToSpeculate, out var speculativeModelInTopLevel); 9712model.TryGetSpeculativeSemanticModel(root.DescendantNodes().Single(n => n is ExpressionStatementSyntax { Parent: BlockSyntax }).Span.End, nodeToSpeculate, out var speculativeModelOutsideTopLevel);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (16)
Compilation\SemanticModelAPITests.cs (5)
1394var info = model.GetSpeculativeSymbolInfo(oldSyntax.ParameterList.Span.End, newSyntax); 1920bool success = model.TryGetSpeculativeSemanticModel(methodDecl.Body.Statements[0].Span.End, switchStatement, out statModel); 1958bool success = model.TryGetSpeculativeSemanticModel(methodDecl.Body.Statements[0].Span.End, speculatedStatement, out speculativeModel); 2264var success = model.TryGetSpeculativeSemanticModel(methodDecl.Body.Statements[0].Span.End, unsafeStatement, out speculativeModel); 2679var success = model.TryGetSpeculativeSemanticModelForMethodBody(methodDecl.Body.Statements[0].Span.End, speculatedMethod, out speculativeModel);
DeclarationTests.cs (2)
921if (node.Span == nodeInUnderlying.Span && node.RawKind == nodeInUnderlying.RawKind)
Symbols\AnonymousTypesSemanticsTests.cs (6)
1494var pos = data.Nodes[0].Span.End; 1513pos = data.Nodes[3].Span.End; 2010while (current.Span == identifier.Span && !current.IsKind(SyntaxKind.IdentifierName)) 2017var span = node.Span; 2059if (span.Contains(node.Span))
Symbols\AnonymousTypesSymbolTests.cs (2)
1702Assert.True(statement1.Span.Contains(typeA3.Locations[0].SourceSpan)); 1703Assert.True(statement2.Span.Contains(typeA4.Locations[0].SourceSpan));
Symbols\Source\NullablePublicAPITests.cs (1)
4120var position = localFunction.DescendantNodes().OfType<VariableDeclarationSyntax>().Single().Span.End;
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (14)
Diagnostics\LineSpanDirectiveTests.cs (1)
486var mappedLineAndPositionSpan = unmappedText.GetMappedLineSpanAndVisibility(syntax.Span, out _);
Syntax\LambdaUtilitiesTests.cs (1)
49bool expected = enclosingMethod.MethodKind == MethodKind.LambdaMethod && enclosingSyntax.Span.Contains(span.Value);
Syntax\SyntaxAnnotationTests.cs (2)
624Assert.Equal(oldNode.Span, annotatedNode.Span);
Syntax\SyntaxNodeTests.cs (9)
729Assert.Equal(root, root.FindNode(root.Span, findInsideTrivia: false)); 730Assert.Equal(root, root.FindNode(root.Span, findInsideTrivia: true)); 736var position = identifier.Span.Start + 1; 738Assert.Equal(classDecl, root.FindNode(identifier.Span, findInsideTrivia: false)); 739Assert.Equal(identifier, root.FindNode(identifier.Span, findInsideTrivia: true)); 1781Assert.Equal(rootNode.Span.Length, rootNode.ToString().Length); 1799Assert.Equal(rootNode.Span.Length, rootNode.ToString().Length); 1814Assert.Equal(namespaceNode.Span, nodeOrToken.Span); 2080Assert.Equal(method.Span, nodeLocation.SourceSpan);
Syntax\SyntaxTests.cs (1)
164var span = section.Span;
Microsoft.CodeAnalysis.CSharp.Workspaces (64)
Classification\SyntaxClassification\DiscardSyntaxClassifier.cs (2)
30result.Add(new ClassifiedSpan(syntax.Span, ClassificationTypeNames.Keyword)); 51result.Add(new ClassifiedSpan(syntax.Span, ClassificationTypeNames.Keyword));
Classification\SyntaxClassification\NameSyntaxClassifier.cs (6)
146classifiedSpan = new ClassifiedSpan(name.Span, ClassificationTypeNames.NamespaceName); 154classifiedSpan = new ClassifiedSpan(name.Span, ClassificationTypeNames.Keyword); 161classifiedSpan = new ClassifiedSpan(name.Span, ClassificationTypeNames.Keyword); 169classifiedSpan = new ClassifiedSpan(name.Span, ClassificationTypeNames.Keyword); 176classifiedSpan = new ClassifiedSpan(name.Span, ClassificationTypeNames.Keyword); 325result.Add(new(name.Span, ClassificationTypeNames.Keyword));
Classification\SyntaxClassification\UsingDirectiveSyntaxClassifier.cs (2)
52result.Add(new ClassifiedSpan(token.Span, classification)); 57result.Add(new ClassifiedSpan(token.Span, ClassificationTypeNames.NamespaceName));
Classification\Worker.cs (1)
261if (!_textSpan.OverlapsWith(skippedTokens.Span))
Classification\Worker_DocumentationComments.cs (1)
16if (!_textSpan.OverlapsWith(documentationComment.Span))
Classification\Worker_Preprocesser.cs (1)
14if (!_textSpan.OverlapsWith(node.Span))
CodeGeneration\CSharpSyntaxGenerator.cs (8)
2714if (root.Span.Contains(declaration.Span)) 2853if (root.Span.Contains(declaration.Span)) 2892if (root.Span.Contains(declaration.Span)) 2962if (root.Span.Contains(node.Span))
Rename\CSharpRenameRewriterLanguageService.cs (4)
164if (_conflictLocations.Any(cf => cf.Contains(lambda.Span))) 197_conflictLocations.Contains(node.Span) && 296var oldSpan = originalNode.Span; 311var newSpan = newNode.Span;
Simplification\Reducers\CSharpNullableAnnotationReducer.cs (1)
37var context = semanticModel.GetNullableContext(node.Span.End);
Simplification\Simplifiers\ExpressionSimplifier.cs (7)
50issueSpan = memberAccessExpression.Expression.Span; 108issueSpan = memberAccess.Span; 163issueSpan = memberAccess.Span; 169issueSpan = memberAccess.Expression.Span; 189issueSpan = memberAccess.Span; // we want to show the whole expression as unnecessary 215issueSpan = memberAccess.Expression.Span; 436issueSpan = left.Span;
Simplification\Simplifiers\NameSimplifier.cs (9)
92issueSpan = genericName.TypeArgumentList.Span; 108issueSpan = name.Span; 166issueSpan = name.Span; 176issueSpan = qualifiedName3.Left.Span; 296issueSpan = name.Span; 322issueSpan = ((AliasQualifiedNameSyntax)name).Alias.Span; 328issueSpan = ((QualifiedNameSyntax)name).Left.Span; 455return !name.Span.Contains(argumentDecl.Span); 472issueSpan = name.Span; // we want to show the whole name expression as unnecessary
Simplification\Simplifiers\QualifiedCrefSimplifier.cs (2)
58issueSpan = crefSyntax.Span; 96issueSpan = crefSyntax.Container.Span;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\CSharpVirtualCharService.cs (1)
189var indentationLength = parentSourceText.Lines.GetLineFromPosition(parentExpression.Span.End).GetFirstNonWhitespaceOffset() ?? 0;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\BlockSyntaxExtensions.cs (3)
73conditionalDirectives.Last().Span.End >= block.CloseBraceToken.Span.End) 79if (conditionalDirectives.Last().Span.End <= statement.Span.Start)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (1)
559var matchSpan = match.Span;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\CSharpTriviaFormatter.DocumentationCommentExteriorCommentRewriter.cs (1)
76trivia.Span.End == currentParent.Span.End)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (6)
726if (useFullSpan || node.Span.Contains(position)) 956if (node.Span.IsEmpty) 987(constructor.Initializer != null && constructor.Initializer.Span.Contains(span)); 991return property.AccessorList != null && property.AccessorList.Span.Contains(span); 993return @enum.EqualsValue != null && @enum.EqualsValue.Span.Contains(span); 995return field.Declaration != null && field.Declaration.Span.Contains(span);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\CompilationUnitSyntaxExtensions.cs (3)
43var end = usings.Last().Span.End; 52var end = rootUsings.Last().Span.End; 60: root.Span.End;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\CSharpSyntaxContext.cs (1)
519lockStatement.Statement.Span.Contains(position))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\TypeDeclarationSyntaxExtensions.cs (1)
47start = members.Last().Span.End;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpRemoveUnnecessaryImportsService.cs (1)
67spansToFormat.Add(TextSpan.FromBounds(baseNamespace.Name.Span.End, firstMemberB.SpanStart));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (1)
2217if (descendant.SpanStart <= afterNode.Span.End)
Workspace\LanguageServices\CSharpSyntaxTreeFactoryService.NodeSyntaxReference.cs (1)
25=> _node.Span;
Microsoft.CodeAnalysis.EditorFeatures (2)
InlineRename\AbstractEditorInlineRenameService.cs (1)
60return targetNode.Span;
TextStructureNavigation\AbstractTextStructureNavigatorProvider.TextStructureNavigator.cs (1)
328while (node.Parent != null && node.Parent.Span == node.Span)
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (3)
RefactoringHelpers\RefactoringHelpersTestBase.cs (1)
38Assert.Equal(result, resultNode!.Span);
Structure\AbstractSyntaxNodeStructureProviderTests.cs (2)
34(position == node.Span.End && position == node.Parent.Span.End))
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (1)
CodeGeneration\CodeGenerationTests.cs (1)
920return token.Parent.AncestorsAndSelf().OfType<T>().FirstOrDefault(t => !fullSpanCoverage || t.Span.End >= destSpan.End);
Microsoft.CodeAnalysis.EditorFeatures.Wpf (1)
Peek\PeekHelpers.cs (1)
70return identifierLocation.SourceTree.GetLocation(node.Span).GetMappedLineSpan().Span;
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (2)
Expansion\AbstractExpansionTest.vb (1)
61If node.Span.End = spanEnd Then
Simplification\AbstractSimplificationTests.vb (1)
136If node.Span.End = spanEnd Then
Microsoft.CodeAnalysis.Features (79)
CodeLens\CodeLensFindReferenceProgress.cs (1)
81where !(_queriedNode.Span == candidateSyntaxNode.Span &&
CodeRefactorings\AddAwait\AbstractAddAwaitCodeRefactoringProvider.cs (2)
57expression.Span); 65expression.Span);
CodeRefactorings\SyncNamespace\AbstractChangeNamespaceService.cs (2)
869return x.Span.Start - y.Span.Start;
Completion\Providers\AbstractPartialTypeCompletionProvider.cs (1)
107.Any(node => !(node.SyntaxTree == context.SyntaxTree && node.Span.IntersectsWith(context.Position)));
ConvertAutoPropertyToFullProperty\AbstractConvertAutoPropertyToFullPropertyCodeRefactoringProvider.cs (1)
53property.Span);
ConvertCast\AbstractConvertCastCodeRefactoringProvider.cs (1)
64from.Span);
ConvertForEachToFor\AbstractConvertForEachToForCodeRefactoringProvider.cs (1)
82foreachStatement.Span);
ConvertForToForEach\AbstractConvertForToForEachCodeRefactoringProvider.cs (1)
141forStatement.Span);
ConvertIfToSwitch\AbstractConvertIfToSwitchCodeRefactoringProvider.cs (3)
55ifStatement.Span); 65ifStatement.Span); 239if (!fixAllSpans.Any(fixAllSpan => fixAllSpan.Contains(originalIfStatement.Span)))
ConvertIfToSwitch\AbstractConvertIfToSwitchCodeRefactoringProvider.Rewriting.cs (1)
39var ifSpan = ifStatement.Span;
ConvertLinq\AbstractConvertLinqQueryToForEachProvider.cs (1)
51queryExpression.Span);
ConvertLinq\ConvertForEachToLinqQuery\AbstractConvertForEachToLinqQueryProvider.cs (3)
93if (semanticModel.GetDiagnostics(forEachStatement.Span, cancellationToken) 118forEachStatement.Span); 141forEachStatement.Span);
ConvertToInterpolatedString\AbstractConvertConcatenationToInterpolatedStringRefactoringProvider.cs (1)
114top.Span);
ConvertToInterpolatedString\AbstractConvertPlaceholderToInterpolatedStringRefactoringProvider.cs (1)
111invocation.Span);
Debugging\AbstractDataTipInfoGetter.cs (1)
37return (DebugDataTipInfoKind.LinqExpression, invocation.Span);
Diagnostics\Analyzers\UnboundIdentifiersDiagnosticAnalyzerBase.cs (1)
69var typeNames = member.DescendantNodes().Where(n => IsQualifiedOrSimpleName(n) && !n.Span.IsEmpty);
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (5)
272=> TryGetDiagnosticSpan(node, editKind) ?? node.Span; 281return node.Span; 1366if (!newEncompassingAncestor.Span.Contains(newStatementSyntaxSpan.Start)) 1642if (TryGetActiveSpan(statement, statementPart, minLength: statement.Span.Length, out var span)) 1664return statement.Span;
EncapsulateField\AbstractEncapsulateFieldService.cs (1)
312.Select(n => (solution.GetRequiredDocument(n.SyntaxTree).Id, n.Span))
ExtractMethod\SelectionResult.cs (1)
170if (!node.Span.OverlapsWith(span))
GenerateType\AbstractGenerateTypeService.Editor.cs (1)
395new CodeGenerationContext(afterThisLocation: _semanticDocument.SyntaxTree.GetLocation(_state.SimpleName.Span))),
InitializeParameter\AbstractInitializeParameterCodeRefactoringProvider.cs (1)
121listOfPotentiallyValidParametersNodes.ToImmutable(), selectedParameter.Span, cancellationToken).ConfigureAwait(false);
InlineMethod\AbstractInlineMethodRefactoringProvider.cs (1)
243context.RegisterRefactoring(nestedCodeAction, calleeInvocationNode.Span);
IntroduceUsingStatement\AbstractIntroduceUsingStatementCodeRefactoringProvider.cs (2)
83localDeclaration.Span); 97expressionStatement.Span);
IntroduceVariable\AbstractIntroduceLocalForExpressionCodeRefactoringProvider.cs (2)
60expressionStatement.Span); 68expressionStatement.Span);
InvertIf\AbstractInvertIfCodeRefactoringProvider.cs (1)
100ifNode.Span);
InvertLogical\AbstractInvertLogicalCodeRefactoringProvider.cs (1)
79expression.Span);
MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceCodeRefactoringProvider.cs (1)
44declaration.Span);
ReplaceConditionalWithStatements\AbstractReplaceConditionalWithStatementsCodeRefactoringProvider.cs (2)
138conditionalExpression.Span); 167conditionalExpression.Span);
Snippets\SnippetProviders\AbstractConsoleSnippetProvider.cs (1)
68return caretTarget.Span.End;
SolutionCrawler\AbstractDocumentDifferenceService.cs (4)
163if (oldMember.Span.IsEmpty) 169if (!oldMember.Span.Contains(range.Span)) 177return (oldMember.Span.Length + lengthDelta) == newMember.Span.Length ? newMember : null;
SpellCheck\AbstractSpellCheckCodeFixProvider.cs (1)
48if (node != null && node.Span == span)
SplitOrMergeIfStatements\AbstractMergeIfStatementsCodeRefactoringProvider.cs (5)
48RegisterRefactoring(MergeDirection.Up, upperIfOrElseIf.Span, ifOrElseIf.Span); 51RegisterRefactoring(MergeDirection.Down, ifOrElseIf.Span, lowerIfOrElseIf.Span); 84node => ifGenerator.IsIfOrElseIf(node) && node.Span == span);
src\Analyzers\Core\Analyzers\PopulateSwitch\AbstractPopulateSwitchDiagnosticAnalyzer.cs (1)
68if (switchBlock.SyntaxTree.OverlapsHiddenPosition(switchBlock.Span, context.CancellationToken))
src\Analyzers\Core\Analyzers\RemoveUnnecessaryCast\AbstractRemoveUnnecessaryCastDiagnosticAnalyzer.cs (1)
66if (tree.OverlapsHiddenPosition(node.Span, cancellationToken))
src\Analyzers\Core\Analyzers\RemoveUnnecessaryImports\AbstractRemoveUnnecessaryImportsDiagnosticAnalyzer.cs (3)
153textSpan = TextSpan.FromBounds(node.Span.Start, nodeEnd); 167textSpan = TextSpan.FromBounds(node.Span.Start, nodeEnd); 181var end = node.Span.End;
src\Analyzers\Core\Analyzers\SimplifyInterpolation\AbstractSimplifyInterpolationHelpers.cs (3)
97unnecessarySpans.AddRange(invocation.Syntax.Span 112unnecessarySpans.AddRange(invocation.Syntax.Span 220unnecessarySpans.AddRange(invocation.Syntax.Span
src\Analyzers\Core\Analyzers\UseCollectionInitializer\UseCollectionInitializerHelpers.cs (2)
37syntaxTree.GetLocation(TextSpan.FromBounds(arguments.Last().FullSpan.End, match.Span.End))); 49syntaxTree.GetLocation(TextSpan.FromBounds(expression.FullSpan.End, match.Span.End)));
src\Analyzers\Core\Analyzers\UseObjectInitializer\AbstractUseObjectInitializerDiagnosticAnalyzer.cs (1)
149: syntaxFacts.GetExpressionOfMemberAccessExpression(match.MemberAccessExpression)!.Span.End;
src\Analyzers\Core\CodeFixes\AddAnonymousTypeMemberName\AbstractAddAnonymousTypeMemberNameCodeFixProvider.cs (1)
59if (node?.Span != span)
src\Analyzers\Core\CodeFixes\AddExplicitCast\Fixer.cs (1)
211if (newRoot.FindNode(targetNode.Span).GetAncestorOrThis<TArgumentListSyntax>() is TArgumentListSyntax newArgumentList)
src\Analyzers\Core\CodeFixes\RemoveUnusedParametersAndValues\AbstractRemoveUnusedValuesCodeFixProvider.cs (1)
846var spansToFormat = originalDeclStatementsToMoveOrRemove.Select(s => s.Span);
src\Analyzers\Core\CodeFixes\UseConditionalExpression\AbstractUseConditionalExpressionCodeFixProvider.cs (3)
149if (condition.Span.Length + trueSyntax.Span.Length + falseSyntax.Span.Length > formattingOptions.ConditionalExpressionWrappingLength)
Testing\AbstractTestMethodFinder.cs (1)
110return node.Span.IntersectsWith(textSpan) && DescendIntoChildren(node);
UseAutoProperty\AbstractUseAutoPropertyCodeFixProvider.cs (1)
168fieldDocument.Id == documentId ? !span.IntersectsWith(declarator.Span) : true && // The span check only makes sense if we are in the same file
UseNamedArguments\AbstractUseNamedArgumentsCodeRefactoringProvider.cs (3)
116argument.Span); 123argument.Span); 132argument.Span);
Wrapping\AbstractCodeActionComputer.cs (1)
267return (root, rewrittenRoot, trackedNode.Span);
Wrapping\BinaryExpression\BinaryExpressionCodeActionComputer.cs (1)
62OriginalSourceText.GetOffset(binaryExpression.Span.Start)
Wrapping\SeparatedSyntaxList\AbstractSeparatedSyntaxListWrapper.cs (1)
56if (listSyntax == null || listSyntax.Span.IsEmpty)
Wrapping\SeparatedSyntaxList\SeparatedSyntaxListCodeActionComputer.cs (2)
315currentOffset += item.Span.Length; 332currentOffset = indentationTrivia.FullWidth() + item.Span.Length;
Microsoft.CodeAnalysis.Features.Test.Utilities (2)
EditAndContinue\EditAndContinueTestVerifier.cs (2)
389if (result.Span == span) 515.ThenByDescending(partners => partners.Key.Span.Length)
Microsoft.CodeAnalysis.Test.Utilities (1)
Compilation\ControlFlowGraphVerifier.cs (1)
350if (model.GetDiagnostics(graph.OriginalOperation.Syntax.Span).
Microsoft.CodeAnalysis.VisualBasic (41)
Analysis\FlowAnalysis\AlwaysAssignedWalker.vb (3)
75If IsInsideRegion(branch.Branch.Syntax.Span) AndAlso Not _labelsInside.Contains(branch.Label) Then 84If node.Syntax IsNot Nothing AndAlso IsInsideRegion(node.Syntax.Span) Then 92If IsInside AndAlso pending.Branch IsNot Nothing AndAlso Not IsInsideRegion(pending.Branch.Syntax.Span) Then
Analysis\FlowAnalysis\DataFlowsInWalker.vb (3)
68If stmt.Syntax IsNot Nothing AndAlso labelStmt.Syntax IsNot Nothing AndAlso Not IsInsideRegion(stmt.Syntax.Span) AndAlso IsInsideRegion(labelStmt.Syntax.Span) Then 115If IsInsideRegion(node.Span) Then
Analysis\FlowAnalysis\EntryPointsWalker.vb (2)
47If stmt.Syntax IsNot Nothing AndAlso labelStmt.Syntax IsNot Nothing AndAlso IsInsideRegion(labelStmt.Syntax.Span) AndAlso Not IsInsideRegion(stmt.Syntax.Span) Then
Analysis\FlowAnalysis\ExitPointsWalker.vb (1)
102If IsInsideRegion(pending.Branch.Syntax.Span) Then
Analysis\FlowAnalysis\ReadWriteWalker.vb (7)
110If (Me._regionPlace <> RegionPlace.Inside AndAlso fieldAccess.Syntax.Span.Contains(_region)) Then NoteReceiverRead(fieldAccess) 135If _region.Contains(receiverSyntax.Span) Then readOrWritten.Add(CType(receiver, BoundLocal).LocalSymbol) 137If _region.Contains(receiverSyntax.Span) Then readOrWritten.Add(Me.MeParameter) 139If _region.Contains(receiverSyntax.Span) Then readOrWritten.Add(Me.MeParameter) 141If _region.Contains(receiverSyntax.Span) Then readOrWritten.Add(CType(receiver, BoundParameter).ParameterSymbol) 143If _region.Contains(receiverSyntax.Span) Then readOrWritten.Add(CType(receiver, BoundRangeVariable).RangeVariable) 145If receiver.Type.IsStructureType AndAlso receiverSyntax.Span.OverlapsWith(_region) Then NoteReceiverReadOrWritten(CType(receiver, BoundFieldAccess), readOrWritten)
Analysis\FlowAnalysis\VariablesDeclaredWalker.vb (1)
83If IsInsideRegion(catchBlock.Syntax.Span) Then
Binding\Binder_Invocation.vb (5)
1300If node.SyntaxTree Is groupOpt.Syntax.SyntaxTree AndAlso node.Span.Contains(groupOpt.Syntax.Span) Then 1949If argument.Syntax.Span.Contains(diagnostic.Location.SourceSpan) Then 3152callerInfoValue = ConstantValue.Create(callerInfoOpt.SyntaxTree.GetDisplayPath(callerInfoOpt.Span, Me.Compilation.Options.SourceReferenceResolver)) 3289Return syntax.Span
Binding\Binder_Query.vb (4)
625source.Syntax.Span, 4355source.Syntax.Span, additionalDiagnostics) 4373source.Syntax.Span, additionalDiagnostics) 4396source.Syntax.Span, additionalDiagnostics)
CodeGen\CodeGenerator.vb (1)
295EmitSequencePoint(syntax.SyntaxTree, syntax.Span)
Compilation\SyntaxTreeSemanticModel.vb (1)
868If location.SourceTree Is Me.SyntaxTree AndAlso nodeToCheck.Span.Contains(location.SourceSpan) Then
Lowering\Instrumentation\CodeCoverageInstrumenter.vb (2)
543Return syntax.Span 547Dim originalSpan As Text.TextSpan = syntax.Span
Lowering\Instrumentation\DebugInfoInjector.vb (1)
138sequencePointSpan = TextSpan.FromBounds(original.Syntax.SpanStart, original.Syntax.Span.End)
Symbols\LexicalSortKey.vb (2)
214Return first.Span.Start - second.Span.Start
Syntax\SimpleSyntaxReference.vb (1)
31Return _node.Span
Syntax\SyntaxFacts.vb (1)
202Dim span = node.Span
Syntax\SyntaxNodeRemover.vb (3)
214Me.AddDirectives(node, GetRemovedSpan(node.Span, node.FullSpan)) 240Dim span = TextSpan.FromBounds(token.Span.Start, node.Span.End) 264Dim span = TextSpan.FromBounds(node.Span.Start, token.Span.End)
Syntax\VisualBasicSyntaxNode.vb (3)
146''' Same as accessing <see cref="TextSpan.Start"/> on <see cref="Span"/>. 445Return New EmbeddedTreeLocation(tree.GetEmbeddedKind, Me.Span) 447Return New MyTemplateLocation(tree, Me.Span)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (12)
src\Analyzers\VisualBasic\Analyzers\AddAccessibilityModifiers\VisualBasicAddAccessibilityModifiersDiagnosticAnalyzer.vb (1)
40If Not context.ShouldAnalyzeSpan(member.Span) Then
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\ParenthesizedExpressionSyntaxExtensions.vb (1)
142node.OpenParenToken.Span.End = expression.Span.Start Then
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxNodeExtensions.vb (5)
409Dim parentSpan = trivia.GetStructure().Span 414Dim matchSpan = match.Span 865If declaration.Initializer IsNot Nothing AndAlso declaration.Initializer.Span.Contains(span) Then 872If [property] IsNot Nothing AndAlso [property].Initializer IsNot Nothing AndAlso [property].Initializer.Span.Contains(span) Then 885Dim blockSpan = TextSpan.FromBounds(block.BlockStatement.Span.End, block.EndBlockStatement.SpanStart)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Services\SyntaxFacts\VisualBasicSyntaxFacts.vb (5)
761If useFullSpan OrElse node.Span.Contains(position) Then 865Return [enum].Initializer IsNot Nothing AndAlso ContainsExclusively([enum].Initializer.Span, span) 870Return propStatement.Initializer IsNot Nothing AndAlso ContainsExclusively(propStatement.Initializer.Span, span) 886Return TextSpan.FromBounds(list.First.SpanStart, list.Last.Span.End) 891Return TextSpan.FromBounds(list.First.SpanStart, list.Last.Span.End)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (10)
src\Analyzers\VisualBasic\CodeFixes\GenerateParameterizedMember\GenerateParameterizedMemberCodeFixProvider.vb (2)
63If node.Span.Start = diagnosticSpan.Start AndAlso node.Span.End < diagnosticSpan.End Then
src\Analyzers\VisualBasic\CodeFixes\GenerateParameterizedMember\VisualBasicGenerateConversionService.vb (5)
33Return node.AncestorsAndSelf.Where(AddressOf IsCastExpression).Where(Function(n) n.Span.Contains(node.Span)).Any 44Return node.AncestorsAndSelf.Where(Function(n) n.IsKind(SyntaxKind.ImplementsClause)).Where(Function(n) n.Span.Contains(node.Span)).Any 48Return node.AncestorsAndSelf.Where(Function(n) n.IsKind(SyntaxKind.SimpleMemberAccessExpression)).Where(Function(n) n.Span.Contains(node.Span)).Any 84Dim castExpression = TryCast(expression.AncestorsAndSelf.Where(AddressOf IsCastExpression).Where(Function(n) n.Span.Contains(expression.Span)).FirstOrDefault, CastExpressionSyntax) 95expression = TryCast(expression.AncestorsAndSelf.Where(Function(n) TypeOf n Is ExpressionSyntax And n.Span.Contains(expression.Span)).FirstOrDefault, ExpressionSyntax)
src\Analyzers\VisualBasic\CodeFixes\Iterator\VisualBasicConvertToIteratorCodeFixProvider.vb (1)
58Dim symbol = model.GetEnclosingSymbol(node.Span.Start, cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\VisualBasicCodeGenerationService.vb (1)
86TextSpan.FromBounds(destination.Members.Last.Span.End, destination.EndOfFileToken.SpanStart), cancellationToken))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\TypeBlockSyntaxExtensions.vb (1)
19Dim start = destination.BlockStatement.Span.End
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures (8)
EndConstructGeneration\EndConstructStatementVisitor_IfStatement.vb (1)
47Dim position = If(ifBlock.Statements.Any(), ifBlock.Statements(0).SpanStart, ifBlock.IfStatement.Span.End + _state.NewLineCharacter.Length)
EndConstructGeneration\VisualBasicEndConstructGenerationService.vb (1)
310Dim aligningWhitespace = subjectBuffer.CurrentSnapshot.GetAligningWhitespace(state.TokenToLeft.Parent.Span.Start)
LineCommit\CommitBufferManager.vb (1)
209finalSpanEnd = Math.Max(finalSpanEnd, endingStatementInfo.MatchingBlockConstruct.Span.End)
LineCommit\ContainingStatementInfo.vb (3)
17Me.New(node, node.Span) 186Return New ContainingStatementInfo(node, TextSpan.FromBounds(attributes.Last.Span.End, node.Span.End))
Utilities\NavigationPointHelpers.vb (2)
17line = text.Lines.GetLineFromPosition(eventBlock.EventStatement.Span.End).LineNumber + 1 28line = text.Lines.GetLineFromPosition(methodBlock.BlockStatement.Span.End).LineNumber + 1
Microsoft.CodeAnalysis.VisualBasic.Features (99)
ChangeSignature\VisualBasicChangeSignatureService.vb (1)
111If Not matchingNode.Span.IntersectsWith(position) Then
CodeFixes\CorrectNextControlVariable\CorrectNextControlVariableCodeFixProvider.vb (1)
51Dim indexOfControlVariable = nextStatement.ControlVariables.IndexOf(Function(n) n.Span.Contains(context.Span))
CodeFixes\GenerateEndConstruct\GenerateEndConstructCodeFixProvider.vb (2)
124Return begin.Span.Contains(node.Span)
CodeFixes\MoveToTopOfFile\MoveToTopOfFileCodeFixProvider.vb (1)
97node.Span.End > m.SpanStart)
CodeFixes\OverloadBase\OverloadBaseCodeFixProvider.AddKeywordAction.vb (1)
76newNode = Await cleanupService.CleanupAsync(newNode, ImmutableArray.Create(newNode.Span), options, services, cleanupService.GetDefaultProviders(), cancellationToken).ConfigureAwait(False)
CodeRefactorings\InlineTemporary\VisualBasicInlineTemporaryCodeRefactoringProvider.vb (1)
66variableDeclarator.Span)
Debugging\DataTipInfoGetter.vb (1)
60Dim span = expression.Span
EditAndContinue\BreakpointSpans.vb (8)
92Return TextSpan.FromBounds(node.SpanStart, node.Span.End) 100Return TextSpan.FromBounds(list.First.SpanStart, list.Last.Span.End) 237Return TextSpan.FromBounds(methodBase.DeclarationKeyword.SpanStart, methodBase.Span.End) 240Return TextSpan.FromBounds(methodBase.Modifiers.First().SpanStart, methodBase.Span.End) 250Return TextSpan.FromBounds(node.Identifier.Span.Start, node.Initializer.Span.End) 254Return TextSpan.FromBounds(node.Identifier.Span.Start, node.AsClause.Span.End) 417Return TextSpan.FromBounds(clause.Keys.First.SpanStart, clause.Span.End) 429Return clause.Variables(GetItemIndexByPosition(clause.Variables, position)).Expression.Span
EditAndContinue\DeclarationBody\FieldOrPropertyDeclarationBody.vb (1)
122Return InitializerActiveStatement.Span
EditAndContinue\DeclarationBody\FieldWithMultipleAsNewClauseDeclarationBody.vb (4)
37Return TextSpan.FromBounds(_modifedIdentifier.Span.Start, OtherActiveStatementContainer.Span.End) 43Return TextSpan.FromBounds(_modifedIdentifier.Span.End, OtherActiveStatementContainer.Span.Start).Contains(span)
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 (27)
157While node.Span.Length < span.Length AndAlso node.Parent.SpanStart = position 1004Return DirectCast(model.GetEnclosingSymbol(lambdaExpressionSyntax.SubOrFunctionHeader.Span.End, cancellationToken), IMethodSymbol) 1074Return If(TryGetDiagnosticSpanImpl(node, editKind), node.Span) 1100Return node.Span 1176Return node.Span 1188Return node.Span 1193Return node.Span 1230Return DirectCast(node, SyncLockBlockSyntax).SyncLockStatement.Span 1233Return DirectCast(node, WithBlockSyntax).WithStatement.Span 1236Return DirectCast(node, UsingBlockSyntax).UsingStatement.Span 1243Return DirectCast(node, DoLoopBlockSyntax).DoStatement.Span 1246Return DirectCast(node, WhileBlockSyntax).WhileStatement.Span 1250Return DirectCast(node, ForOrForEachBlockSyntax).ForOrForEachStatement.Span 1264Return DirectCast(node, LambdaExpressionSyntax).SubOrFunctionHeader.Span 1295Return node.Span 1308Return node.Span 1314Return node.Span 1320If(thenKeywordOpt.RawKind <> 0, thenKeywordOpt.Span.End, condition.Span.End)) 1324Return TextSpan.FromBounds(node.NamespaceKeyword.SpanStart, node.Name.Span.End) 1421Return DirectCast(lambda, LambdaExpressionSyntax).SubOrFunctionHeader.ParameterList.Parameters(ordinal).Identifier.Span 1424Return lambda.Span 2135Return TextSpan.FromBounds(tryBlock.FinallyBlock.SpanStart, tryBlock.EndTryStatement.Span.End) 2138Return TextSpan.FromBounds(tryBlock.CatchBlocks.First().SpanStart, tryBlock.EndTryStatement.Span.End) 2142Return node.Span 2146Return DirectCast(node.Parent, TryBlockSyntax).Span 2183diagnosticContext.Report(RudeEditKind.AwaitStatementUpdate, newContainingStatementPart.Span) 2297AddAroundActiveStatementRudeDiagnostic(diagnostics, oldActiveStatement, onErrorOrResumeStatement, newActiveStatement.Span)
EncapsulateField\VisualBasicEncapsulateFieldService.vb (1)
74Dim fields = root.DescendantNodes(Function(n) n.Span.IntersectsWith(span)) _
ExtractMethod\Extensions.vb (9)
74Dim firstContainingSpan = initialNode.Span 85Loop While node IsNot Nothing AndAlso node.Span.Equals(firstContainingSpan) 113Return equal.Value IsNot Nothing AndAlso equal.Value.Span.Contains(node.Span) 121If argument Is Nothing OrElse node.Span <> argument.Span Then 189If Not textSpan.Contains(directive.Span) Then 273If range.UpperBound.Span.Contains(token.Span) AndAlso 283Dim span = TextSpan.FromBounds(asNewClause.NewExpression.NewKeyword.Span.End, asNewClause.NewExpression.Span.End) 320Dim blockSpan = TextSpan.FromBounds(block.BlockStatement.Span.End, block.EndBlockStatement.SpanStart)
ExtractMethod\VisualBasicSelectionValidator.vb (1)
397If expression IsNot Nothing AndAlso statement1.Span.Contains(expression.Span) Then
GenerateType\VisualBasicGenerateTypeService.vb (2)
393simpleName.Span.End <= t.Members.Last().Span.End) 446semanticModel.SyntaxTree.GetLocation(New TextSpan(lastMember.Span.End, 0)))
Highlighting\KeywordHighlighters\MultiLineIfBlockHighlighter.vb (1)
51highlights.Add(ifBlock.EndIfStatement.Span)
Highlighting\KeywordHighlighters\TryBlockHighlighter.vb (1)
59highlights.Add(node.Span)
Highlighting\KeywordHighlightingHelpers.vb (2)
22highlights.Add(.Span) 28highlights.Add(.Span)
InlineHints\VisualBasicInlineParameterNameHintsService.vb (1)
56buffer.Add((argument.Span.Start, argument, parameter, GetKind(argument.Expression)))
LanguageServices\VisualBasicSymbolDisplayService.SymbolDescriptionBuilder.vb (1)
161LanguageServices, semanticModel, equalsValue.Value.Span, Options.ClassificationOptions, CancellationToken).ConfigureAwait(False)
SignatureHelp\AttributeSignatureHelpProvider.vb (1)
50node.ArgumentList.Span.Contains(token.SpanStart) AndAlso
SignatureHelp\CastExpressionSignatureHelpProvider.vb (1)
49Return node.Span.Contains(token.SpanStart) AndAlso
SignatureHelp\CollectionInitializerSignatureHelpProvider.vb (1)
45Return expression.Span.Contains(token.SpanStart) AndAlso token <> expression.CloseBraceToken
SignatureHelp\ConditionalExpressionSignatureHelpProvider.vb (1)
36Return node.Span.Contains(token.SpanStart) AndAlso
SignatureHelp\GenericNameSignatureHelpProvider.vb (1)
59Return node.TypeArgumentList.Span.Contains(token.SpanStart) AndAlso
SignatureHelp\InvocationExpressionSignatureHelpProvider.vb (1)
61node.ArgumentList.Span.Contains(token.SpanStart) AndAlso
SignatureHelp\MidAssignmentSignatureHelpProvider.vb (1)
43DirectCast(node.Left, MidExpressionSyntax).ArgumentList.Span.Contains(token.SpanStart) AndAlso
SignatureHelp\ObjectCreationExpressionSignatureHelpProvider.vb (1)
60node.ArgumentList.Span.Contains(token.SpanStart) AndAlso
SignatureHelp\RaiseEventStatementSignatureHelpProvider.vb (1)
59statement.ArgumentList.Span.Contains(token.SpanStart) AndAlso
src\Analyzers\VisualBasic\Analyzers\AddAccessibilityModifiers\VisualBasicAddAccessibilityModifiersDiagnosticAnalyzer.vb (1)
40If Not context.ShouldAnalyzeSpan(member.Span) Then
src\Analyzers\VisualBasic\CodeFixes\GenerateParameterizedMember\GenerateParameterizedMemberCodeFixProvider.vb (2)
63If node.Span.Start = diagnosticSpan.Start AndAlso node.Span.End < diagnosticSpan.End Then
src\Analyzers\VisualBasic\CodeFixes\GenerateParameterizedMember\VisualBasicGenerateConversionService.vb (5)
33Return node.AncestorsAndSelf.Where(AddressOf IsCastExpression).Where(Function(n) n.Span.Contains(node.Span)).Any 44Return node.AncestorsAndSelf.Where(Function(n) n.IsKind(SyntaxKind.ImplementsClause)).Where(Function(n) n.Span.Contains(node.Span)).Any 48Return node.AncestorsAndSelf.Where(Function(n) n.IsKind(SyntaxKind.SimpleMemberAccessExpression)).Where(Function(n) n.Span.Contains(node.Span)).Any 84Dim castExpression = TryCast(expression.AncestorsAndSelf.Where(AddressOf IsCastExpression).Where(Function(n) n.Span.Contains(expression.Span)).FirstOrDefault, CastExpressionSyntax) 95expression = TryCast(expression.AncestorsAndSelf.Where(Function(n) TypeOf n Is ExpressionSyntax And n.Span.Contains(expression.Span)).FirstOrDefault, ExpressionSyntax)
src\Analyzers\VisualBasic\CodeFixes\Iterator\VisualBasicConvertToIteratorCodeFixProvider.vb (1)
58Dim symbol = model.GetEnclosingSymbol(node.Span.Start, cancellationToken)
Structure\Providers\CollectionInitializerStructureProvider.vb (1)
40node.Span.End)
Structure\Providers\CompilationUnitStructureProvider.vb (1)
25Dim endPos = compilationUnit.Imports.Last().Span.End
Structure\Providers\InterpolatedStringExpressionStructureProvider.vb (1)
27textSpan:=node.Span,
Structure\Providers\ObjectCreationInitializerStructureProvider.vb (2)
34textSpan:=TextSpan.FromBounds(previousToken.Span.End, node.Span.End), 35hintSpan:=node.Parent.Span,
Structure\Providers\StringLiteralExpressionStructureProvider.vb (1)
24textSpan:=node.Span,
Structure\Providers\XmlExpressionStructureProvider.vb (1)
25Dim span = xmlExpression.Span
Structure\VisualBasicStructureHelpers.vb (4)
192blockNode.Span, GetHintSpan(blockNode), 204blockNode.Span, GetHintSpan(blockNode), 219Return TextSpan.FromBounds(child.SpanStart, blockNode.Span.End) 224Return blockNode.Span
Wrapping\SeparatedSyntaxList\VisualBasicCollectionCreationExpressionWrapper.vb (1)
66Return listSyntax.Span.Contains(position)
Microsoft.CodeAnalysis.VisualBasic.Features.UnitTests (1)
EditAndContinue\BreakpointSpansTests.vb (1)
85Dim endPosition = root.Span.End
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (14)
Compilation\SemanticModelAPITests.vb (4)
936Dim position1 = originalStatement.Span.End 971Dim position1 = originalStatement.Span.End 1661Dim position1 = originalStatement.Span.End 1697Dim position1 = originalStatement.Span.End
Compilation\SemanticModelGetDeclaredSymbolAPITests.vb (7)
1013Assert.Equal(treeA.GetLineSpan(syntax.Span).StartLinePosition.Line, 1019Assert.Equal(treeA.GetLineSpan(syntax.Span).StartLinePosition.Line, 1025Assert.Equal(treeA.GetLineSpan(syntax.Span).StartLinePosition.Line, 1031Assert.Equal(treeA.GetLineSpan(syntax.Span).StartLinePosition.Line, 1037Assert.Equal(treeB.GetLineSpan(syntax.Span).StartLinePosition.Line, 1043Assert.Equal(treeB.GetLineSpan(syntax.Span).StartLinePosition.Line, 1052Assert.Equal(treeB.GetLineSpan(syntax.Span).StartLinePosition.Line,
FlowAnalysis\FlowTestBase.vb (3)
199If endPosition >= endNode.Span.End Then endPosition = endNode.Span.End 200While endNode IsNot Nothing AndAlso endNode.Span.End = endPosition
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (3)
SymbolsTests\AnonymousTypes\AnonymousTypesSemanticsTests.vb (2)
1873Assert.True(statement1.Span.Contains(typeA3.Locations(0).SourceSpan)) 1874Assert.True(statement2.Span.Contains(typeA4.Locations(0).SourceSpan))
SymbolsTests\MyBaseMyClassSemanticsTests.vb (1)
86Dim span As TextSpan = node.Span
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (20)
Syntax\SyntaxAnnotationTests.vb (2)
566Assert.Equal(oldNode.Span, annotatedNode.Span)
TestSyntaxNodes.vb (18)
324Assert.True(tree.FullSpan.Contains(tree.Span)) 328Assert.Equal(tree.Span, tree.FullSpan) 340Assert.Equal(tree.Span.End, tree.FullSpan.End) 342VerifyListSpans(followingTrivia, New TextSpan(tree.Span.End, (tree.FullSpan.End - tree.Span.End))) 375Assert.Equal(New TextSpan(0, 1), dig1.Span) 381Assert.Equal(New TextSpan(0, 4), binop.Span) 384Assert.Equal(New TextSpan(3, 1), binop.Right.Span) 388Assert.Equal(New TextSpan(0, 17), simpleTree.Span) 390Assert.Equal(New TextSpan(3, 14), DirectCast(simpleTree, BinaryExpressionSyntax).Right.Span) 393Assert.Equal(New TextSpan(6, 1), argList.Arguments(0).Span) 395Assert.Equal(New TextSpan(9, 4), argList.Arguments(1).Span) 397Assert.Equal(New TextSpan(15, 1), argList.Arguments(2).Span) 596Assert.Equal(start + 3, seplist(0).Span.End) 816Assert.Equal(7, endTry.Span.Length) 927Assert.Equal(0, endIfStmt.Span.Length) 2256Assert.Equal(root, root.FindNode(root.Span, findInsideTrivia:=False)) 2257Assert.Equal(root, root.FindNode(root.Span, findInsideTrivia:=True))
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (9)
ParserTestUtilities.vb (9)
378Assert.False(node.IsMissing, "Unexpected missing node: " & node.Kind.ToString & node.Span.ToString) 388Assert.True(0 <> node.Span.Length OrElse node.Kind = SyntaxKind.CompilationUnit, "Unexpected 0 width node: " & node.Kind.ToString & node.Span.ToString) 453node.Span.End <= node.Parent.Span.End, "Span of child (" & 454node.Kind.ToString & node.Span.ToString & 456node.Parent.Kind.ToString & node.Parent.Span.ToString & ")") 858node.Span.End <= node.Parent.Span.End, "Span of child (" & 861node.Parent.Kind.ToString & node.Parent.Span.ToString & ")")
Microsoft.CodeAnalysis.VisualBasic.Workspaces (56)
Classification\Worker.DocumentationCommentClassifier.vb (1)
19If Not _worker._textSpan.OverlapsWith(documentationComment.Span) Then
Classification\Worker.vb (1)
172If Not _textSpan.OverlapsWith(skippedTokens.Span) Then
CodeCleanup\Providers\AddMissingTokensCodeCleanupProvider.vb (2)
332Dim span = originalNode.Span 567Return node IsNot Nothing AndAlso node.Span.Length > 0
CodeCleanup\Providers\NormalizeModifiersOrOperatorsCodeCleanupProvider.vb (3)
202Dim span = node.Span 242Dim span = node.Span 454Dim span = originalNode.Span
CodeGeneration\VisualBasicSyntaxGenerator.vb (8)
3382If root.Span.Contains(declaration.Span) Then 3462If root.Span.Contains(declaration.Span) Then 3488If root.Span.Contains(declaration.Span) Then 3602If root.Span.Contains(declaration.Span) Then
Rename\VisualBasicRenameRewriterLanguageService.vb (6)
168_conflictLocations.Contains(node.Span) AndAlso 178If Me._complexifiedSpans.Contains(originalNode.Span) Then 181Me._complexifiedSpans.Add(originalNode.Span) 199Dim oldSpan = originalNode.Span 232Dim newSpan = expandedNewNode.Span 248If Me._conflictLocations.Contains(node.Span) Then
Simplification\Reducers\VisualBasicVariableDeclaratorReducer.vb (2)
107issueSpan = variableDeclarator.Span 135issueSpan = variableDeclarator.Span
Simplification\Simplifiers\AbstractVisualBasicSimplifier.vb (1)
172boundSymbols = semanticModel.LookupNamespacesAndTypes(node.Span.Start, name:=aliasName + "Attribute")
Simplification\Simplifiers\ExpressionSimplifier.vb (8)
39issueSpan = memberAccessExpression.Expression.Span 92issueSpan = memberAccess.Span 119issueSpan = memberAccess.Span 124issueSpan = memberAccess.Expression.Span 143issueSpan = memberAccess.Span 158issueSpan = memberAccess.Expression.Span 261issueSpan = left.Span 281issueSpan = memberAccess.Name.Span
Simplification\Simplifiers\NameSimplifier.vb (10)
50issueSpan = genericName.TypeArgumentList.Span 67issueSpan = name.Span 104issueSpan = name.Span 112issueSpan = qualifiedName.Left.Span 182issueSpan = name.Span 210issueSpan = name.Span 232issueSpan = qualifiedName.Left.Span 337issueSpan = name.Right.Span 376issueSpan = New TextSpan(name.Span.End - 9, 9) 457Return Not name.Span.Contains(argumentDecl.Span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\ParenthesizedExpressionSyntaxExtensions.vb (1)
142node.OpenParenToken.Span.End = expression.Span.Start Then
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxNodeExtensions.vb (5)
409Dim parentSpan = trivia.GetStructure().Span 414Dim matchSpan = match.Span 865If declaration.Initializer IsNot Nothing AndAlso declaration.Initializer.Span.Contains(span) Then 872If [property] IsNot Nothing AndAlso [property].Initializer IsNot Nothing AndAlso [property].Initializer.Span.Contains(span) Then 885Dim blockSpan = TextSpan.FromBounds(block.BlockStatement.Span.End, block.EndBlockStatement.SpanStart)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Services\SyntaxFacts\VisualBasicSyntaxFacts.vb (5)
761If useFullSpan OrElse node.Span.Contains(position) Then 865Return [enum].Initializer IsNot Nothing AndAlso ContainsExclusively([enum].Initializer.Span, span) 870Return propStatement.Initializer IsNot Nothing AndAlso ContainsExclusively(propStatement.Initializer.Span, span) 886Return TextSpan.FromBounds(list.First.SpanStart, list.Last.Span.End) 891Return TextSpan.FromBounds(list.First.SpanStart, list.Last.Span.End)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\VisualBasicCodeGenerationService.vb (1)
86TextSpan.FromBounds(destination.Members.Last.Span.End, destination.EndOfFileToken.SpanStart), cancellationToken))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\TypeBlockSyntaxExtensions.vb (1)
19Dim start = destination.BlockStatement.Span.End
Workspace\LanguageServices\VisualBasicSyntaxTreeFactoryService.NodeSyntaxReference.vb (1)
26Return _node.Span
Microsoft.CodeAnalysis.Workspaces (56)
CodeCleanup\AbstractCodeCleanerService.cs (2)
205return TryCreateTextSpan(GetPreviousTokenStartPosition(previousTokenMarker.Type, previousToken), node.Span.End, out span); 226span = TextSpan.FromBounds(GetPreviousTokenStartPosition(previousTokenMarker.Type, previousToken), node.Span.End);
Differencing\AbstractSyntaxComparer.cs (1)
49=> node.Span;
LanguageServices\DeclaredSymbolFactoryService\AbstractDeclaredSymbolInfoFactoryService.cs (1)
316nameSyntax.Span,
ObsoleteSymbol\AbstractObsoleteSymbolService.cs (1)
72if (current.Span.IntersectsWith(span))
ReassignedVariable\AbstractReassignedVariableService.cs (3)
77if (current.Span.IntersectsWith(span)) 131result.Add(identifier.Span); 285localDeclaration.Span,
Recommendations\AbstractRecommendationServiceRunner.cs (1)
354declarationSyntax.Span.IntersectsWith(candidateLocation.SourceSpan)), declarationSyntax);
Rename\ConflictEngine\ConflictResolver.Session.cs (1)
429ComplexifiedTargetSpan: complexifiedTarget != null ? complexifiedTarget.Span : default));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (5)
196=> node.Span.Length; 301var fullSpan = nodes.First().Span; 306Math.Max(fullSpan.End, node.Span.End)); 313=> node.OverlapsHiddenPosition(node.Span, cancellationToken); 320var start = startNode.Span.End;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (2)
79node.DescendantNodesAndSelf(n => n != previous && n.Span.IntersectsWith(span) && !span.Contains(n.Span))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (2)
29if (node.Parent.Span != node.Span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\BaseIndentationFormattingRule.cs (1)
41else if (node.Span.Contains(_span))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Helpers\RemoveUnnecessaryImports\AbstractUnnecessaryImportsProvider.cs (3)
41=> x?.Span == y?.Span; 44=> obj.Span.GetHashCode();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (4)
59if (holes.Any(static (h, position) => h.Span.Contains(position) && position > h.Span.Start, position)) 94var endOfAttributeLists = attributeList.Last().Span.End; 97return Math.Min(afterAttributesToken.Span.Start, node.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SelectedMembers\AbstractSelectedMembers.cs (1)
111if (textSpan.Contains(member.Span))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\AbstractDocumentationCommentService.cs (1)
74var sb = new StringBuilder(summaryElement.Span.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (6)
164var span = TextSpan.FromBounds(nodes.First().Span.Start, nodes.Last().Span.End); 179=> ContainsInterleavedDirective(syntaxFacts, node.Span, node, cancellationToken); 455var endOfAttributeLists = attributeList.Last().Span.End; 458var endOfNode = node.Span.End; 464return node.Span;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AbstractSpeculationAnalyzer.cs (1)
775!forEachExpression.Span.Contains(OriginalExpression.SpanStart))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\CommonFormattingHelpers.cs (1)
366var endPosition = endToken.RawKind == 0 ? root.Span.End : endToken.Span.End;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (1)
221var beforeMember = declarationList.FirstOrDefault(m => m.Span.End >= info.Context.BeforeThisLocation.SourceSpan.End);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\AbstractRefactoringHelpersService.cs (4)
28if (!allowEmptyNodes && node.Span.IsEmpty) 288if (leftNode.GetLastToken().Span.End != location && leftNode.Span.End != location) 334if (rightNode.Span.Start != location) 538var argumentStartLine = sourceText.Lines.GetLineFromPosition(typedAncestor.Span.Start).LineNumber;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\CodeRefactoringHelpers.cs (6)
51if (selection.IsEmpty || node.Span.IsEmpty) 57if (selection.Contains(node.Span)) 84var beginningNode = node.FindToken(node.Span.Start).Parent; 85var endNode = node.FindToken(node.Span.End - 1).Parent; 96return beginningNode.Span.End <= selection.Start || endNode.Span.Start >= selection.End;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.State.cs (1)
172var affectedSpan = TextSpan.FromBounds(previousToken.SpanStart, FirstStatementAffectedInInnermostBlock.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\RemoveUnnecessaryImports\AbstractRemoveUnnecessaryImportsService.cs (3)
48=> x?.Span == y?.Span; 51=> obj.Span.GetHashCode();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\Simplifiers\AbstractMemberAccessExpressionSimplifier.cs (1)
71return !semanticModel.SyntaxTree.OverlapsHiddenPosition(memberAccessExpression.Span, cancellationToken) &&
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\NullableHelpers.cs (3)
43semanticFacts, semanticModel, rootOperation, declaredSymbol, rootOperation.Syntax.Span, includeDeclaration: true, cancellationToken) == true; 67if (!span.IntersectsWith(operation.Syntax.Span)) 70if (span.Contains(operation.Syntax.Span) &&
Microsoft.Maui.Controls.BindingSourceGen (1)
BindingSourceGenerator.cs (1)
130 NullableContext nullableContext = context.SemanticModel.GetNullableContext(context.Node.Span.Start);
Microsoft.ML.InternalCodeAnalyzer (2)
ContractsCheckNameofFixProvider.cs (2)
92if (candidate.Span.Length < shortestSymbol) 95shortestSymbol = candidate.Span.Length;
Microsoft.VisualStudio.LanguageServices (6)
CodeLens\RemoteCodeLensReferencesService.cs (4)
57(service, solutionInfo, cancellationToken) => service.GetReferenceCountAsync(solutionInfo, documentId, syntaxNode.Span, maxSearchResults, cancellationToken), 103(service, solutionInfo, cancellationToken) => service.FindReferenceMethodsAsync(solutionInfo, documentId, syntaxNode.Span, cancellationToken), 128(service, solutionInfo, cancellationToken) => service.GetFullyQualifiedNameAsync(solutionInfo, documentId, syntaxNode.Span, cancellationToken), 266(service, solutionInfo, cancellationToken) => service.FindReferenceLocationsAsync(solutionInfo, documentId, syntaxNode.Span, cancellationToken),
Venus\ContainedDocument.cs (2)
835if (current.Span.Start == visibleTextSpan.Start) 845if (current.Span.Start < visibleSpan.Start)
Microsoft.VisualStudio.LanguageServices.CSharp (19)
CodeModel\CSharpCodeModelService.NodeLocator.cs (19)
807endPosition = node.Span.End; 836endPosition = node.Span.End; 840endPosition = node.Name.Span.End; 870endPosition = node.Span.End; 904endPosition = node.Span.End; 945endPosition = node.Span.End; 1015endPosition = node.AttributeLists.Last().Span.End; 1019endPosition = node.Span.End; 1073endPosition = node.Span.End; 1114endPosition = node.AttributeLists.Last().Span.End; 1118endPosition = node.Span.End; 1153endPosition = node.Span.End; 1157endPosition = node.Name.Span.End; 1170return new VirtualTreePoint(fileScopedNamespace.SyntaxTree, text, fileScopedNamespace.Parent.Span.End); 1203endPosition = node.Span.End; 1207endPosition = node.Name.Span.End; 1241endPosition = node.Span.End; 1283endPosition = field.Span.End; 1324endPosition = node.Span.End;
Microsoft.VisualStudio.LanguageServices.VisualBasic (38)
CodeModel\VisualBasicCodeModelService.NodeLocator.vb (35)
343startPosition = statement.Span.End 371startPosition = typeBlock.BlockStatement.Span.End 374startPosition = typeBlock.Span.End 414startPosition = statement.Span.End 442startPosition = enumBlock.EnumStatement.Span.End 445startPosition = enumBlock.Span.End 572endPosition = declareStatement.Span.End 657startPosition = methodBlock.BlockStatement.Span.End 660startPosition = methodBlock.Span.End 692endPosition = methodStatement.Span.End 728Dim beginLine = text.Lines.IndexOf(propertyStatement.Span.End) 760startPosition = propertyStatement.Span.End 766DirectCast(propertyStatement.Parent, PropertyBlockSyntax).EndPropertyStatement.Span.End, 767propertyStatement.Span.End) 883startPosition = eventStatement.Span.End 889DirectCast(eventStatement.Parent, EventBlockSyntax).EndEventStatement.Span.End, 890eventStatement.Span.End) 898eventStatement.Span.End) 963endPosition = delegateStatement.Span.End 1043endPosition = namespaceBlock.NamespaceStatement.Name.Span.End 1051endPosition = namespaceBlock.NamespaceStatement.Span.End 1055endPosition = namespaceBlock.EndNamespaceStatement.Span.End 1134endPosition = variable.Span.End 1145endPosition = fieldDeclaration.Span.End 1169endPosition = enumMember.Span.End 1212endPosition = parameter.Identifier.Span.End 1223endPosition = parameter.Span.End 1274endPosition = importsStatement.Span.End 1326endPosition = optionStatement.Span.End 1378endPosition = inheritsStatement.Span.End 1430endPosition = implementsStatement.Span.End 1477endPosition = attribute.Name.Span.End 1487endPosition = attribute.Span.End 1546endPosition = DirectCast(argument, SimpleArgumentSyntax).NameColonEquals.Name.Span.End 1556endPosition = argument.Span.End
CodeModel\VisualBasicCodeModelService.vb (3)
4075position = methodStatement.HandlesClause.Span.End 4127text = text.Replace(methodStatement.HandlesClause.Span, String.Empty) 4135text = text.Replace(TextSpan.FromBounds(methodStatement.HandlesClause.Events.GetSeparator(index - 1).SpanStart, clauseItemToRemove.Span.End), String.Empty)
System.Text.RegularExpressions.Generator (2)
UpgradeToGeneratedRegexCodeFixer.cs (2)
140nodeToFix = root.FindNode(new TextSpan(nodeToFix.Span.Start + (typesModified * "partial".Length), nodeToFix.Span.Length), getInnermostNodeForTie: true);