2 overrides of SourceSpan
Microsoft.CodeAnalysis (2)
Diagnostic\ExternalFileLocation.cs (1)
33public override TextSpan SourceSpan
Diagnostic\SourceLocation.cs (1)
64public override TextSpan SourceSpan
925 references to SourceSpan
AnalyzerRunner (2)
DiagnosticAnalyzerRunner.cs (2)
206.ThenBy(tuple => tuple.Item2.Location.SourceSpan.Start) 207.ThenBy(tuple => tuple.Item2.Location.SourceSpan.End);
ConfigurationSchemaGenerator (1)
RuntimeSource\SourceGenerators\DiagnosticInfo.cs (1)
34=> Location.Create(location.SourceTree?.FilePath ?? "", location.SourceSpan, location.GetLineSpan().Span);
GenerateDocumentationAndConfigFiles (21)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\AnalysisContextExtensions.cs (2)
54=> location.SourceTree != null && context.ShouldAnalyzeSpan(location.SourceSpan, location.SourceTree); 74=> location.SourceTree != null && context.ShouldAnalyzeSpan(location.SourceSpan, location.SourceTree);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\LocationExtensions.cs (7)
19=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindToken(location.SourceSpan.Start); 22=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan); 25=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan, getInnermostNodeForTie: getInnermostNodeForTie); 28=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan, findInsideTrivia, getInnermostNodeForTie); 38return !(tree == null || tree.IsHiddenPosition(loc.SourceSpan.Start)); 44return loc1.SourceTree == loc2.SourceTree && loc1.SourceSpan.IntersectsWith(loc2.SourceSpan);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
55var node = root.FindNode(location.SourceSpan, getInnermostNodeForTie: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (2)
263WriteInteger(location.SourceSpan.Start); 264WriteInteger(location.SourceSpan.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\ForkingSyntaxEditorBasedCodeFixProvider.cs (1)
67diagnostic.AdditionalLocations[0].SourceSpan, getInnermostNodeForTie: true);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\SyntaxEditorBasedCodeFixProvider.cs (2)
43.Sort((d1, d2) => d1.Location.SourceSpan.Start - d2.Location.SourceSpan.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (2)
205var afterMember = declarationList.LastOrDefault(m => m.SpanStart <= info.Context.AfterThisLocation.SourceSpan.Start); 221var beforeMember = declarationList.FirstOrDefault(m => m.Span.End >= info.Context.BeforeThisLocation.SourceSpan.End);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\FindSymbols\LinkedFileReferenceLocationEqualityComparer.cs (3)
25return x.Location.SourceSpan == y.Location.SourceSpan; 29=> obj.Location.SourceSpan.GetHashCode();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.State.cs (1)
107let token = syntaxRoot.FindToken(r.Location.SourceSpan.Start)
ILLink.CodeFixProvider (2)
BaseAttributeCodeFixProvider.cs (1)
42SyntaxNode targetNode = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
DynamicallyAccessedMembersCodeFixProvider.cs (1)
103if (root.FindNode(diagnostic.AdditionalLocations[0].SourceSpan, getInnermostNodeForTie: true) is not SyntaxNode targetNode)
Metrics (12)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\AnalysisContextExtensions.cs (2)
54=> location.SourceTree != null && context.ShouldAnalyzeSpan(location.SourceSpan, location.SourceTree); 74=> location.SourceTree != null && context.ShouldAnalyzeSpan(location.SourceSpan, location.SourceTree);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\LocationExtensions.cs (7)
19=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindToken(location.SourceSpan.Start); 22=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan); 25=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan, getInnermostNodeForTie: getInnermostNodeForTie); 28=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan, findInsideTrivia, getInnermostNodeForTie); 38return !(tree == null || tree.IsHiddenPosition(loc.SourceSpan.Start)); 44return loc1.SourceTree == loc2.SourceTree && loc1.SourceSpan.IntersectsWith(loc2.SourceSpan);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
55var node = root.FindNode(location.SourceSpan, getInnermostNodeForTie: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (2)
263WriteInteger(location.SourceSpan.Start); 264WriteInteger(location.SourceSpan.Length);
Metrics.Legacy (12)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\AnalysisContextExtensions.cs (2)
54=> location.SourceTree != null && context.ShouldAnalyzeSpan(location.SourceSpan, location.SourceTree); 74=> location.SourceTree != null && context.ShouldAnalyzeSpan(location.SourceSpan, location.SourceTree);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\LocationExtensions.cs (7)
19=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindToken(location.SourceSpan.Start); 22=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan); 25=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan, getInnermostNodeForTie: getInnermostNodeForTie); 28=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan, findInsideTrivia, getInnermostNodeForTie); 38return !(tree == null || tree.IsHiddenPosition(loc.SourceSpan.Start)); 44return loc1.SourceTree == loc2.SourceTree && loc1.SourceSpan.IntersectsWith(loc2.SourceSpan);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
55var node = root.FindNode(location.SourceSpan, getInnermostNodeForTie: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (2)
263WriteInteger(location.SourceSpan.Start); 264WriteInteger(location.SourceSpan.Length);
Microsoft.Analyzers.Extra.Tests (6)
Resources\RoslynTestUtils.cs (6)
144Assert.True(expectedSpan.Equals(actual.Location.SourceSpan), 145$"Span {spanNum} doesn't match: expected {expectedSpan} but got {actual.Location.SourceSpan}"); 269if (x.Location.SourceSpan.Start < y.Location.SourceSpan.Start) 273else if (x.Location.SourceSpan.Start > y.Location.SourceSpan.Start)
Microsoft.Analyzers.Local.Tests (8)
InternalReferencedInPublicDocAnalyzerTests.cs (2)
471var text = source.Substring(location.SourceSpan.Start, location.SourceSpan.Length);
Resources\RoslynTestUtils.cs (6)
144Assert.True(expectedSpan.Equals(actual.Location.SourceSpan), 145$"Span {spanNum} doesn't match: expected {expectedSpan} but got {actual.Location.SourceSpan}"); 270if (x.Location.SourceSpan.Start < y.Location.SourceSpan.Start) 274else if (x.Location.SourceSpan.Start > y.Location.SourceSpan.Start)
Microsoft.AspNetCore.Analyzer.Testing (2)
DiagnosticAnalyzerRunner.cs (1)
113return diagnostics.OrderBy(d => d.Location.SourceSpan.Start).ToArray();
DiagnosticVerifier.cs (1)
131return diagnostics.OrderBy(d => d.Location.SourceSpan.Start).ToArray();
Microsoft.AspNetCore.App.Analyzers (6)
RouteEmbeddedLanguage\FrameworkParametersCompletionProvider.cs (2)
515? parentOpt.Value.GetLocation().SourceSpan.Start 518? parentOpt.Value.GetLocation().SourceSpan.End
WebApplicationBuilder\WebApplicationBuilderAnalyzer.cs (4)
294var fullSyntaxLength = location.SourceSpan.Length; 295var chainAndTriviaLength = methodLocation.SourceSpan.Start - location.SourceSpan.Start; 298methodLocation.SourceSpan.Start,
Microsoft.AspNetCore.App.CodeFixes (15)
Authorization\AddAuthorizationBuilderFixer.cs (2)
59var diagnosticTarget = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true); 136var diagnosticTarget = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
Dependencies\AddPackageFixer.cs (2)
49var location = diagnostic.Location.SourceSpan; 83var position = diagnostic.Location.SourceSpan.Start;
DetectMismatchedParameterOptionalityFixer.cs (1)
45var param = root.FindNode(diagnostic.Location.SourceSpan);
Http\HeaderDictionaryAddFixer.cs (4)
70var diagnosticTarget = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true); 87var diagnosticTarget = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true); 101var diagnosticTarget = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true); 115var diagnosticTarget = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
Http\HeaderDictionaryIndexerFixer.cs (1)
51var param = root.FindNode(diagnostic.Location.SourceSpan);
Kestrel\ListenOnIPv6AnyFixer.cs (1)
40var argumentSyntax = root.FindNode(diagnostic.Location.SourceSpan).FirstAncestorOrSelf<ArgumentSyntax>();
PublicPartialProgramClassFixer.cs (1)
38var classDeclaration = root.FindNode(diagnostic.Location.SourceSpan)
RouteParameterUnusedParameterFixer.cs (1)
60var param = root.FindNode(diagnostic.Location.SourceSpan);
WebApplicationBuilderFixer.cs (2)
79var diagnosticTarget = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true); 94var diagnosticTarget = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
Microsoft.AspNetCore.Components.Analyzers (1)
ComponentParametersShouldBePublicCodeFixProvider.cs (1)
35var diagnosticSpan = diagnostic.Location.SourceSpan;
Microsoft.AspNetCore.Components.Analyzers.Tests (3)
Helpers\CodeFixVerifier.Helper.cs (2)
43var oldArray = diagnostics.OrderBy(d => d.Location.SourceSpan.Start).ToArray(); 44var newArray = newDiagnostics.OrderBy(d => d.Location.SourceSpan.Start).ToArray();
Helpers\DiagnosticVerifier.Helper.cs (1)
97return diagnostics.OrderBy(d => d.Location.SourceSpan.Start).ToArray();
Microsoft.AspNetCore.Components.SdkAnalyzers (1)
ComponentParametersShouldBePublicCodeFixProvider.cs (1)
35var diagnosticSpan = diagnostic.Location.SourceSpan;
Microsoft.AspNetCore.Components.SdkAnalyzers.Tests (3)
Helpers\CodeFixVerifier.Helper.cs (2)
43var oldArray = diagnostics.OrderBy(d => d.Location.SourceSpan.Start).ToArray(); 44var newArray = newDiagnostics.OrderBy(d => d.Location.SourceSpan.Start).ToArray();
Helpers\DiagnosticVerifier.Helper.cs (1)
97return diagnostics.OrderBy(d => d.Location.SourceSpan.Start).ToArray();
Microsoft.AspNetCore.Http.RequestDelegateGenerator (1)
RequestDelegateGeneratorSuppressor.cs (1)
56var node = sourceTree.GetRoot().FindNode(location.SourceSpan) switch
Microsoft.AspNetCore.Mvc.Api.Analyzers (1)
AddResponseTypeAttributeCodeFixAction.cs (1)
131var diagnosticNode = root.FindNode(_diagnostic.Location.SourceSpan);
Microsoft.CodeAnalysis (10)
Diagnostic\Diagnostic.cs (1)
524return !filterSpan.HasValue || filterSpan.GetValueOrDefault().IntersectsWith(location.SourceSpan);
Diagnostic\Location.cs (1)
100result += "(" + this.SourceTree?.FilePath + this.SourceSpan + ")";
DiagnosticAnalyzer\AnalysisScope.cs (1)
316return ShouldInclude(diagnostic.Location.SourceSpan);
DiagnosticAnalyzer\AnalyzerDriver.cs (2)
1253if (IsGeneratedOrHiddenCodeLocation(location.SourceTree, location.SourceSpan, cancellationToken)) 1265for (var node = location.SourceTree.GetRoot(cancellationToken).FindNode(location.SourceSpan, getInnermostNodeForTie: true);
DiagnosticAnalyzer\AnalyzerExecutor.AnalyzerDiagnosticReporter.cs (1)
113(!FilterSpanForLocalDiagnostics.HasValue || FilterSpanForLocalDiagnostics.Value.IntersectsWith(diagnostic.Location.SourceSpan)))
DiagnosticAnalyzer\AnalyzerExecutor.cs (1)
1457if (diagnostic.Location.SourceSpan.IntersectsWith(syntax.FullSpan))
DiagnosticAnalyzer\DiagnosticAnalysisContextHelpers.cs (2)
102if (location.SourceSpan.End > location.SourceTree.Length) 105throw new ArgumentException(string.Format(CodeAnalysisResources.InvalidDiagnosticSpanReported, id, location.SourceSpan, location.SourceTree.FilePath), "diagnostic");
DiagnosticAnalyzer\SuppressMessageAttributeState.cs (1)
166for (var node = location.SourceTree.GetRoot().FindNode(location.SourceSpan, getInnermostNodeForTie: true);
Microsoft.CodeAnalysis.Analyzers (29)
MetaAnalyzers\DiagnosticDescriptorCreationAnalyzer.cs (1)
682var span = fixLocation.SourceSpan;
MetaAnalyzers\Fixers\CompareSymbolsCorrectlyFix.cs (2)
46cancellationToken => ConvertToEqualsAsync(context.Document, diagnostic.Location.SourceSpan, cancellationToken), 54cancellationToken => CallOverloadWithEqualityComparerAsync(context.Document, diagnostic.Location.SourceSpan, cancellationToken),
MetaAnalyzers\Fixers\ConfigureGeneratedCodeAnalysisFix.cs (1)
35cancellationToken => ConfigureGeneratedCodeAnalysisAsync(context.Document, diagnostic.Location.SourceSpan, cancellationToken),
MetaAnalyzers\Fixers\DefineDiagnosticDescriptorArgumentsCorrectlyFix.cs (1)
123root.FindNode(locationToFix.SourceSpan, getInnermostNodeForTie: true) is { } fixNode &&
MetaAnalyzers\Fixers\EnableConcurrentExecutionFix.cs (1)
34cancellationToken => EnableConcurrentExecutionAsync(context.Document, diagnostic.Location.SourceSpan, cancellationToken),
MetaAnalyzers\Fixers\PreferIsKindFix.cs (2)
29cancellationToken => ConvertKindToIsKindAsync(context.Document, diagnostic.Location.SourceSpan, cancellationToken), 68var nodeToFix = _fixer.TryGetNodeToFix(editor.OriginalRoot, diagnostic.Location.SourceSpan);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\AnalysisContextExtensions.cs (2)
54=> location.SourceTree != null && context.ShouldAnalyzeSpan(location.SourceSpan, location.SourceTree); 74=> location.SourceTree != null && context.ShouldAnalyzeSpan(location.SourceSpan, location.SourceTree);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\LocationExtensions.cs (7)
19=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindToken(location.SourceSpan.Start); 22=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan); 25=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan, getInnermostNodeForTie: getInnermostNodeForTie); 28=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan, findInsideTrivia, getInnermostNodeForTie); 38return !(tree == null || tree.IsHiddenPosition(loc.SourceSpan.Start)); 44return loc1.SourceTree == loc2.SourceTree && loc1.SourceSpan.IntersectsWith(loc2.SourceSpan);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
55var node = root.FindNode(location.SourceSpan, getInnermostNodeForTie: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (2)
263WriteInteger(location.SourceSpan.Start); 264WriteInteger(location.SourceSpan.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\ForkingSyntaxEditorBasedCodeFixProvider.cs (1)
67diagnostic.AdditionalLocations[0].SourceSpan, getInnermostNodeForTie: true);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\SyntaxEditorBasedCodeFixProvider.cs (2)
43.Sort((d1, d2) => d1.Location.SourceSpan.Start - d2.Location.SourceSpan.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (2)
205var afterMember = declarationList.LastOrDefault(m => m.SpanStart <= info.Context.AfterThisLocation.SourceSpan.Start); 221var beforeMember = declarationList.FirstOrDefault(m => m.Span.End >= info.Context.BeforeThisLocation.SourceSpan.End);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\FindSymbols\LinkedFileReferenceLocationEqualityComparer.cs (3)
25return x.Location.SourceSpan == y.Location.SourceSpan; 29=> obj.Location.SourceSpan.GetHashCode();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.State.cs (1)
107let token = syntaxRoot.FindToken(r.Location.SourceSpan.Start)
Microsoft.CodeAnalysis.AnalyzerUtilities (12)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\AnalysisContextExtensions.cs (2)
54=> location.SourceTree != null && context.ShouldAnalyzeSpan(location.SourceSpan, location.SourceTree); 74=> location.SourceTree != null && context.ShouldAnalyzeSpan(location.SourceSpan, location.SourceTree);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\LocationExtensions.cs (7)
19=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindToken(location.SourceSpan.Start); 22=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan); 25=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan, getInnermostNodeForTie: getInnermostNodeForTie); 28=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan, findInsideTrivia, getInnermostNodeForTie); 38return !(tree == null || tree.IsHiddenPosition(loc.SourceSpan.Start)); 44return loc1.SourceTree == loc2.SourceTree && loc1.SourceSpan.IntersectsWith(loc2.SourceSpan);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
55var node = root.FindNode(location.SourceSpan, getInnermostNodeForTie: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (2)
263WriteInteger(location.SourceSpan.Start); 264WriteInteger(location.SourceSpan.Length);
Microsoft.CodeAnalysis.BannedApiAnalyzers (21)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\AnalysisContextExtensions.cs (2)
54=> location.SourceTree != null && context.ShouldAnalyzeSpan(location.SourceSpan, location.SourceTree); 74=> location.SourceTree != null && context.ShouldAnalyzeSpan(location.SourceSpan, location.SourceTree);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\LocationExtensions.cs (7)
19=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindToken(location.SourceSpan.Start); 22=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan); 25=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan, getInnermostNodeForTie: getInnermostNodeForTie); 28=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan, findInsideTrivia, getInnermostNodeForTie); 38return !(tree == null || tree.IsHiddenPosition(loc.SourceSpan.Start)); 44return loc1.SourceTree == loc2.SourceTree && loc1.SourceSpan.IntersectsWith(loc2.SourceSpan);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
55var node = root.FindNode(location.SourceSpan, getInnermostNodeForTie: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (2)
263WriteInteger(location.SourceSpan.Start); 264WriteInteger(location.SourceSpan.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\ForkingSyntaxEditorBasedCodeFixProvider.cs (1)
67diagnostic.AdditionalLocations[0].SourceSpan, getInnermostNodeForTie: true);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\SyntaxEditorBasedCodeFixProvider.cs (2)
43.Sort((d1, d2) => d1.Location.SourceSpan.Start - d2.Location.SourceSpan.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (2)
205var afterMember = declarationList.LastOrDefault(m => m.SpanStart <= info.Context.AfterThisLocation.SourceSpan.Start); 221var beforeMember = declarationList.FirstOrDefault(m => m.Span.End >= info.Context.BeforeThisLocation.SourceSpan.End);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\FindSymbols\LinkedFileReferenceLocationEqualityComparer.cs (3)
25return x.Location.SourceSpan == y.Location.SourceSpan; 29=> obj.Location.SourceSpan.GetHashCode();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.State.cs (1)
107let token = syntaxRoot.FindToken(r.Location.SourceSpan.Start)
Microsoft.CodeAnalysis.CodeStyle (19)
src\Analyzers\Core\Analyzers\FileHeaders\AbstractFileHeaderDiagnosticAnalyzer.cs (1)
64if (!context.ShouldAnalyzeSpan(fileHeader.GetLocation(tree).SourceSpan))
src\Analyzers\Core\Analyzers\RemoveUnnecessaryParentheses\AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer.cs (3)
132var expressionFirstLine = lines.GetLineFromPosition(parenthesizedExpressionLocation.SourceSpan.Start); 134var textSpanEndPosition = Math.Min(parenthesizedExpressionLocation.SourceSpan.End, expressionFirstLine.Span.End); 135return Location.Create(parenthesizedExpression.SyntaxTree, TextSpan.FromBounds(parenthesizedExpressionLocation.SourceSpan.Start, textSpanEndPosition));
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (1)
565if (pragma.Span.End <= diagnostic.Location.SourceSpan.Start)
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (1)
607r => r.SyntaxTree == diagnosticLocation.SourceTree && r.Span.Contains(diagnosticLocation.SourceSpan));
src\Analyzers\Core\Analyzers\UseSystemHashCode\UseSystemHashCodeDiagnosticAnalyzer.cs (1)
47if (!context.ShouldAnalyzeSpan(diagnosticLocation.SourceSpan))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\AnalysisContextExtensions.cs (2)
54=> location.SourceTree != null && context.ShouldAnalyzeSpan(location.SourceSpan, location.SourceTree); 74=> location.SourceTree != null && context.ShouldAnalyzeSpan(location.SourceSpan, location.SourceTree);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\LocationExtensions.cs (7)
19=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindToken(location.SourceSpan.Start); 22=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan); 25=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan, getInnermostNodeForTie: getInnermostNodeForTie); 28=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan, findInsideTrivia, getInnermostNodeForTie); 38return !(tree == null || tree.IsHiddenPosition(loc.SourceSpan.Start)); 44return loc1.SourceTree == loc2.SourceTree && loc1.SourceSpan.IntersectsWith(loc2.SourceSpan);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
55var node = root.FindNode(location.SourceSpan, getInnermostNodeForTie: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (2)
263WriteInteger(location.SourceSpan.Start); 264WriteInteger(location.SourceSpan.Length);
Microsoft.CodeAnalysis.CodeStyle.Fixes (49)
src\Analyzers\Core\CodeFixes\AddAnonymousTypeMemberName\AbstractAddAnonymousTypeMemberNameCodeFixProvider.cs (1)
55var span = diagnostic.Location.SourceSpan;
src\Analyzers\Core\CodeFixes\AddExplicitCast\AbstractAddExplicitCastCodeFixProvider.cs (2)
76var spanNode = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true) 221d => root.FindNode(d.Location.SourceSpan, getInnermostNodeForTie: true)
src\Analyzers\Core\CodeFixes\AddParameter\AbstractAddParameterCodeFixProvider.cs (1)
70var initialNode = root.FindNode(diagnostic.Location.SourceSpan);
src\Analyzers\Core\CodeFixes\AddParameter\AddParameterService.cs (1)
118var methodNode = syntaxRoot.FindNode(currentMethodToUpdate.Locations[0].SourceSpan, getInnermostNodeForTie: true);
src\Analyzers\Core\CodeFixes\ConflictMarkerResolution\AbstractConflictMarkerCodeFixProvider.cs (3)
403(d1, d2) => d1.Location.SourceSpan.Start - d2.Location.SourceSpan.Start).ToImmutableArray(); 416var position = diagnostic.Location.SourceSpan.Start;
src\Analyzers\Core\CodeFixes\ConvertTypeOfToNameOf\AbstractConvertTypeOfToNameOfCodeFixProvider.cs (1)
41if (editor.OriginalRoot.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true) is not TMemberAccessExpressionSyntax node)
src\Analyzers\Core\CodeFixes\ForEachCast\AbstractForEachCastCodeFixProvider.cs (1)
48var node = editor.OriginalRoot.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
src\Analyzers\Core\CodeFixes\Formatting\FormattingCodeFixProvider.cs (1)
76var diagnosticSpan = diagnostic.Location.SourceSpan;
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorCodeFixProvider.cs (1)
30if (!headerFacts.IsOnTypeHeader(root, diagnostic.Location.SourceSpan.Start, fullHeader: true, out var typeDecl))
src\Analyzers\Core\CodeFixes\MakeFieldReadonly\AbstractMakeFieldReadonlyCodeFixProvider.cs (1)
47var diagnosticSpan = diagnostic.Location.SourceSpan;
src\Analyzers\Core\CodeFixes\MakeTypePartial\AbstractMakeTypePartialCodeFixProvider.cs (1)
36var declaration = syntaxRoot.FindNode(diagnostic.Location.SourceSpan);
src\Analyzers\Core\CodeFixes\NewLines\MultipleBlankLines\AbstractMultipleBlankLinesCodeFixProvider.cs (1)
53var token = root.FindToken(diagnostic.AdditionalLocations[0].SourceSpan.Start);
src\Analyzers\Core\CodeFixes\RemoveAsyncModifier\AbstractRemoveAsyncModifierCodeFixProvider.cs (1)
75foreach (var diagnostic in diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start))
src\Analyzers\Core\CodeFixes\RemoveUnnecessarySuppressions\RemoveUnnecessaryAttributeSuppressionsCodeFixProvider.cs (2)
32if (root.FindNode(diagnostic.Location.SourceSpan) != null) 43var node = editor.OriginalRoot.FindNode(diagnostic.Location.SourceSpan);
src\Analyzers\Core\CodeFixes\RemoveUnnecessarySuppressions\RemoveUnnecessaryPragmaSuppressionsCodeFixProvider.cs (4)
37if (root.FindNode(diagnostic.Location.SourceSpan) is { } node && syntaxFacts.IsAttribute(node) || 38root.FindTrivia(diagnostic.Location.SourceSpan.Start).HasStructure) 74if (editor.OriginalRoot.FindNode(location.SourceSpan) is { } attribute && 83node = editor.OriginalRoot.FindTrivia(location.SourceSpan.Start).GetStructure()!;
src\Analyzers\Core\CodeFixes\RemoveUnusedParametersAndValues\AbstractRemoveUnusedValuesCodeFixProvider.cs (5)
269return diagnostics.GroupBy(d => syntaxFacts.GetContainingMemberDeclaration(root, d.Location.SourceSpan.Start) ?? root); 362diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start), 372diagnostics.OrderBy(d => d.Location.SourceSpan.Start), 401var expressionStatement = root.FindNode(diagnostic.Location.SourceSpan).FirstAncestorOrSelf<TExpressionStatementSyntax>(); 677var node = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
src\Analyzers\Core\CodeFixes\SimplifyBooleanExpression\SimplifyConditionalCodeFixProvider.cs (1)
51diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start).ToImmutableArray(),
src\Analyzers\Core\CodeFixes\SimplifyLinqExpression\SimplifyLinqExpressionCodeFixProvider.cs (2)
42foreach (var diagnostic in diagnostics.OrderByDescending(diagnostics => diagnostics.Location.SourceSpan.Start)) 44var invocation = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
src\Analyzers\Core\CodeFixes\UpdateLegacySuppressions\UpdateLegacySuppressionsCodeFixProvider.cs (2)
33root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true) != null) 44var node = editor.OriginalRoot.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
src\Analyzers\Core\CodeFixes\UseCoalesceExpression\UseCoalesceExpressionForNullableTernaryConditionalCheckCodeFixProvider.cs (3)
50var conditionalExpression = root.FindNode(diagnostic.AdditionalLocations[0].SourceSpan, getInnermostNodeForTie: true); 51var conditionExpression = root.FindNode(diagnostic.AdditionalLocations[1].SourceSpan); 52var whenPart = root.FindNode(diagnostic.AdditionalLocations[2].SourceSpan);
src\Analyzers\Core\CodeFixes\UseCoalesceExpression\UseCoalesceExpressionForTernaryConditionalCheckCodeFixProvider.cs (3)
62var conditionalExpression = root.FindNode(diagnostic.AdditionalLocations[0].SourceSpan, getInnermostNodeForTie: true); 63var conditionalPartHigh = root.FindNode(diagnostic.AdditionalLocations[1].SourceSpan); 64var whenPart = root.FindNode(diagnostic.AdditionalLocations[2].SourceSpan);
src\Analyzers\Core\CodeFixes\UseInferredMemberName\AbstractUseInferredMemberNameCodeFixProvider.cs (1)
35var node = root.FindNode(diagnostic.Location.SourceSpan);
src\Analyzers\Core\CodeFixes\UseIsNullCheck\AbstractUseIsNullForReferenceEqualsCodeFixProvider.cs (1)
58foreach (var diagnostic in diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\ForkingSyntaxEditorBasedCodeFixProvider.cs (1)
67diagnostic.AdditionalLocations[0].SourceSpan, getInnermostNodeForTie: true);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\SyntaxEditorBasedCodeFixProvider.cs (2)
43.Sort((d1, d2) => d1.Location.SourceSpan.Start - d2.Location.SourceSpan.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (2)
205var afterMember = declarationList.LastOrDefault(m => m.SpanStart <= info.Context.AfterThisLocation.SourceSpan.Start); 221var beforeMember = declarationList.FirstOrDefault(m => m.Span.End >= info.Context.BeforeThisLocation.SourceSpan.End);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\FindSymbols\LinkedFileReferenceLocationEqualityComparer.cs (3)
25return x.Location.SourceSpan == y.Location.SourceSpan; 29=> obj.Location.SourceSpan.GetHashCode();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.State.cs (1)
107let token = syntaxRoot.FindToken(r.Location.SourceSpan.Start)
Microsoft.CodeAnalysis.CSharp (36)
Binder\Binder_Symbols.cs (2)
1944if (containerResult == 0 && la.SourceTree == lb.SourceTree) return lb.SourceSpan.Start - la.SourceSpan.Start;
Binder\BinderFactory.BinderFactoryVisitor.cs (1)
634return (location.SourceTree == syntaxTree) && span.Contains(location.SourceSpan);
Binder\LocalScopeBinder.cs (2)
513if (declaredInThisScope && newLocation.SourceSpan.Start >= local.GetFirstLocation().SourceSpan.Start)
Compilation\CSharpCompilation.cs (2)
4600return loc1.SourceSpan.Start - loc2.SourceSpan.Start;
Compilation\CSharpDiagnosticFilter.cs (1)
155var position = location.SourceSpan.Start;
Compilation\CSharpSemanticModel.cs (1)
3247if (location.SourceTree == this.SyntaxTree && parameter.Span.Contains(location.SourceSpan))
Compilation\SyntaxTreeSemanticModel.cs (6)
1837if (loc.IsInSource && loc.SourceTree == this.SyntaxTree && declarationSpan.Contains(loc.SourceSpan)) 1960if (alias.Alias.GetFirstLocation().SourceSpan == declarationSyntax.Alias.Name.Span) 1993if (alias.Alias.GetFirstLocation().SourceSpan == declarationSyntax.Identifier.Span) 2052if (location.SourceTree == this.SyntaxTree && parameter.Span.Contains(location.SourceSpan)) 2236if (location.SourceTree == this.SyntaxTree && parameter.Span.Contains(location.SourceSpan)) 2456var position = CheckAndAdjustPosition(location.SourceSpan.Start);
FlowAnalysis\ControlFlowPass.cs (3)
341var sourceStart = sourceLocation.SourceSpan.Start; 342var targetStart = node.Label.GetFirstLocation().SourceSpan.Start; 346var usingStart = usingDecl.symbol.GetFirstLocation().SourceSpan.Start;
FlowAnalysis\DataFlowsInWalker.cs (1)
95if (IsInside && !RegionContains(node.RangeVariableSymbol.GetFirstLocation().SourceSpan))
FlowAnalysis\DataFlowsOutWalker.cs (1)
233((param.RefKind != RefKind.None && !param.IsImplicitlyDeclared && !RegionContains(param.GetFirstLocation().SourceSpan)) ||
FlowAnalysis\DefiniteAssignment.cs (1)
1218(symbol.TryGetFirstLocation() is var location && (location is null || node.Span.End < location.SourceSpan.Start)))
Symbols\LexicalSortKey.cs (1)
75: this(location.SourceTree, location.SourceSpan.Start, compilation)
Symbols\RangeVariableSymbol.cs (1)
62SyntaxToken token = _location.SourceTree.GetRoot().FindToken(_location.SourceSpan.Start);
Symbols\Source\SourceMemberContainerSymbol_ImplementationChecks.cs (2)
1783if (GetImplementsLocationOrFallback(interface1).SourceSpan.Start > GetImplementsLocationOrFallback(interface2).SourceSpan.Start)
Symbols\Symbol.cs (9)
453if (loc.IsInSource && loc.SourceTree == tree && declarationSpan.Contains(loc.SourceSpan)) 455wasZeroWidthMatch = loc.SourceSpan.IsEmpty && loc.SourceSpan.End == declarationSpan.Start; 510if (location.SourceSpan.Length != 0) 512SyntaxToken token = location.SourceTree.GetRoot().FindToken(location.SourceSpan.Start); 530foreach (var descendant in parent.DescendantNodesAndSelf(c => c.Location.SourceSpan.Contains(location.SourceSpan))) 532if (descendant is TNode && descendant.Location.SourceSpan.Contains(location.SourceSpan))
Symbols\Symbol_Attributes.cs (2)
498argumentLocation.SourceSpan.Contains(location.SourceSpan))
Microsoft.CodeAnalysis.CSharp.CodeStyle (5)
src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (1)
142if (location == null || additionalLocation == null || !context.ShouldAnalyzeSpan(location.SourceSpan))
src\Analyzers\CSharp\Analyzers\RemoveUnreachableCode\CSharpRemoveUnreachableCodeDiagnosticAnalyzer.cs (1)
66ProcessUnreachableDiagnostic(context, root, diagnostic.Location.SourceSpan);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Helpers\RemoveUnnecessaryImports\CSharpUnnecessaryImportsProvider.cs (1)
36root.FindNode(diagnostic.Location.SourceSpan) is UsingDirectiveSyntax node && predicate(node))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SemanticFacts\CSharpSemanticFacts.cs (2)
72if (symbol.Locations.Any(static (loc, location) => loc.SourceTree == location.SourceTree && loc.SourceSpan.Contains(location.SourceSpan), location))
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (40)
src\Analyzers\CSharp\CodeFixes\AddBraces\CSharpAddBracesCodeFixProvider.cs (1)
38var statement = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
src\Analyzers\CSharp\CodeFixes\AddInheritdoc\AddInheritdocCodeFixProvider.cs (2)
45var node = root.FindNode(diagnostic.Location.SourceSpan); 75var node = editor.OriginalRoot.FindNode(diagnostic.Location.SourceSpan);
src\Analyzers\CSharp\CodeFixes\AssignOutParameters\AbstractAssignOutParametersCodeFixProvider.cs (1)
101diagnostics.SelectAsArray(d => GetContainer(root, d.Location.SourceSpan))
src\Analyzers\CSharp\CodeFixes\ConditionalExpressionInStringInterpolation\CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProvider.cs (1)
37var diagnosticSpan = diagnostic.Location.SourceSpan;
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.cs (2)
59if (spans.Any((s, nodeSpan) => s.Contains(nodeSpan), switchLocation.SourceSpan)) 65spans.Add(switchLocation.SourceSpan);
src\Analyzers\CSharp\CodeFixes\DisambiguateSameVariable\CSharpDisambiguateSameVariableCodeFixProvider.cs (1)
60var span = diagnostic.Location.SourceSpan;
src\Analyzers\CSharp\CodeFixes\HideBase\HideBaseCodeFixProvider.cs (1)
34var diagnosticSpan = diagnostic.Location.SourceSpan;
src\Analyzers\CSharp\CodeFixes\MakeLocalFunctionStatic\MakeLocalFunctionStaticCodeFixHelper.cs (2)
64var referenceNode = root.FindNode(location.Location.SourceSpan); 130var referenceSpan = location.Location.SourceSpan;
src\Analyzers\CSharp\CodeFixes\MakeLocalFunctionStatic\PassInCapturedVariablesAsArgumentsCodeFixProvider.cs (1)
77.Select(d => root.FindNode(d.Location.SourceSpan).AncestorsAndSelf().OfType<LocalFunctionStatementSyntax>().FirstOrDefault())
src\Analyzers\CSharp\CodeFixes\MakeMemberRequired\CSharpMakeMemberRequiredCodeFixProvider.cs (1)
114var memberDeclarator = root.FindNode(diagnostic.Location.SourceSpan);
src\Analyzers\CSharp\CodeFixes\MakeMethodAsynchronous\CSharpMakeMethodAsynchronousCodeFixProvider.cs (1)
49var token = root.FindToken(diagnostic.Location.SourceSpan.Start);
src\Analyzers\CSharp\CodeFixes\MakeStatementAsynchronous\CSharpMakeStatementAsynchronousCodeFixProvider.cs (1)
36var node = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
src\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (1)
52var arrowToken = root.FindToken(diagnostic.Location.SourceSpan.Start);
src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (1)
52var questionToken = root.FindToken(diagnostic.Location.SourceSpan.Start);
src\Analyzers\CSharp\CodeFixes\NewLines\ConsecutiveBracePlacement\ConsecutiveBracePlacementCodeFixProvider.cs (1)
68var token = root.FindToken(diagnostic.Location.SourceSpan.Start);
src\Analyzers\CSharp\CodeFixes\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementCodeFixProvider.cs (1)
70var node = root.FindNode(diagnostic.AdditionalLocations[0].SourceSpan);
src\Analyzers\CSharp\CodeFixes\RemoveInKeyword\RemoveInKeywordCodeFixProvider.cs (1)
38var diagnosticSpan = diagnostic.Location.SourceSpan;
src\Analyzers\CSharp\CodeFixes\RemoveNewModifier\RemoveNewModifierCodeFixProvider.cs (1)
36var diagnosticSpan = diagnostic.Location.SourceSpan;
src\Analyzers\CSharp\CodeFixes\RemoveUnusedLocalFunction\CSharpRemoveUnusedLocalFunctionCodeFixProvider.cs (3)
50var localFunctions = diagnostics.OrderBy(static (d1, d2) => d2.Location.SourceSpan.Start - d1.Location.SourceSpan.Start) 51.Select(d => root.FindToken(d.Location.SourceSpan.Start))
src\Analyzers\CSharp\CodeFixes\UseDefaultLiteral\CSharpUseDefaultLiteralCodeFixProvider.cs (1)
53d => (DefaultExpressionSyntax)originalRoot.FindNode(d.Location.SourceSpan, getInnermostNodeForTie: true));
src\Analyzers\CSharp\CodeFixes\UseExplicitArrayInExpressionTree\CSharpUseExplicitArrayInExpressionTreeCodeFixProvider.cs (1)
122foreach (var diagnostic in diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start))
src\Analyzers\CSharp\CodeFixes\UseImplicitlyTypedLambdaExpression\CSharpUseImplicitObjectCreationCodeFixProvider.cs (1)
45.OrderBy(d => d.Location.SourceSpan.End)
src\Analyzers\CSharp\CodeFixes\UseImplicitObjectCreation\CSharpUseImplicitObjectCreationCodeFixProvider.cs (1)
52.OrderBy(d => d.Location.SourceSpan.End)
src\Analyzers\CSharp\CodeFixes\UseImplicitOrExplicitType\UseExplicitTypeCodeFixProvider.cs (1)
49var node = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
src\Analyzers\CSharp\CodeFixes\UseImplicitOrExplicitType\UseImplicitTypeCodeFixProvider.cs (1)
40var typeSyntax = (TypeSyntax)root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
src\Analyzers\CSharp\CodeFixes\UseIndexOrRangeOperator\CSharpUseIndexOperatorCodeFixProvider.cs (1)
40foreach (var diagnostic in diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start))
src\Analyzers\CSharp\CodeFixes\UsePatternCombinators\CSharpUsePatternCombinatorsCodeFixProvider.cs (1)
80var expression = editor.OriginalRoot.FindNode(location.SourceSpan, getInnermostNodeForTie: true);
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndMemberAccessCodeFixProvider.cs (1)
43foreach (var diagnostic in diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start))
src\Analyzers\CSharp\CodeFixes\UseThrowExpression\UseThrowExpressionCodeFixProvider.cs (4)
48var ifStatement = root.FindNode(diagnostic.AdditionalLocations[0].SourceSpan); 49var throwStatementExpression = root.FindNode(diagnostic.AdditionalLocations[1].SourceSpan); 50var assignmentValue = root.FindNode(diagnostic.AdditionalLocations[2].SourceSpan); 51var assignmentExpressionStatement = root.FindNode(diagnostic.AdditionalLocations[3].SourceSpan);
src\Analyzers\CSharp\CodeFixes\UseUtf8StringLiteral\UseUtf8StringLiteralCodeFixProvider.cs (2)
120.Where(a => a.Initializer?.ElementValues.FirstOrDefault()?.Syntax.SpanStart == diagnostic.Location.SourceSpan.Start) 168if (argument.Span.Start == location.SourceSpan.Start)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationHelpers.cs (1)
206return contextTree?.GetRoot(cancellationToken).FindToken(contextLocation!.SourceSpan.Start).Parent;
Microsoft.CodeAnalysis.CSharp.CodeStyle.UnitTests (4)
src\Analyzers\CSharp\Tests\RemoveUnnecessaryParentheses\RemoveUnnecessaryExpressionParenthesesTests.cs (3)
2634Assert.Equal(expectedSpans["expression"].Single(), diagnostic.AdditionalLocations[0].SourceSpan); 2635Assert.Equal(expectedSpans["fade"][0], diagnostic.AdditionalLocations[1].SourceSpan); 2636Assert.Equal(expectedSpans["fade"][1], diagnostic.AdditionalLocations[2].SourceSpan);
src\Analyzers\CSharp\Tests\RemoveUnusedParametersAndValues\RemoveUnusedParametersTests.cs (1)
1133var sortedDiagnostics = diagnostics.OrderBy(d => d.Location.SourceSpan.Start).ToArray();
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (4)
Formatting\CodeCleanupTests.TestFixers.cs (3)
36var node = (await sourceTree.GetRootAsync(cancellationToken)).FindNode(diagnostic.Location.SourceSpan); 105var node = (await sourceTree.GetRootAsync(cancellationToken)).FindNode(diagnostic.Location.SourceSpan); 161var node = (await sourceTree.GetRootAsync(cancellationToken)).FindNode(diagnostic.Location.SourceSpan);
PdbSourceDocument\AbstractPdbSourceDocumentTests.cs (1)
177var actualSpan = file!.IdentifierLocation.SourceSpan;
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (4)
Semantics\PatternMatchingTests2.cs (2)
2024var gotModel = model.TryGetSpeculativeSemanticModel(returnStatement.Location.SourceSpan.Start, modifiedReturnStatement, out var speculativeModel); 2065var gotModel = model.TryGetSpeculativeSemanticModel(returnStatement.Location.SourceSpan.Start, modifiedReturnStatement, out var speculativeModel);
Semantics\RecordTests.cs (2)
566Assert.Equal(0, ctor.Parameters[1].Locations.Single().SourceSpan.Length); 594Assert.Equal(3, ctor.Parameters[1].Locations.Single().SourceSpan.Length);
Microsoft.CodeAnalysis.CSharp.Features (48)
ConvertProgram\ConvertToProgramMainCodeRefactoringProvider.cs (1)
47if (!acceptableLocation.SourceSpan.IntersectsWith(position))
Copilot\CSharpCopilotCodeFixProvider.cs (1)
79var containingMethod = CSharpSyntaxFacts.Instance.GetContainingMethodDeclaration(root, diagnostic.Location.SourceSpan.Start, useFullSpan: false);
Debugging\BreakpointResolver.cs (1)
37var token = tree.GetRoot(cancellationToken).FindToken(location.SourceSpan.Start);
GoToDefinition\CSharpGoToDefinitionSymbolService.cs (1)
69return symbol.Locations.FirstOrDefault()?.SourceSpan.Start ?? 0;
src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (1)
142if (location == null || additionalLocation == null || !context.ShouldAnalyzeSpan(location.SourceSpan))
src\Analyzers\CSharp\Analyzers\RemoveUnreachableCode\CSharpRemoveUnreachableCodeDiagnosticAnalyzer.cs (1)
66ProcessUnreachableDiagnostic(context, root, diagnostic.Location.SourceSpan);
src\Analyzers\CSharp\CodeFixes\AddBraces\CSharpAddBracesCodeFixProvider.cs (1)
38var statement = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
src\Analyzers\CSharp\CodeFixes\AddInheritdoc\AddInheritdocCodeFixProvider.cs (2)
45var node = root.FindNode(diagnostic.Location.SourceSpan); 75var node = editor.OriginalRoot.FindNode(diagnostic.Location.SourceSpan);
src\Analyzers\CSharp\CodeFixes\AssignOutParameters\AbstractAssignOutParametersCodeFixProvider.cs (1)
101diagnostics.SelectAsArray(d => GetContainer(root, d.Location.SourceSpan))
src\Analyzers\CSharp\CodeFixes\ConditionalExpressionInStringInterpolation\CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProvider.cs (1)
37var diagnosticSpan = diagnostic.Location.SourceSpan;
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.cs (2)
59if (spans.Any((s, nodeSpan) => s.Contains(nodeSpan), switchLocation.SourceSpan)) 65spans.Add(switchLocation.SourceSpan);
src\Analyzers\CSharp\CodeFixes\DisambiguateSameVariable\CSharpDisambiguateSameVariableCodeFixProvider.cs (1)
60var span = diagnostic.Location.SourceSpan;
src\Analyzers\CSharp\CodeFixes\HideBase\HideBaseCodeFixProvider.cs (1)
34var diagnosticSpan = diagnostic.Location.SourceSpan;
src\Analyzers\CSharp\CodeFixes\MakeLocalFunctionStatic\MakeLocalFunctionStaticCodeFixHelper.cs (2)
64var referenceNode = root.FindNode(location.Location.SourceSpan); 130var referenceSpan = location.Location.SourceSpan;
src\Analyzers\CSharp\CodeFixes\MakeLocalFunctionStatic\PassInCapturedVariablesAsArgumentsCodeFixProvider.cs (1)
77.Select(d => root.FindNode(d.Location.SourceSpan).AncestorsAndSelf().OfType<LocalFunctionStatementSyntax>().FirstOrDefault())
src\Analyzers\CSharp\CodeFixes\MakeMemberRequired\CSharpMakeMemberRequiredCodeFixProvider.cs (1)
114var memberDeclarator = root.FindNode(diagnostic.Location.SourceSpan);
src\Analyzers\CSharp\CodeFixes\MakeMethodAsynchronous\CSharpMakeMethodAsynchronousCodeFixProvider.cs (1)
49var token = root.FindToken(diagnostic.Location.SourceSpan.Start);
src\Analyzers\CSharp\CodeFixes\MakeStatementAsynchronous\CSharpMakeStatementAsynchronousCodeFixProvider.cs (1)
36var node = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
src\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (1)
52var arrowToken = root.FindToken(diagnostic.Location.SourceSpan.Start);
src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (1)
52var questionToken = root.FindToken(diagnostic.Location.SourceSpan.Start);
src\Analyzers\CSharp\CodeFixes\NewLines\ConsecutiveBracePlacement\ConsecutiveBracePlacementCodeFixProvider.cs (1)
68var token = root.FindToken(diagnostic.Location.SourceSpan.Start);
src\Analyzers\CSharp\CodeFixes\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementCodeFixProvider.cs (1)
70var node = root.FindNode(diagnostic.AdditionalLocations[0].SourceSpan);
src\Analyzers\CSharp\CodeFixes\RemoveInKeyword\RemoveInKeywordCodeFixProvider.cs (1)
38var diagnosticSpan = diagnostic.Location.SourceSpan;
src\Analyzers\CSharp\CodeFixes\RemoveNewModifier\RemoveNewModifierCodeFixProvider.cs (1)
36var diagnosticSpan = diagnostic.Location.SourceSpan;
src\Analyzers\CSharp\CodeFixes\RemoveUnusedLocalFunction\CSharpRemoveUnusedLocalFunctionCodeFixProvider.cs (3)
50var localFunctions = diagnostics.OrderBy(static (d1, d2) => d2.Location.SourceSpan.Start - d1.Location.SourceSpan.Start) 51.Select(d => root.FindToken(d.Location.SourceSpan.Start))
src\Analyzers\CSharp\CodeFixes\UseDefaultLiteral\CSharpUseDefaultLiteralCodeFixProvider.cs (1)
53d => (DefaultExpressionSyntax)originalRoot.FindNode(d.Location.SourceSpan, getInnermostNodeForTie: true));
src\Analyzers\CSharp\CodeFixes\UseExplicitArrayInExpressionTree\CSharpUseExplicitArrayInExpressionTreeCodeFixProvider.cs (1)
122foreach (var diagnostic in diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start))
src\Analyzers\CSharp\CodeFixes\UseImplicitlyTypedLambdaExpression\CSharpUseImplicitObjectCreationCodeFixProvider.cs (1)
45.OrderBy(d => d.Location.SourceSpan.End)
src\Analyzers\CSharp\CodeFixes\UseImplicitObjectCreation\CSharpUseImplicitObjectCreationCodeFixProvider.cs (1)
52.OrderBy(d => d.Location.SourceSpan.End)
src\Analyzers\CSharp\CodeFixes\UseImplicitOrExplicitType\UseExplicitTypeCodeFixProvider.cs (1)
49var node = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
src\Analyzers\CSharp\CodeFixes\UseImplicitOrExplicitType\UseImplicitTypeCodeFixProvider.cs (1)
40var typeSyntax = (TypeSyntax)root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
src\Analyzers\CSharp\CodeFixes\UseIndexOrRangeOperator\CSharpUseIndexOperatorCodeFixProvider.cs (1)
40foreach (var diagnostic in diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start))
src\Analyzers\CSharp\CodeFixes\UsePatternCombinators\CSharpUsePatternCombinatorsCodeFixProvider.cs (1)
80var expression = editor.OriginalRoot.FindNode(location.SourceSpan, getInnermostNodeForTie: true);
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndMemberAccessCodeFixProvider.cs (1)
43foreach (var diagnostic in diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start))
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorFixAllProvider.cs (1)
50foreach (var diagnostic in diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start))
src\Analyzers\CSharp\CodeFixes\UseSystemThreadingLock\CSharpUseSystemThreadingLockFixAllProvider.cs (1)
42foreach (var diagnostic in diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start))
src\Analyzers\CSharp\CodeFixes\UseThrowExpression\UseThrowExpressionCodeFixProvider.cs (4)
48var ifStatement = root.FindNode(diagnostic.AdditionalLocations[0].SourceSpan); 49var throwStatementExpression = root.FindNode(diagnostic.AdditionalLocations[1].SourceSpan); 50var assignmentValue = root.FindNode(diagnostic.AdditionalLocations[2].SourceSpan); 51var assignmentExpressionStatement = root.FindNode(diagnostic.AdditionalLocations[3].SourceSpan);
src\Analyzers\CSharp\CodeFixes\UseUtf8StringLiteral\UseUtf8StringLiteralCodeFixProvider.cs (2)
120.Where(a => a.Initializer?.ElementValues.FirstOrDefault()?.Syntax.SpanStart == diagnostic.Location.SourceSpan.Start) 168if (argument.Span.Start == location.SourceSpan.Start)
StringIndentation\CSharpStringIndentationService.cs (1)
103if (!IsInHole(interpolatedString, error.Location.SourceSpan))
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (4)
src\Analyzers\CSharp\Tests\RemoveUnnecessaryParentheses\RemoveUnnecessaryExpressionParenthesesTests.cs (3)
2634Assert.Equal(expectedSpans["expression"].Single(), diagnostic.AdditionalLocations[0].SourceSpan); 2635Assert.Equal(expectedSpans["fade"][0], diagnostic.AdditionalLocations[1].SourceSpan); 2636Assert.Equal(expectedSpans["fade"][1], diagnostic.AdditionalLocations[2].SourceSpan);
src\Analyzers\CSharp\Tests\RemoveUnusedParametersAndValues\RemoveUnusedParametersTests.cs (1)
1133var sortedDiagnostics = diagnostics.OrderBy(d => d.Location.SourceSpan.Start).ToArray();
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (2)
Semantics\ImplicitObjectCreationTests.cs (2)
4158int nodeLocation = node.Location.SourceSpan.Start; 4185int nodeLocation = node.Location.SourceSpan.Start;
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (9)
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (1)
3903Assert.Equal(param.Identifier.Span, symbol.Locations[0].SourceSpan);
Symbols\AnonymousTypesSemanticsTests.cs (2)
1995Assert.Equal(typeSpan, type.Locations[0].SourceSpan); 2024Assert.Equal(span, property.Locations[0].SourceSpan);
Symbols\AnonymousTypesSymbolTests.cs (2)
1702Assert.True(statement1.Span.Contains(typeA3.Locations[0].SourceSpan)); 1703Assert.True(statement2.Span.Contains(typeA4.Locations[0].SourceSpan));
Symbols\Source\LocationTests.cs (2)
47Assert.Equal(start, pos.SourceSpan.Start); 48Assert.Equal(length, pos.SourceSpan.Length);
Symbols\Source\MethodTests.cs (2)
2068var span = symbol.Locations.Single().SourceSpan; 2089var span = symbol.Locations.Single().SourceSpan;
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (18)
Diagnostics\DiagnosticTest.cs (3)
87Assert.Equal(new TextSpan(5, 8), d1.Location.SourceSpan); 101Assert.Equal(new TextSpan(1, 1), d3.Location.SourceSpan); 103Assert.Equal(new TextSpan(14, 8), d3.AdditionalLocations.First().SourceSpan);
Diagnostics\LocationsTests.cs (10)
400Assert.InRange(diag.Location.SourceSpan.End, diag.Location.SourceSpan.Start, syntaxTree.GetText().Length); 465Assert.InRange(diag.Location.SourceSpan.Start, 0, syntaxTree.GetText().Length); 466Assert.InRange(diag.Location.SourceSpan.End, 0, syntaxTree.GetText().Length); 567Assert.Equal(5, diagnostics[0].Location.SourceSpan.Start); 568Assert.Equal(0, diagnostics[0].Location.SourceSpan.Length); 570Assert.True(treeSpan.Contains(diagnostics[0].Location.SourceSpan)); 595Assert.Equal(0, diagnostics[0].Location.SourceSpan.Start); 596Assert.Equal(0, diagnostics[0].Location.SourceSpan.Length); 598Assert.True(treeSpan.Contains(diagnostics[0].Location.SourceSpan));
LexicalAndXml\RawStringLiteralLexingTests.cs (1)
224var actualDiagnosticsSpans = diagnostics.Select(d => d.Location.SourceSpan).OrderBy(d => d.Start);
Syntax\SyntaxNodeTests.cs (4)
2080Assert.Equal(method.Span, nodeLocation.SourceSpan); 2085Assert.Equal(method.Identifier.Span, tokenLocation.SourceSpan); 2090Assert.Equal(method.ReturnType.GetLastToken().TrailingTrivia[0].Span, triviaLocation.SourceSpan); 2096Assert.Equal(textSpan, spanLocation.SourceSpan);
Microsoft.CodeAnalysis.CSharp.Workspaces (8)
Rename\CSharpRenameRewriterLanguageService.cs (3)
868var token = await tree.GetTouchingTokenAsync(location.SourceSpan.Start, cancellationToken, findInsideTrivia: true).ConfigureAwait(false); 896var token = await location.SourceTree!.GetTouchingTokenAsync(location.SourceSpan.Start, cancellationToken, findInsideTrivia: true).ConfigureAwait(false); 973implicitReferenceLocation.Location.SourceSpan.Start, cancellationToken, findInsideTrivia: false).ConfigureAwait(false);
Simplification\CSharpSimplificationService.cs (1)
194if (root.FindNode(diagnostic.Location.SourceSpan) is UsingDirectiveSyntax node)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Helpers\RemoveUnnecessaryImports\CSharpUnnecessaryImportsProvider.cs (1)
36root.FindNode(diagnostic.Location.SourceSpan) is UsingDirectiveSyntax node && predicate(node))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SemanticFacts\CSharpSemanticFacts.cs (2)
72if (symbol.Locations.Any(static (loc, location) => loc.SourceTree == location.SourceTree && loc.SourceSpan.Contains(location.SourceSpan), location))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationHelpers.cs (1)
206return contextTree?.GetRoot(cancellationToken).FindToken(contextLocation!.SourceSpan.Start).Parent;
Microsoft.CodeAnalysis.EditorFeatures (3)
InlineRename\AbstractEditorInlineRenameService.InlineRenameLocationSet.cs (1)
38_renameLocationSet.Solution.GetRequiredDocument(location.DocumentId), location.Location.SourceSpan);
Navigation\AbstractDefinitionLocationService.cs (1)
265if (otherPart.Locations is not [{ SourceTree: { } sourceTree, SourceSpan: var span }])
Peek\PeekHelpers.cs (1)
51var node = root.FindToken(identifierLocation.SourceSpan.Start).Parent;
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (2)
MetadataAsSource\AbstractMetadataAsSourceTests.cs (1)
75var line = text.Lines.GetLineFromPosition(metadataAsSourceFile.IdentifierLocation.SourceSpan.Start);
MetadataAsSource\AbstractMetadataAsSourceTests.TestContext.cs (1)
140var actualSpan = file.IdentifierLocation.SourceSpan;
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (3)
FindReferences\FindReferencesTests.vb (1)
466Return loc.IsInSource AndAlso Not loc.SourceTree.IsHiddenPosition(loc.SourceSpan.Start)
Rename\RenameEngineResult.vb (2)
226Dim newLocation = ConflictResolution.GetResolutionTextSpan(location.SourceSpan, documentId) 250Function(r) r.ConflictCheckSpan = location.SourceSpan AndAlso r.DocumentId = documentId)
Microsoft.CodeAnalysis.ExternalAccess.Copilot (2)
Internal\Analyzer\AbstractCopilotCodeAnalysisService.cs (1)
171return Task.FromResult(diagnostics.WhereAsArray(static (diagnostic, span) => diagnostic.Location.SourceSpan.IntersectsWith(span), span));
Internal\Analyzer\CSharp\CSharpCopilotCodeAnalysisService.cs (1)
130var containingMethod = syntaxFacts.GetContainingMethodDeclaration(root, diagnostic.Location.SourceSpan.Start, useFullSpan: false);
Microsoft.CodeAnalysis.Features (111)
AddImport\AbstractAddImportFeatureService.cs (1)
578.GroupBy(diagnostic => diagnostic.Location.SourceSpan)
BraceCompletion\AbstractBraceCompletionService.cs (2)
95return new BraceCompletionContext(document, fallbackOptions, leftToken.GetLocation().SourceSpan.Start, rightToken.GetLocation().SourceSpan.End, caretLocation);
ChangeSignature\AbstractChangeSignatureService.cs (2)
463var node = root.FindNode(location.SourceSpan, findInsideTrivia: true, getInnermostNodeForTie: true); 946.OrderByDescending(s => s.Locations.First().SourceSpan.Start);
CodeFixes\Service\CodeFixService.cs (1)
559return GetCodeFixesAsync(document, primaryDiagnostic.Location.SourceSpan, fixer, fixerMetadata,
CodeFixes\Suppression\AbstractSuppressionBatchFixAllProvider.cs (1)
281tuple => tuple.action, tuple => tuple.diagnostic?.Location.SourceSpan.Start ?? 0);
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.GlobalSuppressMessageFixAllCodeAction.cs (1)
160var suppressionTargetInfo = await fixer.GetSuppressionTargetInfoAsync(document, diagnostic.Location.SourceSpan, cancellationToken).ConfigureAwait(false);
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.PragmaBatchFixHelpers.cs (1)
53currentDiagnosticSpans.Add(diagnostic, diagnostic.Location.SourceSpan);
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.PragmaWarningBatchFixAllProvider.cs (1)
36var span = diagnostic.Location.SourceSpan;
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.PragmaWarningCodeAction.cs (1)
64_diagnostic.Location.SourceSpan,
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.RemoveSuppressionCodeAction.BatchFixer.cs (1)
45var span = diagnostic.Location.SourceSpan;
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.RemoveSuppressionCodeAction_Pragma.cs (2)
97_diagnostic.Location.SourceSpan, 124var diagnosticSpan = diagnostic.Location.SourceSpan;
CodeLens\CodeLensReferencesService.cs (2)
118var position = location.SourceSpan.Start; 219var enclosingSymbol = semanticModel.GetEnclosingSymbol(location.SourceSpan.Start, cancellationToken);
CodeLens\LocationComparer.cs (3)
21return x.SourceSpan.Equals(y.SourceSpan) && 32return Hash.Combine(obj.SourceSpan.GetHashCode(),
CodeRefactorings\SyncNamespace\AbstractChangeNamespaceService.cs (1)
771var refNode = root.FindNode(refLoc.ReferenceLocation.Location.SourceSpan, findInsideTrivia: true, getInnermostNodeForTie: true);
Completion\Providers\AbstractObjectInitializerCompletionProvider.cs (1)
78contextPosition: initializerLocation.SourceSpan.Start,
Debugging\AbstractBreakpointResolver.cs (1)
83var textSpan = new TextSpan(location.SourceSpan.Start, 0);
Diagnostics\Service\DocumentAnalysisExecutor.cs (1)
342bool shouldInclude(Diagnostic d) => span.Value.IntersectsWith(d.Location.SourceSpan) && !IsUnusedImportDiagnostic(d);
Diagnostics\Service\DocumentAnalysisExecutor_Helpers.cs (4)
158if (location.SourceSpan.End > location.SourceTree.Length) 161throw new ArgumentException(string.Format(FeaturesResources.Reported_diagnostic_0_has_a_source_location_1_in_file_2_which_is_outside_of_the_given_file, id, location.SourceSpan, location.SourceTree.FilePath), "diagnostic"); 181if (location.SourceSpan.End > text.Length) 184throw new ArgumentException(string.Format(FeaturesResources.Reported_diagnostic_0_has_a_source_location_1_in_file_2_which_is_outside_of_the_given_file, id, location.SourceSpan, filePath), "diagnostic");
DocumentHighlighting\AbstractDocumentHighlightsService.cs (2)
315var token = root.FindToken(location.SourceSpan.Start, findInsideTrivia: true); 319: new DocumentSpan(document, location.SourceSpan);
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (2)
6199symbol.Locations.FirstOrDefault()?.SourceSpan ?? symbol.ContainingSymbol.Locations.First().SourceSpan;
ExtractMethod\MethodExtractor.Analyzer.cs (2)
103var localFunctionCallsNotWithinSpan = symbolMap.Keys.Where(s => s.IsLocalFunction() && !s.Locations.Any(static (l, self) => self.SelectionResult.FinalSpan.Contains(l.SourceSpan), this)); 741if (typeParameter.Locations is not [var location] || selectionSpan.Contains(location.SourceSpan))
ExtractMethod\MethodExtractor.VariableSymbol.cs (2)
113return locationLeft.SourceSpan.Start - locationRight.SourceSpan.Start;
FindUsages\AbstractFindUsagesService_FindImplementations.cs (1)
133if (location.IsInSource && !seenLocations.Add((location.SourceTree.FilePath, location.SourceSpan)))
FindUsages\DefinitionItemFactory.cs (2)
241source.Add(new DocumentSpan(document, location.SourceSpan)); 301var sourceSpan = location.SourceSpan;
InheritanceMargin\AbstractInheritanceMarginService_Helpers.cs (1)
747sourceSpans: [new DocumentSpan(document, location.SourceSpan)],
InlineTemporary\AbstractInlineTemporaryCodeRefactoringProvider.cs (2)
46.Where(loc => !semanticModel.SyntaxTree.OverlapsHiddenPosition(loc.Location.SourceSpan, cancellationToken)) 47.Select(loc => root.FindToken(loc.Location.SourceSpan.Start).Parent as TIdentifierNameSyntax)
IntroduceParameter\AbstractIntroduceParameterCodeRefactoringProvider.cs (1)
290.OrderByDescending(reference => reference.Location.SourceSpan.Start);
Navigation\NavigableItemFactory.SymbolLocationNavigableItem.cs (1)
58public TextSpan SourceSpan => _location.SourceSpan;
NavigationBar\AbstractNavigationBarItemService.cs (2)
67var navigationLocationSpan = symbol.Locations.FirstOrDefault(loc => loc.SourceTree == tree)?.SourceSpan ?? 86return new SymbolItemLocation(inDocumentInfo: null, (documentId, navigationLocation.SourceSpan));
RemoveUnusedVariable\AbstractRemoveUnusedVariableCodeFixProvider.cs (3)
45var node = root.FindNode(diagnostic.Location.SourceSpan); 74var node = root.FindNode(diagnostic.Location.SourceSpan); 97var referencedSymbolNode = root.FindNode(location.Location.SourceSpan);
Rename\SymbolicRenameInfo.cs (1)
242documentSpans.Add(new DocumentSpan(sourceDocument, location.SourceSpan));
ReplaceMethodWithProperty\ReplaceMethodWithPropertyCodeRefactoringProvider.cs (2)
250var nameToken = root.FindToken(location.SourceSpan.Start); 290var nameToken = root.FindToken(location.SourceSpan.Start);
ReplacePropertyWithMethods\ReplacePropertyWithMethodsCodeRefactoringProvider.cs (4)
255var nameToken = root.FindToken(location.SourceSpan.Start, findInsideTrivia: true); 431return x.location.Location.SourceSpan == y.location.Location.SourceSpan; 435=> obj.location.Location.SourceSpan.GetHashCode();
SemanticSearch\AbstractSemanticSearchService.cs (1)
134d => new QueryCompilationError(d.Id, d.GetMessage(), (d.Location.SourceTree == queryTree) ? d.Location.SourceSpan : default));
Shared\Utilities\AnnotatedSymbolMapping.cs (1)
80var token = root.FindToken(location.SourceSpan.Start);
SimplifyTypeNames\AbstractSimplifyTypeNamesCodeFixProvider.cs (1)
112root, model, diagnostic.Location.SourceSpan,
src\Analyzers\Core\Analyzers\FileHeaders\AbstractFileHeaderDiagnosticAnalyzer.cs (1)
64if (!context.ShouldAnalyzeSpan(fileHeader.GetLocation(tree).SourceSpan))
src\Analyzers\Core\Analyzers\RemoveUnnecessaryParentheses\AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer.cs (3)
132var expressionFirstLine = lines.GetLineFromPosition(parenthesizedExpressionLocation.SourceSpan.Start); 134var textSpanEndPosition = Math.Min(parenthesizedExpressionLocation.SourceSpan.End, expressionFirstLine.Span.End); 135return Location.Create(parenthesizedExpression.SyntaxTree, TextSpan.FromBounds(parenthesizedExpressionLocation.SourceSpan.Start, textSpanEndPosition));
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (1)
565if (pragma.Span.End <= diagnostic.Location.SourceSpan.Start)
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (1)
607r => r.SyntaxTree == diagnosticLocation.SourceTree && r.Span.Contains(diagnosticLocation.SourceSpan));
src\Analyzers\Core\Analyzers\UseSystemHashCode\UseSystemHashCodeDiagnosticAnalyzer.cs (1)
47if (!context.ShouldAnalyzeSpan(diagnosticLocation.SourceSpan))
src\Analyzers\Core\CodeFixes\AddAnonymousTypeMemberName\AbstractAddAnonymousTypeMemberNameCodeFixProvider.cs (1)
55var span = diagnostic.Location.SourceSpan;
src\Analyzers\Core\CodeFixes\AddExplicitCast\AbstractAddExplicitCastCodeFixProvider.cs (2)
76var spanNode = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true) 221d => root.FindNode(d.Location.SourceSpan, getInnermostNodeForTie: true)
src\Analyzers\Core\CodeFixes\AddParameter\AbstractAddParameterCodeFixProvider.cs (1)
70var initialNode = root.FindNode(diagnostic.Location.SourceSpan);
src\Analyzers\Core\CodeFixes\AddParameter\AddParameterService.cs (1)
118var methodNode = syntaxRoot.FindNode(currentMethodToUpdate.Locations[0].SourceSpan, getInnermostNodeForTie: true);
src\Analyzers\Core\CodeFixes\ConflictMarkerResolution\AbstractConflictMarkerCodeFixProvider.cs (3)
403(d1, d2) => d1.Location.SourceSpan.Start - d2.Location.SourceSpan.Start).ToImmutableArray(); 416var position = diagnostic.Location.SourceSpan.Start;
src\Analyzers\Core\CodeFixes\ConvertTypeOfToNameOf\AbstractConvertTypeOfToNameOfCodeFixProvider.cs (1)
41if (editor.OriginalRoot.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true) is not TMemberAccessExpressionSyntax node)
src\Analyzers\Core\CodeFixes\ForEachCast\AbstractForEachCastCodeFixProvider.cs (1)
48var node = editor.OriginalRoot.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
src\Analyzers\Core\CodeFixes\Formatting\FormattingCodeFixProvider.cs (1)
76var diagnosticSpan = diagnostic.Location.SourceSpan;
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorCodeFixProvider.cs (1)
30if (!headerFacts.IsOnTypeHeader(root, diagnostic.Location.SourceSpan.Start, fullHeader: true, out var typeDecl))
src\Analyzers\Core\CodeFixes\MakeFieldReadonly\AbstractMakeFieldReadonlyCodeFixProvider.cs (1)
47var diagnosticSpan = diagnostic.Location.SourceSpan;
src\Analyzers\Core\CodeFixes\MakeTypePartial\AbstractMakeTypePartialCodeFixProvider.cs (1)
36var declaration = syntaxRoot.FindNode(diagnostic.Location.SourceSpan);
src\Analyzers\Core\CodeFixes\NewLines\MultipleBlankLines\AbstractMultipleBlankLinesCodeFixProvider.cs (1)
53var token = root.FindToken(diagnostic.AdditionalLocations[0].SourceSpan.Start);
src\Analyzers\Core\CodeFixes\RemoveAsyncModifier\AbstractRemoveAsyncModifierCodeFixProvider.cs (1)
75foreach (var diagnostic in diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start))
src\Analyzers\Core\CodeFixes\RemoveUnnecessarySuppressions\RemoveUnnecessaryAttributeSuppressionsCodeFixProvider.cs (2)
32if (root.FindNode(diagnostic.Location.SourceSpan) != null) 43var node = editor.OriginalRoot.FindNode(diagnostic.Location.SourceSpan);
src\Analyzers\Core\CodeFixes\RemoveUnnecessarySuppressions\RemoveUnnecessaryPragmaSuppressionsCodeFixProvider.cs (4)
37if (root.FindNode(diagnostic.Location.SourceSpan) is { } node && syntaxFacts.IsAttribute(node) || 38root.FindTrivia(diagnostic.Location.SourceSpan.Start).HasStructure) 74if (editor.OriginalRoot.FindNode(location.SourceSpan) is { } attribute && 83node = editor.OriginalRoot.FindTrivia(location.SourceSpan.Start).GetStructure()!;
src\Analyzers\Core\CodeFixes\RemoveUnusedParametersAndValues\AbstractRemoveUnusedValuesCodeFixProvider.cs (5)
269return diagnostics.GroupBy(d => syntaxFacts.GetContainingMemberDeclaration(root, d.Location.SourceSpan.Start) ?? root); 362diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start), 372diagnostics.OrderBy(d => d.Location.SourceSpan.Start), 401var expressionStatement = root.FindNode(diagnostic.Location.SourceSpan).FirstAncestorOrSelf<TExpressionStatementSyntax>(); 677var node = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
src\Analyzers\Core\CodeFixes\SimplifyBooleanExpression\SimplifyConditionalCodeFixProvider.cs (1)
51diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start).ToImmutableArray(),
src\Analyzers\Core\CodeFixes\SimplifyLinqExpression\SimplifyLinqExpressionCodeFixProvider.cs (2)
42foreach (var diagnostic in diagnostics.OrderByDescending(diagnostics => diagnostics.Location.SourceSpan.Start)) 44var invocation = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
src\Analyzers\Core\CodeFixes\UpdateLegacySuppressions\UpdateLegacySuppressionsCodeFixProvider.cs (2)
33root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true) != null) 44var node = editor.OriginalRoot.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
src\Analyzers\Core\CodeFixes\UseCoalesceExpression\UseCoalesceExpressionForNullableTernaryConditionalCheckCodeFixProvider.cs (3)
50var conditionalExpression = root.FindNode(diagnostic.AdditionalLocations[0].SourceSpan, getInnermostNodeForTie: true); 51var conditionExpression = root.FindNode(diagnostic.AdditionalLocations[1].SourceSpan); 52var whenPart = root.FindNode(diagnostic.AdditionalLocations[2].SourceSpan);
src\Analyzers\Core\CodeFixes\UseCoalesceExpression\UseCoalesceExpressionForTernaryConditionalCheckCodeFixProvider.cs (3)
62var conditionalExpression = root.FindNode(diagnostic.AdditionalLocations[0].SourceSpan, getInnermostNodeForTie: true); 63var conditionalPartHigh = root.FindNode(diagnostic.AdditionalLocations[1].SourceSpan); 64var whenPart = root.FindNode(diagnostic.AdditionalLocations[2].SourceSpan);
src\Analyzers\Core\CodeFixes\UseInferredMemberName\AbstractUseInferredMemberNameCodeFixProvider.cs (1)
35var node = root.FindNode(diagnostic.Location.SourceSpan);
src\Analyzers\Core\CodeFixes\UseIsNullCheck\AbstractUseIsNullForReferenceEqualsCodeFixProvider.cs (1)
58foreach (var diagnostic in diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start))
SyncNamespaces\AbstractSyncNamespacesService.cs (2)
115firstDiagnostic.Location.SourceSpan, 124diagnosticSpan: firstDiagnostic.Location.SourceSpan,
ValueTracking\ValueTrackedItem.cs (1)
55location.SourceSpan,
ValueTracking\ValueTracker.FindReferencesProgress.cs (2)
147var span = referenceLocation.Location.SourceSpan; 170var span = referenceLocation.Location.SourceSpan;
Wrapping\AbstractWrapper.cs (1)
66=> declaration.GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error && d.Location.SourceSpan.OverlapsWith(headerSpan));
Microsoft.CodeAnalysis.Features.Test.Utilities (1)
EditAndContinue\EditAndContinueTestVerifier.cs (1)
538.OrderBy(partners => partners.Key.GetLocation().SourceSpan.Start)
Microsoft.CodeAnalysis.InteractiveHost (2)
Interactive\Core\InteractiveHost.Service.cs (2)
784displayedDiagnostics.Sort((d1, d2) => d1.Location.SourceSpan.Start - d2.Location.SourceSpan.Start);
Microsoft.CodeAnalysis.LanguageServer.Protocol (2)
Features\UnifiedSuggestions\UnifiedSuggestedActionsSource.cs (2)
162applicableToSpan: fix.PrimaryDiagnostic.Location.SourceSpan); 246document, firstDiagnostic.Location.SourceSpan, scope, cancellationToken).ConfigureAwait(false);
Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers (21)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\AnalysisContextExtensions.cs (2)
54=> location.SourceTree != null && context.ShouldAnalyzeSpan(location.SourceSpan, location.SourceTree); 74=> location.SourceTree != null && context.ShouldAnalyzeSpan(location.SourceSpan, location.SourceTree);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\LocationExtensions.cs (7)
19=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindToken(location.SourceSpan.Start); 22=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan); 25=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan, getInnermostNodeForTie: getInnermostNodeForTie); 28=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan, findInsideTrivia, getInnermostNodeForTie); 38return !(tree == null || tree.IsHiddenPosition(loc.SourceSpan.Start)); 44return loc1.SourceTree == loc2.SourceTree && loc1.SourceSpan.IntersectsWith(loc2.SourceSpan);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
55var node = root.FindNode(location.SourceSpan, getInnermostNodeForTie: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (2)
263WriteInteger(location.SourceSpan.Start); 264WriteInteger(location.SourceSpan.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\ForkingSyntaxEditorBasedCodeFixProvider.cs (1)
67diagnostic.AdditionalLocations[0].SourceSpan, getInnermostNodeForTie: true);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\SyntaxEditorBasedCodeFixProvider.cs (2)
43.Sort((d1, d2) => d1.Location.SourceSpan.Start - d2.Location.SourceSpan.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (2)
205var afterMember = declarationList.LastOrDefault(m => m.SpanStart <= info.Context.AfterThisLocation.SourceSpan.Start); 221var beforeMember = declarationList.FirstOrDefault(m => m.Span.End >= info.Context.BeforeThisLocation.SourceSpan.End);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\FindSymbols\LinkedFileReferenceLocationEqualityComparer.cs (3)
25return x.Location.SourceSpan == y.Location.SourceSpan; 29=> obj.Location.SourceSpan.GetHashCode();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.State.cs (1)
107let token = syntaxRoot.FindToken(r.Location.SourceSpan.Start)
Microsoft.CodeAnalysis.PublicApiAnalyzers (12)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\AnalysisContextExtensions.cs (2)
54=> location.SourceTree != null && context.ShouldAnalyzeSpan(location.SourceSpan, location.SourceTree); 74=> location.SourceTree != null && context.ShouldAnalyzeSpan(location.SourceSpan, location.SourceTree);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\LocationExtensions.cs (7)
19=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindToken(location.SourceSpan.Start); 22=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan); 25=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan, getInnermostNodeForTie: getInnermostNodeForTie); 28=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan, findInsideTrivia, getInnermostNodeForTie); 38return !(tree == null || tree.IsHiddenPosition(loc.SourceSpan.Start)); 44return loc1.SourceTree == loc2.SourceTree && loc1.SourceSpan.IntersectsWith(loc2.SourceSpan);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
55var node = root.FindNode(location.SourceSpan, getInnermostNodeForTie: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (2)
263WriteInteger(location.SourceSpan.Start); 264WriteInteger(location.SourceSpan.Length);
Microsoft.CodeAnalysis.ResxSourceGenerator (12)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\AnalysisContextExtensions.cs (2)
54=> location.SourceTree != null && context.ShouldAnalyzeSpan(location.SourceSpan, location.SourceTree); 74=> location.SourceTree != null && context.ShouldAnalyzeSpan(location.SourceSpan, location.SourceTree);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\LocationExtensions.cs (7)
19=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindToken(location.SourceSpan.Start); 22=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan); 25=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan, getInnermostNodeForTie: getInnermostNodeForTie); 28=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan, findInsideTrivia, getInnermostNodeForTie); 38return !(tree == null || tree.IsHiddenPosition(loc.SourceSpan.Start)); 44return loc1.SourceTree == loc2.SourceTree && loc1.SourceSpan.IntersectsWith(loc2.SourceSpan);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
55var node = root.FindNode(location.SourceSpan, getInnermostNodeForTie: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (2)
263WriteInteger(location.SourceSpan.Start); 264WriteInteger(location.SourceSpan.Length);
Microsoft.CodeAnalysis.Scripting (2)
Hosting\CommandLine\CommandLineRunner.cs (2)
384return (delta != 0) ? delta : d1.Location.SourceSpan.Start - d2.Location.SourceSpan.Start;
Microsoft.CodeAnalysis.Test.Utilities (4)
Diagnostics\DiagnosticDescription.cs (4)
161_squiggledText = _location.SourceTree.GetText().ToString(_location.SourceSpan); 285if (!_syntaxPredicate(d._location.SourceTree.GetRoot().FindToken(_location.SourceSpan.Start, true).Parent)) 298if (!d._syntaxPredicate(_location.SourceTree.GetRoot().FindToken(_location.SourceSpan.Start, true).Parent)) 579assertText.AppendLine(l.SourceTree.GetText().Lines.GetLineFromPosition(l.SourceSpan.Start).ToString());
Microsoft.CodeAnalysis.VisualBasic (27)
Analysis\FlowAnalysis\DataFlowPass.vb (1)
1194If isImplicitlyDeclared OrElse firstLocation Is Nothing OrElse firstLocation.SourceSpan.Start < node.SpanStart Then
CommandLine\CommandLineDiagnosticFormatter.vb (2)
133Return diagnostic.Location.SourceSpan 147Return diagnostic.Location.SourceSpan
Compilation\DocumentationComments\DocumentationCommentCompiler.Includes.vb (1)
549(Not Me._filterSpanWithinTree.HasValue OrElse Me._filterSpanWithinTree.Value.Contains(loc.SourceSpan))
Compilation\VisualBasicDiagnosticFilter.vb (1)
205location.SourceTree.GetWarningState(id, location.SourceSpan.Start) = ReportDiagnostic.Suppress Then
GlobalImport.vb (1)
117Dim unmappedSpan = unmappedDiag.Location.SourceSpan
Locations\LocationExtensions.vb (1)
28Return location.SourceSpan
Locations\VBLocation.vb (1)
25Return Me.SourceSpan
Symbols\MethodSymbolExtensions.vb (1)
51If location.IsInSource AndAlso location.SourceTree Is syntaxTree AndAlso parameter.Span.Contains(location.SourceSpan) Then
Symbols\NamedTypeSymbolExtensions.vb (3)
30If methodLoc.IsInSource AndAlso methodLoc.SourceTree Is tree AndAlso methodLoc.SourceSpan = nameSpan Then 40If methodLoc.IsInSource AndAlso methodLoc.SourceTree Is tree AndAlso methodLoc.SourceSpan = nameSpan Then 63methodLoc.SourceSpan = nameSpan Then
Symbols\Source\SourceMemberContainerTypeSymbol.vb (10)
1362Return containingSourceNamespace.GetDeclarationSpelling(firstLocation.SourceTree, firstLocation.SourceSpan.Start) 2265((fileCompResult = 0) AndAlso typeToTestLocation.SourceSpan.Start >= structBeingAnalyzedLocation.SourceSpan.Start) 3264If Me._declaration.Declarations.Length >= 1 AndAlso position = Me._declaration.Declarations(0).Location.SourceSpan.Start Then 3896If GetImplementsLocation(interface1).SourceSpan.Start > GetImplementsLocation(interface2).SourceSpan.Start Then 3946If GetImplementsLocation(interface1).SourceSpan.Start > GetImplementsLocation(interface2).SourceSpan.Start Then 3978If GetImplementsLocation(interface1).SourceSpan.Start > GetImplementsLocation(interface2).SourceSpan.Start Then
Symbols\Source\SourcePropertySymbol.vb (2)
168Dim accessor = If(getMethod.Locations(0).SourceSpan.Start < setMethod.Locations(0).SourceSpan.Start, setMethod, getMethod)
Symbols\Symbol.vb (1)
373Dim token = CType(location.SourceTree.GetRoot().FindToken(location.SourceSpan.Start), SyntaxToken)
Syntax\SyntaxFacts.vb (1)
1116If p.GetLocation.SourceSpan.Start < token.SpanStart Then
Syntax\VisualBasicWarningStateMap.vb (1)
91entries(index) = New WarningStateMapEntry(currentDirective.GetLocation().SourceSpan.End, accumulatedGeneralWarningState, accumulatedSpecificWarningState)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (2)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Helpers\RemoveUnnecessaryImports\VisualBasicUnnecessaryImportsProvider.vb (2)
37Dim node = TryCast(root.FindNode(diagnostic.Location.SourceSpan), ImportsClauseSyntax) 44Dim node = TryCast(root.FindNode(diagnostic.Location.SourceSpan), ImportsStatementSyntax)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (3)
src\Analyzers\VisualBasic\CodeFixes\GenerateParameterizedMember\GenerateParameterizedMemberCodeFixProvider.vb (1)
61Dim diagnosticSpan = diagnostic.Location.SourceSpan
src\Analyzers\VisualBasic\CodeFixes\RemoveUnnecessaryByVal\VisualBasicRemoveUnnecessaryByValCodeFixProvider.vb (1)
38Dim node = DirectCast(root.FindNode(diagnostic.AdditionalLocations(0).SourceSpan), ParameterSyntax)
src\Analyzers\VisualBasic\CodeFixes\SimplifyObjectCreation\VisualBasicSimplifyObjectCreationCodeFixProvider.vb (1)
37Dim node = DirectCast(root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie:=True), VariableDeclaratorSyntax)
Microsoft.CodeAnalysis.VisualBasic.Features (6)
Completion\CompletionProviders\OverrideCompletionProvider.vb (3)
205Return New TextSpan(methodStatement.GetLocation().SourceSpan.End, 0) 212Return New TextSpan(lastStatement.GetLocation().SourceSpan.End, 0) 222Return New TextSpan(lastAccessorStatement.GetLocation().SourceSpan.End, 0)
src\Analyzers\VisualBasic\CodeFixes\GenerateParameterizedMember\GenerateParameterizedMemberCodeFixProvider.vb (1)
61Dim diagnosticSpan = diagnostic.Location.SourceSpan
src\Analyzers\VisualBasic\CodeFixes\RemoveUnnecessaryByVal\VisualBasicRemoveUnnecessaryByValCodeFixProvider.vb (1)
38Dim node = DirectCast(root.FindNode(diagnostic.AdditionalLocations(0).SourceSpan), ParameterSyntax)
src\Analyzers\VisualBasic\CodeFixes\SimplifyObjectCreation\VisualBasicSimplifyObjectCreationCodeFixProvider.vb (1)
37Dim node = DirectCast(root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie:=True), VariableDeclaratorSyntax)
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (24)
Compilation\SemanticModelGetDeclaredSymbolAPITests.vb (24)
1844Assert.True(syntax.SpanStart = tpSymbol1.Locations.Item(0).SourceSpan.Start OrElse 1845syntax.SpanStart = tpSymbol1.Locations.Item(1).SourceSpan.Start, 1853Assert.True(syntax.SpanStart = tpSymbol2.Locations.Item(0).SourceSpan.Start OrElse 1854syntax.SpanStart = tpSymbol2.Locations.Item(1).SourceSpan.Start, 1862Assert.True(syntax.SpanStart = tpSymbol3.Locations.Item(0).SourceSpan.Start OrElse 1863syntax.SpanStart = tpSymbol3.Locations.Item(1).SourceSpan.Start, 1871Assert.True(syntax.SpanStart = tpSymbol4.Locations.Item(0).SourceSpan.Start OrElse 1872syntax.SpanStart = tpSymbol4.Locations.Item(1).SourceSpan.Start, 2017Assert.True(syntax.SpanStart = varSymbol1.Locations.Item(0).SourceSpan.Start OrElse 2018syntax.SpanStart = varSymbol1.Locations.Item(1).SourceSpan.Start, 2027Assert.True(syntax.SpanStart = varSymbol2.Locations.Item(0).SourceSpan.Start OrElse 2028syntax.SpanStart = varSymbol2.Locations.Item(1).SourceSpan.Start, 2037Assert.True(syntax.SpanStart = varSymbol3.Locations.Item(0).SourceSpan.Start OrElse 2038syntax.SpanStart = varSymbol3.Locations.Item(1).SourceSpan.Start, 2047Assert.True(syntax.SpanStart = varSymbol4.Locations.Item(0).SourceSpan.Start OrElse 2048syntax.SpanStart = varSymbol4.Locations.Item(1).SourceSpan.Start, 2057Assert.True(syntax.SpanStart = varSymbol5.Locations.Item(0).SourceSpan.Start OrElse 2058syntax.SpanStart = varSymbol5.Locations.Item(1).SourceSpan.Start, 2067Assert.True(syntax.SpanStart = varSymbol6.Locations.Item(0).SourceSpan.Start OrElse 2068syntax.SpanStart = varSymbol6.Locations.Item(1).SourceSpan.Start, 2078Assert.True(syntax.SpanStart = varSymbol7.Locations.Item(0).SourceSpan.Start OrElse 2079syntax.SpanStart = varSymbol7.Locations.Item(1).SourceSpan.Start, 2088Assert.True(syntax.SpanStart = varSymbol8.Locations.Item(0).SourceSpan.Start OrElse 2089syntax.SpanStart = varSymbol8.Locations.Item(1).SourceSpan.Start,
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (17)
SymbolsTests\AnonymousTypes\AnonymousTypesSemanticsTests.vb (2)
422Assert.Equal(location.SourceSpan, localType.Locations(0).SourceSpan) 456Assert.Equal(locations(propIndex).SourceSpan, member.Locations(0).SourceSpan)
SymbolsTests\Source\SourceSymbolTests.vb (15)
336Assert.Equal("C", locs(0).SourceTree.GetText().ToString(locs(0).SourceSpan)) 338Assert.Equal("C", locs(1).SourceTree.GetText().ToString(locs(1).SourceSpan)) 345Assert.Equal("D", locs(0).SourceTree.GetText().ToString(locs(0).SourceSpan)) 347Assert.Equal("D", locs(1).SourceTree.GetText().ToString(locs(1).SourceSpan)) 354Assert.Equal("T", locs(0).SourceTree.GetText().ToString(locs(0).SourceSpan)) 356Assert.Equal("T", locs(1).SourceTree.GetText().ToString(locs(1).SourceSpan)) 362Assert.Equal("m1", locs(0).SourceTree.GetText().ToString(locs(0).SourceSpan)) 368Assert.Equal("x", locs(0).SourceTree.GetText().ToString(locs(0).SourceSpan)) 374Assert.Equal("v1$", locs(0).SourceTree.GetText().ToString(locs(0).SourceSpan)) 381Assert.Equal("N1", locs(0).SourceTree.GetText().ToString(locs(0).SourceSpan)) 383Assert.Equal("N1", locs(1).SourceTree.GetText().ToString(locs(1).SourceSpan)) 390Assert.Equal("N2", locs(0).SourceTree.GetText().ToString(locs(0).SourceSpan)) 392Assert.Equal("N2", locs(1).SourceTree.GetText().ToString(locs(1).SourceSpan)) 399Assert.Equal("N3", locs(0).SourceTree.GetText().ToString(locs(0).SourceSpan)) 401Assert.Equal("N3", locs(1).SourceTree.GetText().ToString(locs(1).SourceSpan))
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (2)
TestSyntaxNodes.vb (2)
933Dim span1 = err1.Location.SourceSpan 934Dim span2 = err2.Location.SourceSpan
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (13)
CompilationTestUtils.vb (10)
1008Dim lineText As String = GetLineText(sourceLocation.SourceTree.GetText(), sourceLocation.SourceSpan.Start, offsetInLine) 1012New String("~"c, Math.Max(Math.Min(sourceLocation.SourceSpan.Length, lineText.Length - offsetInLine + 1), 1)) + Environment.NewLine 1055If loc1.SourceSpan.Start < loc2.SourceSpan.Start Then Return -1 1056If loc1.SourceSpan.Start > loc2.SourceSpan.Start Then Return 1 1057If loc1.SourceSpan.Length < loc2.SourceSpan.Length Then Return -1 1058If loc1.SourceSpan.Length > loc2.SourceSpan.Length Then Return 1
ParserTestUtilities.vb (1)
611Dim syntaxErrorSpan = syntaxError.Location.SourceSpan
SemanticModelTestBase.vb (2)
84" Location1.SourceSpan.Start : " & tpSymbol.Locations.Item(0).SourceSpan.Start & 85" Location2.SourceSpan.Start : " & tpSymbol.Locations.Item(0).SourceSpan.Start
Microsoft.CodeAnalysis.VisualBasic.Workspaces (3)
Simplification\VisualBasicSimplificationService.vb (1)
170Dim node = root.FindNode(diagnostic.Location.SourceSpan)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Helpers\RemoveUnnecessaryImports\VisualBasicUnnecessaryImportsProvider.vb (2)
37Dim node = TryCast(root.FindNode(diagnostic.Location.SourceSpan), ImportsClauseSyntax) 44Dim node = TryCast(root.FindNode(diagnostic.Location.SourceSpan), ImportsStatementSyntax)
Microsoft.CodeAnalysis.Workspaces (56)
CodeFixes\CodeFixContext.cs (3)
150(diagnostic ?? throw new ArgumentNullException(nameof(diagnostic))).Location.SourceSpan, 174(diagnostic ?? throw new ArgumentNullException(nameof(diagnostic))).Location.SourceSpan, 250if (diagnostics.Any((d, span) => d.Location.SourceSpan != span, span))
CodeFixes\FixAllOccurrences\BatchFixAllProvider.cs (2)
119.ThenBy(d => d.Location.SourceSpan.Start) 155var context = new CodeFixContext(document, diagnostic.Location.SourceSpan, [diagnostic], action, cancellationToken);
CodeFixes\FixAllOccurrences\FixAllContext.cs (1)
249&& (filterSpan == null || filterSpan.Value.Contains(d.Location.SourceSpan)))];
CodeFixes\FixAllOccurrences\FixAllState.cs (1)
69var diagnosticSpan = diagnosticsToFix.First().Value.FirstOrDefault()?.Location.SourceSpan;
Diagnostics\Extensions.cs (2)
317filterSpan.HasValue && !filterSpan.Value.IntersectsWith(diagnostic.Location.SourceSpan)); 539if (span.HasValue && !span.Value.IntersectsWith(diagnostic.Location.SourceSpan))
Editing\SymbolEditor.cs (1)
330return EditOneDeclarationAsync(symbol, doc.Id, location.SourceSpan.Start, editAction, cancellationToken);
FindSymbols\ReferenceLocation.cs (2)
140(compare = this.Location.SourceSpan.CompareTo(other.Location.SourceSpan)) != 0)
FindSymbols\ReferenceLocationExtensions.cs (1)
73var enclosingSymbol = semanticModel.GetEnclosingSymbol(reference.Location.SourceSpan.Start);
ReassignedVariable\AbstractReassignedVariableService.cs (1)
250location = parameterLocation.SourceSpan;
Recommendations\AbstractRecommendationServiceRunner.cs (1)
353declarationSyntax.Span.IntersectsWith(candidateLocation.SourceSpan)), declarationSyntax);
Remote\RemoteArguments.cs (1)
165referenceLocation.Location.SourceSpan,
Rename\ConflictEngine\ConflictResolver.cs (6)
192implicitUsageConflict.SourceSpan, conflictResolution.OldSolution.GetRequiredDocument(implicitUsageConflict.SourceTree).Id, RelatedLocationType.UnresolvableConflict)); 216implicitConflict.SourceSpan, conflictResolution.OldSolution.GetRequiredDocument(implicitConflict.SourceTree).Id, RelatedLocationType.UnresolvableConflict)); 310languageConflict.SourceSpan, conflictResolution.OldSolution.GetRequiredDocument(languageConflict.SourceTree).Id, RelatedLocationType.UnresolvableConflict)); 337oldLocation.SourceSpan, conflictResolution.OldSolution.GetRequiredDocument(oldLocation.SourceTree).Id, RelatedLocationType.UnresolvableConflict)); 377renameDeclarationLocations[symbolIndex] = new RenameDeclarationLocationReference(solution.GetDocumentId(location.SourceTree), location.SourceSpan, overriddenFromMetadata, locations.Length); 417.ThenBy(l => l.IsInSource ? l.SourceSpan.Start : int.MaxValue);
Rename\ConflictEngine\ConflictResolver.Session.cs (10)
225renamedSpansTracker.GetAdjustedPosition(_renameSymbolDeclarationLocation.SourceSpan.Start, _documentIdOfRenameSymbolDeclaration), 556if (newLocations.Any(loc => loc.SourceSpan.Start == adjustedStartPosition)) 605if (newAdjustedStartPosition != newLocation.SourceSpan.Start) 613var overridingSymbol = await SymbolFinder.FindSymbolAtPositionAsync(solution.GetRequiredDocument(newLocation.SourceTree), newLocation.SourceSpan.Start, cancellationToken: _cancellationToken).ConfigureAwait(false); 691? conflictResolution.GetAdjustedTokenStartingPosition(_renameSymbolDeclarationLocation.SourceSpan.Start, _documentIdOfRenameSymbolDeclaration) 692: _renameSymbolDeclarationLocation.SourceSpan.Start; 811.ToImmutableDictionary(l => l.Location.SourceSpan); 905if (!containingLocationForStringOrComment.Contains(renameLocation.Location.SourceSpan)) 915var offset = renameLocation.Location.SourceSpan.Start - containingLocationForStringOrComment.Start; 916var length = renameLocation.Location.SourceSpan.Length;
Rename\IRemoteRenamerService.cs (1)
80=> new(location.Location.SourceSpan,
Rename\LightweightRenameLocations.cs (1)
124this.Locations.WhereAsArray(loc => filter(loc.DocumentId, loc.Location.SourceSpan)),
Rename\SymbolicRenameLocations.ReferenceProcessing.cs (1)
307containingLocationForStringOrComment: location.ContainingStringLocation.SourceSpan));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\AnalysisContextExtensions.cs (2)
54=> location.SourceTree != null && context.ShouldAnalyzeSpan(location.SourceSpan, location.SourceTree); 74=> location.SourceTree != null && context.ShouldAnalyzeSpan(location.SourceSpan, location.SourceTree);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\LocationExtensions.cs (7)
19=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindToken(location.SourceSpan.Start); 22=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan); 25=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan, getInnermostNodeForTie: getInnermostNodeForTie); 28=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan, findInsideTrivia, getInnermostNodeForTie); 38return !(tree == null || tree.IsHiddenPosition(loc.SourceSpan.Start)); 44return loc1.SourceTree == loc2.SourceTree && loc1.SourceSpan.IntersectsWith(loc2.SourceSpan);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
55var node = root.FindNode(location.SourceSpan, getInnermostNodeForTie: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (2)
263WriteInteger(location.SourceSpan.Start); 264WriteInteger(location.SourceSpan.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\ForkingSyntaxEditorBasedCodeFixProvider.cs (1)
67diagnostic.AdditionalLocations[0].SourceSpan, getInnermostNodeForTie: true);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\SyntaxEditorBasedCodeFixProvider.cs (2)
43.Sort((d1, d2) => d1.Location.SourceSpan.Start - d2.Location.SourceSpan.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (2)
205var afterMember = declarationList.LastOrDefault(m => m.SpanStart <= info.Context.AfterThisLocation.SourceSpan.Start); 221var beforeMember = declarationList.FirstOrDefault(m => m.Span.End >= info.Context.BeforeThisLocation.SourceSpan.End);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\FindSymbols\LinkedFileReferenceLocationEqualityComparer.cs (3)
25return x.Location.SourceSpan == y.Location.SourceSpan; 29=> obj.Location.SourceSpan.GetHashCode();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.State.cs (1)
107let token = syntaxRoot.FindToken(r.Location.SourceSpan.Start)
Microsoft.CodeAnalysis.Workspaces.UnitTests (9)
BatchFixAllProviderTests.cs (1)
94cancellationToken => CreateChangedDocument(context.Document, diagnostic.Location.SourceSpan, replacement, cancellationToken),
FindReferencesTests.cs (6)
585Assert.NotEqual(typeResult.Locations.Single().Location.SourceSpan, constructorResult.Locations.Single().Location.SourceSpan); 620Assert.NotEqual(typeResult.Locations.Single().Location.SourceSpan, constructorResult.Locations.Single().Location.SourceSpan); 664Assert.True(typeResult.Locations.All(loc => loc.Location.SourceSpan != constructorResult.Locations.Single().Location.SourceSpan));
SymbolKeyTests.cs (2)
1432Assert.True(resolved.Symbol.Locations[0].SourceSpan.Start > symbol.Locations[0].SourceSpan.Start);
Microsoft.Gen.ComplianceReports.Unit.Tests (10)
test\Generators\Shared\RoslynTestUtils.cs (10)
142Assert.True(expectedSpan.Equals(actual.Location.SourceSpan), 143$"Span {spanNum} doesn't match: expected {expectedSpan} but got {actual.Location.SourceSpan}"); 156TextSpan? expectedSpan = Location.None.SourceSpan; 169Assert.True(expectedSpan.Equals(d.Location.SourceSpan), 170$"Span {spanNum} doesn't match: expected {expectedSpan} but got {d.Location.SourceSpan}"); 172if (expectedSpan != Location.None.SourceSpan) 418if (x.Location.SourceSpan.Start < y.Location.SourceSpan.Start) 422else if (x.Location.SourceSpan.Start > y.Location.SourceSpan.Start)
Microsoft.Gen.ContextualOptions.Unit.Tests (10)
test\Generators\Shared\RoslynTestUtils.cs (10)
142Assert.True(expectedSpan.Equals(actual.Location.SourceSpan), 143$"Span {spanNum} doesn't match: expected {expectedSpan} but got {actual.Location.SourceSpan}"); 156TextSpan? expectedSpan = Location.None.SourceSpan; 169Assert.True(expectedSpan.Equals(d.Location.SourceSpan), 170$"Span {spanNum} doesn't match: expected {expectedSpan} but got {d.Location.SourceSpan}"); 172if (expectedSpan != Location.None.SourceSpan) 418if (x.Location.SourceSpan.Start < y.Location.SourceSpan.Start) 422else if (x.Location.SourceSpan.Start > y.Location.SourceSpan.Start)
Microsoft.Gen.Logging.Unit.Tests (10)
test\Generators\Shared\RoslynTestUtils.cs (10)
142Assert.True(expectedSpan.Equals(actual.Location.SourceSpan), 143$"Span {spanNum} doesn't match: expected {expectedSpan} but got {actual.Location.SourceSpan}"); 156TextSpan? expectedSpan = Location.None.SourceSpan; 169Assert.True(expectedSpan.Equals(d.Location.SourceSpan), 170$"Span {spanNum} doesn't match: expected {expectedSpan} but got {d.Location.SourceSpan}"); 172if (expectedSpan != Location.None.SourceSpan) 418if (x.Location.SourceSpan.Start < y.Location.SourceSpan.Start) 422else if (x.Location.SourceSpan.Start > y.Location.SourceSpan.Start)
Microsoft.Gen.MetadataExtractor.Unit.Tests (10)
test\Generators\Shared\RoslynTestUtils.cs (10)
142Assert.True(expectedSpan.Equals(actual.Location.SourceSpan), 143$"Span {spanNum} doesn't match: expected {expectedSpan} but got {actual.Location.SourceSpan}"); 156TextSpan? expectedSpan = Location.None.SourceSpan; 169Assert.True(expectedSpan.Equals(d.Location.SourceSpan), 170$"Span {spanNum} doesn't match: expected {expectedSpan} but got {d.Location.SourceSpan}"); 172if (expectedSpan != Location.None.SourceSpan) 418if (x.Location.SourceSpan.Start < y.Location.SourceSpan.Start) 422else if (x.Location.SourceSpan.Start > y.Location.SourceSpan.Start)
Microsoft.Gen.Metrics.Unit.Tests (10)
test\Generators\Shared\RoslynTestUtils.cs (10)
142Assert.True(expectedSpan.Equals(actual.Location.SourceSpan), 143$"Span {spanNum} doesn't match: expected {expectedSpan} but got {actual.Location.SourceSpan}"); 156TextSpan? expectedSpan = Location.None.SourceSpan; 169Assert.True(expectedSpan.Equals(d.Location.SourceSpan), 170$"Span {spanNum} doesn't match: expected {expectedSpan} but got {d.Location.SourceSpan}"); 172if (expectedSpan != Location.None.SourceSpan) 418if (x.Location.SourceSpan.Start < y.Location.SourceSpan.Start) 422else if (x.Location.SourceSpan.Start > y.Location.SourceSpan.Start)
Microsoft.Gen.MetricsReports.Unit.Tests (10)
test\Generators\Shared\RoslynTestUtils.cs (10)
142Assert.True(expectedSpan.Equals(actual.Location.SourceSpan), 143$"Span {spanNum} doesn't match: expected {expectedSpan} but got {actual.Location.SourceSpan}"); 156TextSpan? expectedSpan = Location.None.SourceSpan; 169Assert.True(expectedSpan.Equals(d.Location.SourceSpan), 170$"Span {spanNum} doesn't match: expected {expectedSpan} but got {d.Location.SourceSpan}"); 172if (expectedSpan != Location.None.SourceSpan) 418if (x.Location.SourceSpan.Start < y.Location.SourceSpan.Start) 422else if (x.Location.SourceSpan.Start > y.Location.SourceSpan.Start)
Microsoft.Interop.ComInterfaceGenerator (5)
ComMethodInfo.cs (4)
110&& interfaceLocation.SourceSpan.Contains(methodLocation.SourceSpan)) 127if (declaringSyntax.GetLocation().SourceSpan.Contains(methodLocationInAttributedInterfaceDeclaration.SourceSpan))
src\libraries\System.Runtime.InteropServices\gen\Common\ConvertToSourceGeneratedInteropFixer.cs (1)
202SyntaxNode node = root.FindNode(diagnostic.Location.SourceSpan);
Microsoft.Interop.LibraryImportGenerator (6)
Analyzers\ConvertToLibraryImportFixer.cs (1)
293SyntaxNode? referenceNode = root.FindNode(location.Location.SourceSpan);
Analyzers\CustomMarshallerAttributeFixer.cs (3)
39var entryPointTypeSymbol = (INamedTypeSymbol)model.GetEnclosingSymbol(diagnostic.Location.SourceSpan.Start, fixAllContext.CancellationToken); 44SyntaxNode node = root.FindNode(diagnostic.Location.SourceSpan); 184&& attr.ApplicationSyntaxReference.Span.Contains(locationInAttribute.SourceSpan)).ConstructorArguments[0].Value!;
Analyzers\ShapeBreakingDiagnosticSuppressor.cs (1)
36ISymbol diagnosedSymbol = model.GetDeclaredSymbol(diagnostic.Location.SourceTree.GetRoot(context.CancellationToken).FindNode(diagnostic.Location.SourceSpan), context.CancellationToken);
src\libraries\System.Runtime.InteropServices\gen\Common\ConvertToSourceGeneratedInteropFixer.cs (1)
202SyntaxNode node = root.FindNode(diagnostic.Location.SourceSpan);
Microsoft.Maui.Controls.BindingSourceGen (1)
BindingInvocationDescription.cs (1)
24 : new SourceCodeLocation(location.SourceTree.FilePath, location.SourceSpan, location.GetLineSpan().Span);
Microsoft.ML.InternalCodeAnalyzer (3)
ContractsCheckNameofFixProvider.cs (1)
41var diagnosticSpan = diagnostic.Location.SourceSpan;
NameFixProvider.cs (1)
60var token = root.FindToken(diagnostic.Location.SourceSpan.Start);
RelaxTestNamingSuppressor.cs (1)
42var node = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
Microsoft.VisualStudio.LanguageServices (7)
CallHierarchy\CallHierarchyDetail.cs (1)
30_span = location.SourceSpan;
Diagnostics\VisualStudioVenusSpanMappingService.cs (1)
33sourceSpan = location.SourceSpan;
Venus\ContainedLanguageCodeSupport.cs (3)
209var position = type.Locations.First(loc => loc.SourceTree == targetSyntaxTree).SourceSpan.Start; 299? semanticModel.LookupSymbols(position: type.Locations[0].SourceSpan.Start, container: type, name: null) 496return semanticModel.LookupSymbols(typeLocation.SourceSpan.Start, objectType, nameOfEvent).SingleOrDefault(m => m.Kind == SymbolKind.Event);
Workspace\VisualStudioSymbolNavigationService.cs (2)
68solution.Workspace, targetDocument.Id, sourceLocation.SourceSpan.Start, cancellationToken).ConfigureAwait(false); 172result.IdentifierLocation.SourceSpan.Start,
Mvc.Api.Analyzers.Test (4)
ActualApiResponseMetadataFactoryTest.cs (4)
77var methodSyntax = syntaxTree.GetRoot().FindNode(method.Locations[0].SourceSpan); 374var methodSyntax = (MethodDeclarationSyntax)syntaxTree.GetRoot().FindNode(method.Locations[0].SourceSpan); 394var methodSyntax = syntaxTree.GetRoot().FindNode(method.Locations[0].SourceSpan); 413var methodSyntax = syntaxTree.GetRoot().FindNode(method.Locations[0].SourceSpan);
Roslyn.Diagnostics.Analyzers (36)
AbstractCreateTestAccessor`1.cs (1)
51cancellationToken => CreateTestAccessorAsync(context.Document, location.SourceSpan, cancellationToken),
AbstractExposeMemberForTesting`1.cs (1)
72cancellationToken => AddMemberToTestAccessorAsync(context.Document, location.SourceSpan, memberName, member.GetDocumentationCommentId(), cancellationToken),
DefaultableTypeShouldHaveDefaultableFieldsAnalyzer.cs (1)
100if (!semanticModel.GetNullableContext(field.Locations[0].SourceSpan.Start).WarningsEnabled())
ExportedPartsShouldHaveImportingConstructorCodeFixProvider.cs (3)
50createChangedDocument = cancellationToken => AddExplicitImportingConstructorAsync(context.Document, diagnostic.Location.SourceSpan, cancellationToken); 55createChangedDocument = cancellationToken => MakeConstructorPublicAsync(context.Document, diagnostic.Location.SourceSpan, cancellationToken); 60createChangedDocument = cancellationToken => AddImportingConstructorAttributeAsync(context.Document, diagnostic.Location.SourceSpan, cancellationToken);
ImportingConstructorShouldBeObsoleteCodeFixProvider.cs (5)
47createChangedDocument = cancellationToken => AddObsoleteAttributeAsync(context.Document, diagnostic.Location.SourceSpan, cancellationToken); 52createChangedDocument = cancellationToken => AddDescriptionAndErrorAsync(context.Document, diagnostic.Location.SourceSpan, cancellationToken); 57createChangedDocument = cancellationToken => UpdateDescriptionAsync(context.Document, diagnostic.Location.SourceSpan, cancellationToken); 62createChangedDocument = cancellationToken => AddErrorAsync(context.Document, diagnostic.Location.SourceSpan, cancellationToken); 67createChangedDocument = cancellationToken => SetErrorToTrueAsync(context.Document, diagnostic.Location.SourceSpan, cancellationToken);
NamedTypeFullNameNotNullSuppressor.cs (1)
47var node = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
PartsExportedWithMEFv2MustBeMarkedAsShared.Fixer.cs (1)
46if (TryGetDeclaration(root!.FindNode(diagnostic.Location.SourceSpan), out var declaration))
RelaxTestNamingSuppressor.cs (1)
50var node = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\AnalysisContextExtensions.cs (2)
54=> location.SourceTree != null && context.ShouldAnalyzeSpan(location.SourceSpan, location.SourceTree); 74=> location.SourceTree != null && context.ShouldAnalyzeSpan(location.SourceSpan, location.SourceTree);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\LocationExtensions.cs (7)
19=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindToken(location.SourceSpan.Start); 22=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan); 25=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan, getInnermostNodeForTie: getInnermostNodeForTie); 28=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan, findInsideTrivia, getInnermostNodeForTie); 38return !(tree == null || tree.IsHiddenPosition(loc.SourceSpan.Start)); 44return loc1.SourceTree == loc2.SourceTree && loc1.SourceSpan.IntersectsWith(loc2.SourceSpan);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
55var node = root.FindNode(location.SourceSpan, getInnermostNodeForTie: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (2)
263WriteInteger(location.SourceSpan.Start); 264WriteInteger(location.SourceSpan.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\ForkingSyntaxEditorBasedCodeFixProvider.cs (1)
67diagnostic.AdditionalLocations[0].SourceSpan, getInnermostNodeForTie: true);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\SyntaxEditorBasedCodeFixProvider.cs (2)
43.Sort((d1, d2) => d1.Location.SourceSpan.Start - d2.Location.SourceSpan.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (2)
205var afterMember = declarationList.LastOrDefault(m => m.SpanStart <= info.Context.AfterThisLocation.SourceSpan.Start); 221var beforeMember = declarationList.FirstOrDefault(m => m.Span.End >= info.Context.BeforeThisLocation.SourceSpan.End);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\FindSymbols\LinkedFileReferenceLocationEqualityComparer.cs (3)
25return x.Location.SourceSpan == y.Location.SourceSpan; 29=> obj.Location.SourceSpan.GetHashCode();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.State.cs (1)
107let token = syntaxRoot.FindToken(r.Location.SourceSpan.Start)
TestExportsShouldNotBeDiscoverableCodeFixProvider.cs (1)
42cancellationToken => AddPartNotDiscoverableAttributeAsync(context.Document, diagnostic.Location.SourceSpan, cancellationToken),
Roslyn.Diagnostics.CSharp.Analyzers (8)
CSharpAvoidOptSuffixForNullableEnableCodeCodeFixProvider.cs (2)
38var variable = root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true); 54if (semanticModel.LookupSymbols(diagnostic.Location.SourceSpan.Start, variableSymbol.ContainingType, newName).IsEmpty)
CSharpDoNotUseDebugAssertForInterpolatedStringsFixer.cs (1)
59var syntax = root.FindNode(location.SourceSpan, getInnermostNodeForTie: true);
PreferNullLiteralCodeFixProvider.cs (1)
51var syntax = root.FindNode(location.SourceSpan, getInnermostNodeForTie: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Helpers\RemoveUnnecessaryImports\CSharpUnnecessaryImportsProvider.cs (1)
36root.FindNode(diagnostic.Location.SourceSpan) is UsingDirectiveSyntax node && predicate(node))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SemanticFacts\CSharpSemanticFacts.cs (2)
72if (symbol.Locations.Any(static (loc, location) => loc.SourceTree == location.SourceTree && loc.SourceSpan.Contains(location.SourceSpan), location))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationHelpers.cs (1)
206return contextTree?.GetRoot(cancellationToken).FindToken(contextLocation!.SourceSpan.Start).Parent;
System.Text.Json.SourceGeneration (1)
src\libraries\Common\src\SourceGenerators\DiagnosticInfo.cs (1)
34=> Location.Create(location.SourceTree?.FilePath ?? "", location.SourceSpan, location.GetLineSpan().Span);
System.Text.RegularExpressions.Generator (1)
RegexGenerator.Parser.cs (1)
255return Location.Create(location.SourceTree?.FilePath ?? string.Empty, location.SourceSpan, location.GetLineSpan().Span);
System.Windows.Forms.Analyzers.CodeFixes.CSharp (1)
System\Windows\Forms\CSharp\CodeFixes\AddDesignerSerializationVisibility\AddDesignerSerializationVisibilityCodeFixProvider.cs (1)
39TextSpan diagnosticSpan = diagnostic.Location.SourceSpan;
System.Windows.Forms.Analyzers.CodeFixes.VisualBasic (1)
AddDesignerSerializationVisibility\AddDesignerSerializationVisibilityCodeFixProvider.vb (1)
45Dim diagnosticSpan As TextSpan = diagnostic.Location.SourceSpan
Test.Utilities (12)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\AnalysisContextExtensions.cs (2)
54=> location.SourceTree != null && context.ShouldAnalyzeSpan(location.SourceSpan, location.SourceTree); 74=> location.SourceTree != null && context.ShouldAnalyzeSpan(location.SourceSpan, location.SourceTree);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\LocationExtensions.cs (7)
19=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindToken(location.SourceSpan.Start); 22=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan); 25=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan, getInnermostNodeForTie: getInnermostNodeForTie); 28=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan, findInsideTrivia, getInnermostNodeForTie); 38return !(tree == null || tree.IsHiddenPosition(loc.SourceSpan.Start)); 44return loc1.SourceTree == loc2.SourceTree && loc1.SourceSpan.IntersectsWith(loc2.SourceSpan);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
55var node = root.FindNode(location.SourceSpan, getInnermostNodeForTie: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (2)
263WriteInteger(location.SourceSpan.Start); 264WriteInteger(location.SourceSpan.Length);
Text.Analyzers (21)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\AnalysisContextExtensions.cs (2)
54=> location.SourceTree != null && context.ShouldAnalyzeSpan(location.SourceSpan, location.SourceTree); 74=> location.SourceTree != null && context.ShouldAnalyzeSpan(location.SourceSpan, location.SourceTree);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\LocationExtensions.cs (7)
19=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindToken(location.SourceSpan.Start); 22=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan); 25=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan, getInnermostNodeForTie: getInnermostNodeForTie); 28=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan, findInsideTrivia, getInnermostNodeForTie); 38return !(tree == null || tree.IsHiddenPosition(loc.SourceSpan.Start)); 44return loc1.SourceTree == loc2.SourceTree && loc1.SourceSpan.IntersectsWith(loc2.SourceSpan);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
55var node = root.FindNode(location.SourceSpan, getInnermostNodeForTie: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (2)
263WriteInteger(location.SourceSpan.Start); 264WriteInteger(location.SourceSpan.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\ForkingSyntaxEditorBasedCodeFixProvider.cs (1)
67diagnostic.AdditionalLocations[0].SourceSpan, getInnermostNodeForTie: true);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\SyntaxEditorBasedCodeFixProvider.cs (2)
43.Sort((d1, d2) => d1.Location.SourceSpan.Start - d2.Location.SourceSpan.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (2)
205var afterMember = declarationList.LastOrDefault(m => m.SpanStart <= info.Context.AfterThisLocation.SourceSpan.Start); 221var beforeMember = declarationList.FirstOrDefault(m => m.Span.End >= info.Context.BeforeThisLocation.SourceSpan.End);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\FindSymbols\LinkedFileReferenceLocationEqualityComparer.cs (3)
25return x.Location.SourceSpan == y.Location.SourceSpan; 29=> obj.Location.SourceSpan.GetHashCode();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.State.cs (1)
107let token = syntaxRoot.FindToken(r.Location.SourceSpan.Start)