6 implementations of Locations
Microsoft.CodeAnalysis.CodeStyle.Fixes (1)
CodeGenerationSymbol.cs (1)
140public ImmutableArray<Location> Locations
Microsoft.CodeAnalysis.CSharp (2)
Symbols\PublicModel\PreprocessingSymbol.cs (1)
60ImmutableArray<Location> ISymbol.Locations => ImmutableArray<Location>.Empty;
Symbols\PublicModel\Symbol.cs (1)
104ImmutableArray<Location> ISymbol.Locations
Microsoft.CodeAnalysis.Features (1)
MetadataAsSource\AbstractMetadataAsSourceService.AbstractWrappedSymbol.cs (1)
65public ImmutableArray<Location> Locations => _symbol.Locations;
Microsoft.CodeAnalysis.VisualBasic (1)
Symbols\Symbol.vb (1)
1234Private ReadOnly Property ISymbol_Locations As ImmutableArray(Of Location) Implements ISymbol.Locations, ISymbolInternal.Locations
Microsoft.CodeAnalysis.Workspaces (1)
CodeGenerationSymbol.cs (1)
140public ImmutableArray<Location> Locations
533 references to Locations
Microsoft.CodeAnalysis (5)
Compilation\IImportScope.cs (1)
13/// location can be found using either <see cref="ISymbol.Locations"/> or <see
DiagnosticAnalyzer\AnalyzerExecutor.cs (1)
1474foreach (var location in symbol.Locations)
DiagnosticAnalyzer\CompilationWithAnalyzers.cs (2)
861foreach (var location in symbolDeclaredEvent.Symbol.Locations) 1041foreach (var location in symbolDeclaredCompilationEvent.Symbol.Locations)
Symbols\ISymbolExtensions.cs (1)
109foreach (var location in symbol.Locations)
Microsoft.CodeAnalysis.CodeStyle (31)
AbstractMakeFieldReadonlyDiagnosticAnalyzer.cs (3)
122field.Locations[0], 139Locations.Length: 1, 262=> options.GetAnalyzerOptions(field.Locations[0].SourceTree!).PreferReadonly;
AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (1)
774var isPartial = symbol.Locations.Length > 1;
AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (3)
474member.Locations[0], 525foreach (var tree in namedTypeSymbol.Locations.Select(l => l.SourceTree)) 539foreach (var root in namedTypeSymbol.Locations.Select(l => l.SourceTree.GetRoot(cancellationToken)))
AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.cs (1)
140var location = parameter.Locations[0];
HashCodeAnalyzer.cs (2)
67if (method.Locations.Length != 1 || method.DeclaringSyntaxReferences.Length != 1) 70if (!method.Locations[0].IsInSource)
ISymbolExtensions.cs (2)
555=> symbol.Locations.Any() && symbol.Locations.All(location => location.IsInSource);
NamingStyleDiagnosticAnalyzerBase.cs (2)
131var sourceTree = symbol.Locations.FirstOrDefault()?.SourceTree; 168return DiagnosticHelper.Create(Descriptor, symbol.Locations.First(), applicableRule.EnforcementLevel, additionalLocations: null, builder.ToImmutable(), failureReason);
SymbolEquivalenceComparer.EquivalenceVisitor.cs (4)
275return x.Locations.Length == 1 && y.Locations.Length == 1 && 276x.Locations.First().Equals(y.Locations.First());
SymbolEquivalenceComparer.GetHashCodeVisitor.cs (4)
103Hash.Combine(x.Locations.FirstOrDefault(), currentHash)); 107=> Hash.Combine(x.Locations.FirstOrDefault(), currentHash); 117return Hash.Combine(x.Locations.FirstOrDefault(), currentHash); 293=> Hash.Combine(x.Locations.FirstOrDefault(), currentHash);
SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
32visitor.WriteLocation(symbol.Locations.First());
SymbolKey.AnonymousTypeSymbolKey.cs (1)
26var propertyLocations = properties.SelectAsArray(p => p.Locations.FirstOrDefault());
SymbolKey.BodyLevelSymbolKey.cs (3)
23Contract.ThrowIfTrue(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty); 27foreach (var location in symbol.Locations) 62Contract.ThrowIfTrue(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty);
SymbolKey.SymbolKeyReader.cs (1)
722var location = module.Locations.FirstOrDefault();
SymbolKey.TupleTypeSymbolKey.cs (1)
32locations.Add(element.Locations.FirstOrDefault() ?? Location.None);
SymbolKey.TypeParameterSymbolKey.cs (1)
20visitor.WriteLocation(symbol.Locations[0]);
UseSystemHashCodeDiagnosticAnalyzer.cs (1)
77owningSymbol.Locations[0],
Microsoft.CodeAnalysis.CodeStyle.Fixes (2)
AddParameterService.cs (2)
95=> solution.GetRequiredDocument(declarationLocation.Locations[0].SourceTree!)); 111var methodNode = syntaxRoot.FindNode(methodDeclaration.Locations[0].SourceSpan, getInnermostNodeForTie: true);
Microsoft.CodeAnalysis.CSharp (2)
SymbolDisplay\SymbolDisplayVisitor_Minimal.cs (2)
223if (this.IsMinimizing && !symbol.Locations.IsEmpty) 225var location = symbol.Locations.First();
Microsoft.CodeAnalysis.CSharp.CodeStyle (3)
CSharpMakeStructFieldsWritableDiagnosticAnalyzer.cs (1)
108_namedTypeSymbol.Locations[0]);
CSharpSemanticFacts.cs (2)
69if (symbol.Locations.Any(static (loc, location) => loc.SourceTree == location.SourceTree && loc.SourceSpan.Contains(location.SourceSpan), location)) 75if (symbol.Locations.Contains(location))
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (2)
CSharpDeclareAsNullableCodeFixProvider.cs (1)
213else if (symbol is IFieldSymbol { CorrespondingTupleField: IFieldSymbol { Locations: [{ IsInSource: true } location] } })
CSharpMakeMethodAsynchronousCodeFixProvider.cs (1)
167=> method.Locations.Any(static (loc, cancellationToken) => loc.FindNode(cancellationToken).ContainsYield(), cancellationToken);
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (1)
CommandLineTests.cs (1)
14669symbolContext.ReportDiagnostic(Diagnostic.Create(Warning01, symbolContext.Symbol.Locations.First()));
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (5)
Diagnostics\DiagnosticAnalyzerDriver\DiagnosticAnalyzerDriverTests.cs (1)
880var diagnostic = Diagnostic.Create(descriptor, context.Symbol.Locations[0]);
Diagnostics\Suppression\RemoveUnnecessaryPragmaSuppressionsTests.cs (2)
106context.ReportDiagnostic(Diagnostic.Create(rule, local.Locations[0])); 1310var diagnostic = Diagnostic.Create(Descriptor, context.Symbol.ContainingNamespace.Locations[0]);
Squiggles\ErrorSquiggleProducerTests.cs (2)
431if (!context.Symbol.IsImplicitlyDeclared && context.Symbol.Locations.First().IsInSource) 433context.ReportDiagnostic(Diagnostic.Create(Rule, context.Symbol.Locations.First()));
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (19)
CodeGen\CodeGenTupleTest.cs (19)
5878Assert.All(tupleWithoutNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()), 5915Assert.Equal(loc1, tuple.GetMembers("i1").Single().Locations.Single()); 5916Assert.Equal(loc2, tuple.GetMembers("i2").Single().Locations.Single()); 5955Assert.All(tupleWithoutNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()), 5974Assert.All(tupleWithNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()), 5993Assert.All(tupleWithSomeNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()), 6011Assert.All(tupleWithNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()), 6036Assert.All(tuple8WithoutNames.TupleElements.Select(f => f.Locations.FirstOrDefault()), 6063Assert.All(tuple8WithoutNames.GetMembers().OfType<IFieldSymbol>().Where(f => f.Name != "Rest").Select(f => f.Locations.FirstOrDefault()), 6088Assert.All(tuple8WithNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()), 6113Assert.All(tuple9WithoutNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()), 6139Assert.All(tuple9WithNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()), 6171Assert.All(tuple9WithNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()), 6195Assert.All(tupleWithoutNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()), 6369Assert.True(tupleWithoutNames.GetMembers("Item1").Single().Locations.IsEmpty); 6394Assert.Equal(loc1, tuple.GetMembers("Item1").Single().Locations.Single()); 6395Assert.Equal(loc2, tuple.GetMembers("Item2").Single().Locations.Single()); 17382Assert.Equal(nc.Name.GetLocation(), sym.Symbol.Locations[0]); 17417Assert.Equal(secondElement.GetLocation(), bobField.Locations[0]);
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (2)
Diagnostics\DiagnosticAnalyzerTests.cs (2)
271var diag1 = CodeAnalysis.Diagnostic.Create(s_descriptor, context.Symbol.Locations[0], "NamedType"); 840ctxt.ReportDiagnostic(CodeAnalysis.Diagnostic.Create(Descriptor1, method.Locations[0], method.ToDisplayString()));
Microsoft.CodeAnalysis.CSharp.Features (6)
CSharpDeclareAsNullableCodeFixProvider.cs (1)
213else if (symbol is IFieldSymbol { CorrespondingTupleField: IFieldSymbol { Locations: [{ IsInSource: true } location] } })
CSharpMakeMethodAsynchronousCodeFixProvider.cs (1)
167=> method.Locations.Any(static (loc, cancellationToken) => loc.FindNode(cancellationToken).ContainsYield(), cancellationToken);
CSharpMakeStructFieldsWritableDiagnosticAnalyzer.cs (1)
108_namedTypeSymbol.Locations[0]);
Debugging\BreakpointResolver.cs (1)
40var location = method.Locations.First(loc => loc.IsInSource);
Debugging\CSharpProximityExpressionsService.cs (1)
74var statement = info.Symbol.Locations.First().FindToken(cancellationToken).GetAncestor<StatementSyntax>();
GoToDefinition\CSharpGoToDefinitionSymbolService.cs (1)
67return symbol.Locations.FirstOrNone().SourceSpan.Start;
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (3)
Semantics\OperatorTests.cs (2)
7656Assert.Equal(0, symbol1.Locations.Length); 8451Assert.Equal(0, symbol1.Locations.Length);
SourceGeneration\GeneratorDriverTests.cs (1)
141Assert.True(generatedClass.Locations.Single().IsInSource);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (49)
Compilation\CompilationAPITests.cs (5)
2614Assert.All(type.GetMembers().OfType<IPropertySymbol>().Select(p => p.Locations.FirstOrDefault()), 2634Assert.Equal(loc1, type.GetMembers("m1").Single().Locations.Single()); 2635Assert.Equal(loc2, type.GetMembers("m2").Single().Locations.Single()); 2650Assert.All(type.GetMembers().OfType<IPropertySymbol>().Select(p => p.Locations.FirstOrDefault()), 3451Assert.Equal(2, types[0].Locations.Length);
Compilation\SemanticModelAPITests.cs (10)
878Assert.Equal(2, ptSym01.Locations.Length); 905Assert.Equal(1, ppSym01.Locations.Length); 906Assert.Equal(1, ppSym02.Locations.Length); 975Assert.NotEqual(sym1.Locations[0], sym2.Locations[0]); 1016Assert.NotEqual(sym1.Locations[0], sym2.Locations[0]); 1198var ploc = parasym.Locations[0]; 1207Assert.Equal(ploc, argsym1.Locations[0]); 1208Assert.Equal(ploc, argsym2.Locations[0]);
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (16)
3743Assert.Equal(3, declSymbol.Locations.Length); 3903Assert.Equal(param.Identifier.Span, symbol.Locations[0].SourceSpan); 3934Assert.NotEqual(alias1.Locations.Single(), alias2.Locations.Single()); 4804Assert.True(type.Locations.Single().IsInSource); 4827Assert.True(type.Locations.Single().IsInSource); 4850Assert.True(type.Locations.Single().IsInSource); 4873Assert.True(type.Locations.Single().IsInSource); 4896Assert.True(type.Locations.Single().IsInSource); 4919Assert.True(element.Locations.Single().IsInSource); 4942Assert.True(element.Locations.Single().IsInSource); 4965Assert.True(element.Locations.Single().IsInSource); 5000Assert.True(element.Locations.Single().IsInSource); 5046Assert.True(element.Locations.Single().IsInSource); 5095Assert.True(element.Locations.Single().IsInSource); 5118Assert.True(element.Locations.Single().IsInSource);
Symbols\AnonymousTypesSemanticsTests.cs (4)
1907Assert.Equal(1, type.Locations.Length); 1908Assert.Equal(typeSpan, type.Locations[0].SourceSpan); 1936Assert.Equal(1, property.Locations.Length); 1937Assert.Equal(span, property.Locations[0].SourceSpan);
Symbols\AnonymousTypesSymbolTests.cs (8)
1645Assert.False(sym.Symbol.Locations.IsEmpty, "Symbol Location"); 1646Assert.True(sym.Symbol.Locations[0].IsInSource); 1654Assert.False(m.Locations.IsEmpty, String.Format("No Location: {0}", m)); 1655Assert.True(m.Locations[0].IsInSource); 1698Assert.NotEqual(typeA3.Locations[0], typeA4.Locations[0]); 1702Assert.True(statement1.Span.Contains(typeA3.Locations[0].SourceSpan)); 1703Assert.True(statement2.Span.Contains(typeA4.Locations[0].SourceSpan));
Symbols\CompilationCreationTests.cs (2)
60Assert.Equal(Math.Sign(compilation.CompareSourceLocations(types[i].Locations[0], types[j].Locations[0])), Math.Sign(i.CompareTo(j)));
Symbols\Source\DeclaringSyntaxNodeTests.cs (4)
349Assert.Equal(1, localType.Locations.Length); 350Assert.Equal(localType.Locations[0], anonObjectCreation.NewKeyword.GetLocation()); 382Assert.Equal(1, member.Locations.Length); 383Assert.Equal(member.Locations[0], propertyInitializer.NameEquals.Name.GetLocation());
Microsoft.CodeAnalysis.CSharp.Workspaces (10)
CSharpSemanticFacts.cs (2)
69if (symbol.Locations.Any(static (loc, location) => loc.SourceTree == location.SourceTree && loc.SourceSpan.Contains(location.SourceSpan), location)) 75if (symbol.Locations.Contains(location))
Rename\CSharpRenameRewriterLanguageService.cs (8)
146_renamableDeclarationLocation = _renamedSymbol.Locations.FirstOrDefault(loc => loc.IsInSource && loc.SourceTree == _semanticModel.SyntaxTree); 820var token = renamedSymbol.Locations.Single().FindToken(cancellationToken); 835token = matchingParameterSymbol.Locations.Single().FindToken(cancellationToken); 844var token = renamedSymbol.Locations.Single().FindToken(cancellationToken); 873var location = renamedSymbol.Locations.Single(); 903foreach (var location in renamedSymbol.Locations) 921.SelectMany(t => t.Locations); 972foreach (var location in symbol.Locations)
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (5)
CodeGeneration\SymbolEditorTests.cs (5)
356var location = symbol.Locations.Last(); 393var location = symbol.Locations.First(); 434var location = symbol.Locations.Last(); 480var location = symbol.Locations.Last(); 487var newLocation = newSymbol.Locations.Last();
Microsoft.CodeAnalysis.EditorFeatures (4)
GoToDefinition\AbstractGoToDefinitionService.cs (1)
100var sourceLocations = symbol.Locations.WhereAsArray(loc => loc.IsInSource);
InlineRename\AbstractEditorInlineRenameService.SymbolRenameInfo.cs (2)
164if (RenameSymbol.Locations.Length > 1) 172var symbolSourceDocument = this.Document.Project.Solution.GetDocument(RenameSymbol.Locations.Single().SourceTree);
RenameTracking\RenameTrackingTaggerProvider.TrackingSession.cs (1)
245return sourceSymbol.Locations.Any(static (loc, token) => loc == token.GetLocation(), token)
Microsoft.CodeAnalysis.EditorFeatures.Cocoa (1)
NavigationCommandHandlers\FindExtensionMethodsCommandHandler.cs (1)
107var loc = extMethod.Locations.First();
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (6)
Diagnostics\DiagnosticAnalyzerServiceTests.cs (1)
1395c.ReportDiagnostic(Diagnostic.Create(_supportedDiagnostics[0], c.Symbol.Locations[0]));
MetadataAsSource\AbstractMetadataAsSourceTests.cs (1)
113Assert.False(generatedSymbol.Locations.Where(loc => loc.IsInSource).IsEmpty());
SymbolFinder\DependentTypeFinderTests.cs (4)
583Assert.True(delegates.Any(i => i.Locations.Any(loc => loc.IsInMetadata)), "We should find a metadata delegate"); 584Assert.Single(delegates.Where(i => i.Locations.Any(loc => loc.IsInSource))); // We should find a single source delegate 613Assert.True(enums.Any(i => i.Locations.Any(loc => loc.IsInMetadata)), "We should find a metadata enum"); 614Assert.Single(enums.Where(i => i.Locations.Any(loc => loc.IsInSource))); // We should find a single source type
Microsoft.CodeAnalysis.EditorFeatures.Wpf (2)
Peek\DefinitionPeekableItem.cs (1)
84var sourceLocations = symbol.Locations.Where(l => l.IsInSource).ToList();
Peek\PeekableItemFactory.cs (1)
86var firstLocation = symbol.Locations.FirstOrDefault();
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (25)
CodeFixes\CodeFixServiceTests.vb (2)
217context.ReportDiagnostic(Diagnostic.Create(DiagDescriptor, context.Symbol.Locations.First(), context.Symbol.Locations.Skip(1)))
Diagnostics\AdditionalFileDiagnosticsTests.vb (1)
99context.ReportDiagnostic(Diagnostic.Create(Rule, context.Symbol.Locations.First()))
Diagnostics\DiagnosticServiceTests.vb (7)
1293Dim sourceLoc = context.Symbol.Locations.First(Function(l) l.IsInSource) 1494Dim diag = Diagnostic.Create(Descriptor, symbolContext.Symbol.Locations(0), additionalFileText) 1581context.ReportDiagnostic(Diagnostic.Create(DiagDescriptor, context.Symbol.Locations.First(), context.Symbol.Locations.Skip(1))) 1607For Each location In context.Symbol.Locations 1636sc.ReportDiagnostic(Diagnostic.Create(DiagDescriptor, sc.Symbol.Locations.First())) 1920ctxt.ReportDiagnostic(Diagnostic.Create(Descriptor, method.Locations(0), method.ToDisplayString))
FindReferences\FindReferencesTests.LinkedFiles.vb (5)
267Dim documents = references.Select(Function(r) workspace.CurrentSolution.GetDocument(r.Definition.Locations.Single().SourceTree)) 307Dim sourceReferences = references.Where(Function(r) r.Definition.Locations(0).IsInSource).ToArray() 350Dim sourceReferences = references.Where(Function(r) r.Definition.Locations(0).IsInSource).ToArray() 393Dim sourceReferences = references.Where(Function(r) r.Definition.Locations(0).IsInSource).ToArray() 436Dim sourceReferences = references.Where(Function(r) r.Definition.Locations(0).IsInSource).ToArray()
Workspaces\TryFindSourceDefinitionTests.vb (10)
64Assert.True(fieldType.Locations.All(Function(Loc) Loc.IsInMetadata)) 70Assert.True(mappedType.Locations.All(Function(Loc) Loc.IsInSource)) 108Assert.True(fieldType.Locations.All(Function(Loc) Loc.IsInMetadata)) 114Assert.True(mappedType.Locations.All(Function(Loc) Loc.IsInSource)) 145Assert.True(member.Locations.All(Function(Loc) Loc.IsInMetadata)) 151Assert.True(mappedMember.Locations.All(Function(Loc) Loc.IsInSource)) 182Assert.True(member.Locations.All(Function(Loc) Loc.IsInMetadata)) 188Assert.True(mappedMember.Locations.All(Function(Loc) Loc.IsInSource)) 219Assert.True(member.Locations.All(Function(Loc) Loc.IsInMetadata)) 225Assert.True(mappedMember.Locations.All(Function(Loc) Loc.IsInSource))
Microsoft.CodeAnalysis.Features (88)
AbstractMakeFieldReadonlyDiagnosticAnalyzer.cs (3)
122field.Locations[0], 139Locations.Length: 1, 262=> options.GetAnalyzerOptions(field.Locations[0].SourceTree!).PreferReadonly;
AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (1)
774var isPartial = symbol.Locations.Length > 1;
AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (3)
474member.Locations[0], 525foreach (var tree in namedTypeSymbol.Locations.Select(l => l.SourceTree)) 539foreach (var root in namedTypeSymbol.Locations.Select(l => l.SourceTree.GetRoot(cancellationToken)))
AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.cs (1)
140var location = parameter.Locations[0];
AddParameterService.cs (2)
95=> solution.GetRequiredDocument(declarationLocation.Locations[0].SourceTree!)); 111var methodNode = syntaxRoot.FindNode(methodDeclaration.Locations[0].SourceSpan, getInnermostNodeForTie: true);
ChangeSignature\AbstractChangeSignatureService.cs (5)
149if (symbol.Locations.Any(static loc => loc.IsInMetadata)) 155var declarationLocation = symbol.Locations.FirstOrDefault(); 283if (symbol.Definition.Locations.Any(static loc => loc.IsInMetadata)) 336foreach (var def in symbolWithSyntacticParameters.Locations) 936.OrderByDescending(s => s.Locations.First().SourceSpan.Start);
CodeLens\CodeLensFindReferenceProgress.cs (4)
108var locations = symbol.Locations.Intersect(_queriedSymbol.Locations, LocationComparer.Instance).Any() 110: symbol.Locations; 137!definition.Locations.Any(static loc => loc.IsInSource);
CodeRefactorings\MoveType\AbstractMoveTypeService.State.cs (1)
63typeSymbol.Locations.Any(static loc => loc.IsInMetadata) ||
Debugging\AbstractBreakpointResolver.cs (2)
81var location = methodSymbol.Locations.First(loc => loc.IsInSource); 266if ((methodOrProperty.Language == _language) && methodOrProperty.Locations.Any(static location => location.IsInSource))
DocumentHighlighting\AbstractDocumentHighlightsService.cs (4)
214symbol.Locations.Length > 0) 218if (symbol.Locations.First().IsInSource) 221await AddLocationSpanAsync(symbol.Locations.First(), solution, spanSet, tagMap, HighlightSpanKind.Definition, cancellationToken).ConfigureAwait(false); 230foreach (var location in reference.Definition.Locations)
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (7)
5461errorSpan = newCaptures[reverseCapturesMap.IndexOf(i)].Locations.Single().SourceSpan; 5517=> member.Locations.First().SourceSpan; 5524return local.Locations.FirstOrDefault()?.SourceSpan ?? local.ContainingSymbol.Locations.First().SourceSpan; 5663newCapture.Locations.First().SourceSpan, 5712newCapture.Locations.First().SourceSpan, 5783span = newMember.Locations.First().SourceSpan;
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.UnitTestingSemanticChangeProcessor.cs (2)
172=> EnqueueWorkItemAsync(document, symbol.ContainingType != null ? symbol.ContainingType.Locations : symbol.Locations);
ExtractMethod\MethodExtractor.Analyzer.cs (1)
98var localFunctionCallsNotWithinSpan = symbolMap.Keys.Where(s => s.IsLocalFunction() && !s.Locations.Any(static (l, self) => self.SelectionResult.FinalSpan.Contains(l.SourceSpan), this));
ExtractMethod\MethodExtractor.VariableSymbol.cs (19)
157var leftLocations = left.Locations; 158var rightLocations = right.Locations; 212Contract.ThrowIfFalse(_localSymbol.Locations.Length == 1); 213Contract.ThrowIfFalse(other._localSymbol.Locations.Length == 1); 214Contract.ThrowIfFalse(_localSymbol.Locations[0].IsInSource); 215Contract.ThrowIfFalse(other._localSymbol.Locations[0].IsInSource); 216Contract.ThrowIfFalse(_localSymbol.Locations[0].SourceTree == other._localSymbol.Locations[0].SourceTree); 217Contract.ThrowIfFalse(_localSymbol.Locations[0].SourceSpan.Start != other._localSymbol.Locations[0].SourceSpan.Start); 219return _localSymbol.Locations[0].SourceSpan.Start - other._localSymbol.Locations[0].SourceSpan.Start; 234Contract.ThrowIfFalse(_localSymbol.Locations.Length == 1); 235Contract.ThrowIfFalse(_localSymbol.Locations[0].IsInSource); 236Contract.ThrowIfNull(_localSymbol.Locations[0].SourceTree); 238var tree = _localSymbol.Locations[0].SourceTree; 239var span = _localSymbol.Locations[0].SourceSpan; 323var locationLeft = _symbol.Locations.First(); 324var locationRight = other._symbol.Locations.First();
FindUsages\AbstractFindUsagesService_FindImplementations.cs (1)
126foreach (var location in implementation.Locations)
FindUsages\IDefinitionsAndReferencesFactory.cs (3)
69=> ToNonClassifiedDefinitionItem(definition, definition.Locations, solution, options, isPrimary: false, includeHiddenLocations); 89var unclassifiedSpans = TryGetSourceLocations(definition, solution, definition.Locations, includeHiddenLocations); 101var allLocations = group.Symbols.SelectMany(s => s.Locations).ToImmutableArray();
GenerateMember\AbstractGenerateMemberService.cs (1)
51var locations = typeToGenerateIn.Locations;
GenerateMember\GenerateVariable\AbstractGenerateVariableService.State.cs (2)
360AfterThisLocation ??= previousAssignedSymbol?.Locations.FirstOrDefault(); 361BeforeThisLocation ??= nextAssignedSymbol?.Locations.FirstOrDefault();
GenerateType\AbstractGenerateTypeService.State.cs (2)
303!symbol.Locations.Any(static loc => loc.IsInSource)) 309var sourceTreeToBeGeneratedIn = symbol.Locations.First(loc => loc.IsInSource).SourceTree;
GoToBase\AbstractGoToBaseService.cs (1)
76else if (baseSymbol.Locations.Any(static l => l.IsInMetadata))
HashCodeAnalyzer.cs (2)
67if (method.Locations.Length != 1 || method.DeclaringSyntaxReferences.Length != 1) 70if (!method.Locations[0].IsInSource)
InheritanceMargin\AbstractInheritanceMarginService_Helpers.cs (4)
299var derivedSymbols = allDerivedSymbols.WhereAsArray(symbol => symbol.Locations.Any(static l => l.IsInSource)); 344var implementingSymbols = allImplementingSymbols.WhereAsArray(symbol => symbol.Locations.Any(static l => l.IsInSource)); 370var overridingSymbols = allOverridingSymbols.WhereAsArray(symbol => symbol.Locations.Any(static l => l.IsInSource)); 702var locations = symbol.Locations;
MetadataAsSource\AbstractMetadataAsSourceService.AbstractWrappedSymbol.cs (1)
65public ImmutableArray<Location> Locations => _symbol.Locations;
MetadataAsSource\MetadataAsSourceFileService.cs (1)
314if (!symbol.Locations.Any(static l => l.IsInMetadata))
MetadataAsSource\MetadataAsSourceHelpers.cs (1)
85foreach (var location in symbol.Locations)
MoveStaticMembers\MoveStaticMembersWithDialogCodeAction.cs (1)
69.Select(symbol => symbol.Locations.FirstOrDefault())
NamingStyleDiagnosticAnalyzerBase.cs (2)
131var sourceTree = symbol.Locations.FirstOrDefault()?.SourceTree; 168return DiagnosticHelper.Create(Descriptor, symbol.Locations.First(), applicableRule.EnforcementLevel, additionalLocations: null, builder.ToImmutable(), failureReason);
Navigation\NavigableItemFactory.cs (1)
58var locations = symbol.Locations;
NavigationBar\AbstractNavigationBarItemService.cs (2)
67var navigationLocationSpan = symbol.Locations.FirstOrDefault(loc => loc.SourceTree == tree)?.SourceSpan ?? 79var navigationLocation = symbol.Locations.FirstOrDefault(loc => loc.SourceTree != null && loc.SourceTree != tree) ??
PullMemberUp\MemberAndDestinationValidator.cs (1)
25destination.Locations.Any(static (location, arg) => location.IsInSource && !arg.solution.GetRequiredDocument(location.SourceTree).IsGeneratedCode(arg.cancellationToken), (solution, cancellationToken));
Rename\SymbolicRenameInfo.cs (1)
209var symbolLocations = symbol.Locations;
ReplaceMethodWithProperty\AbstractReplaceMethodWithPropertyService.cs (1)
35if (current.Locations.Any(static loc => loc.IsInMetadata))
Shared\Utilities\AnnotatedSymbolMapping.cs (1)
77var location = symbol.Locations.Single();
SolutionCrawler\WorkCoordinator.SemanticChangeProcessor.cs (2)
171=> EnqueueWorkItemAsync(document, symbol.ContainingType != null ? symbol.ContainingType.Locations : symbol.Locations);
UseSystemHashCodeDiagnosticAnalyzer.cs (1)
77owningSymbol.Locations[0],
ValueTracking\ValueTracker.cs (1)
287foreach (var definitionLocation in symbol.Locations)
Microsoft.CodeAnalysis.LanguageServer.Protocol (1)
Handler\References\FindUsagesLSPContext.cs (1)
214if (symbol == null || symbol.Locations.IsEmpty || symbol.Kind == SymbolKind.Namespace)
Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator (2)
Generator.cs (1)
284else if (symbol.ContainingType != null && symbol.DeclaredAccessibility == Accessibility.Private && symbol.ContainingType.Locations.Length == 1)
ResultSetTracking\SymbolHoldingResultSetTracker.cs (1)
25/// we can't just use <see cref="ISymbol.Locations" /> to make the determination.
Microsoft.CodeAnalysis.Test.Utilities (29)
Diagnostics\CommonDiagnosticAnalyzers.cs (21)
524codeBlockContext.ReportDiagnostic(Diagnostic.Create(CodeBlockTopLevelRule, codeBlockContext.OwningSymbol.Locations[0], codeBlockContext.OwningSymbol.Name)); 533codeBlockContext.ReportDiagnostic(Diagnostic.Create(CodeBlockPerCompilationRule, codeBlockContext.OwningSymbol.Locations[0], codeBlockContext.OwningSymbol.Name)); 680context.ReportDiagnostic(Diagnostic.Create(Rule, context.Symbol.Locations[0])); 712context.ReportDiagnostic(Diagnostic.Create(Rule, ns.Locations[0])); 917symbolContext.ReportDiagnostic(Diagnostic.Create(Rule, symbolContext.Symbol.Locations[0])); 957symbolContext.ReportDiagnostic(Diagnostic.Create(Rule, symbolContext.Symbol.Locations[0], symbolContext.Symbol.Name)); 1067var diagnostic = Diagnostic.Create(Descriptor, symbolContext.Symbol.Locations[0], symbolContext.Symbol.Name); 1109var diagnostic = Diagnostic.Create(Descriptor, symbolContext.Symbol.Locations[0]); 1225blockStartContext.RegisterOperationBlockEndAction(c => ReportDiagnostic(c.ReportDiagnostic, c.OwningSymbol.Locations[0])); 1234ReportDiagnostic(blockContext.ReportDiagnostic, blockContext.OwningSymbol.Locations[0]); 1282var diagnostic = Diagnostic.Create(Descriptor, c.OwningSymbol.Locations[0], c.OwningSymbol.Name, operationRoot.Kind); 1550ReportDiagnosticsCore(addDiagnostic, symbol.Locations[0], symbol.Name); 1596var diagnostic = Diagnostic.Create(Rule, namedType.Locations[0], namedType.Name, namedTypes.Count); 1694foreach (var location in symbolContext.Symbol.Locations) 1704var diagnostic = Diagnostic.Create(descriptor, symbolContext.Symbol.Locations[0], symbolContext.Symbol.Name); 1754context.ReportDiagnostic(Diagnostic.Create(ParameterDescriptor, context.Symbol.Locations[0])); 2317=> reportDiagnostic(Diagnostic.Create(_rule, symbol.Locations[0], symbol.Name)); 2372context.ReportDiagnostic(Diagnostic.Create(Descriptor, context.Symbol.Locations[0])); 2399endContext => endContext.ReportDiagnostic(Diagnostic.Create(s_descriptor, context.OwningSymbol.Locations[0]))); 2439context => context.ReportDiagnostic(Diagnostic.Create(Descriptor, context.Symbol.Locations[0])), 2614context.RegisterSymbolAction(context => HandleCallback(context.Symbol.Locations[0], context.Compilation, context.ReportDiagnostic, context.CancellationToken), SymbolKind.NamedType);
Diagnostics\CouldHaveMoreSpecificTypeAnalyzer.cs (2)
295context.ReportDiagnostic(Diagnostic.Create(descriptor, local.Locations.FirstOrDefault(), local, moreSpecificType)); 300context.ReportDiagnostic(Diagnostic.Create(descriptor, field.Locations.FirstOrDefault(), field, moreSpecificType));
Diagnostics\FieldCouldBeReadOnlyAnalyzer.cs (1)
144context.ReportDiagnostic(Diagnostic.Create(descriptor, field.Locations.FirstOrDefault()));
Diagnostics\LocalCouldBeConstAnalyzer.cs (1)
135context.ReportDiagnostic(Diagnostic.Create(descriptor, local.Locations.FirstOrDefault()));
Diagnostics\SuppressMessageAttributeTests.DiagnosticAnalyzers.cs (4)
69context.ReportDiagnostic(CodeAnalysis.Diagnostic.Create(s_rule, context.Symbol.Locations.First(), messageArgs: context.Symbol.Name)); 100context.ReportDiagnostic(CodeAnalysis.Diagnostic.Create(s_rule, context.Symbol.Locations.First(), messageArgs: context.Symbol.Name)); 154context.ReportDiagnostic(CodeAnalysis.Diagnostic.Create(s_rule, context.OwningSymbol.Locations.First(), messageArgs: context.OwningSymbol.Name + ":end")); 173context.ReportDiagnostic(CodeAnalysis.Diagnostic.Create(s_rule, context.OwningSymbol.Locations.First(), messageArgs: context.OwningSymbol.Name + ":end"));
Microsoft.CodeAnalysis.UnitTests (1)
Diagnostics\SuppressMessageTargetSymbolResolverTests.cs (1)
1403where candidate != null && candidate.Locations.Contains(location)
Microsoft.CodeAnalysis.VisualBasic (1)
Symbols\Symbol.vb (1)
1234Private ReadOnly Property ISymbol_Locations As ImmutableArray(Of Location) Implements ISymbol.Locations, ISymbolInternal.Locations
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (1)
VisualBasicSemanticFacts.vb (1)
76If symbol.Locations.Contains(location) Then
Microsoft.CodeAnalysis.VisualBasic.CommandLine.UnitTests (2)
CommandLineTests.vb (2)
10679context.ReportDiagnostic(Diagnostic.Create(Warning01, context.Symbol.Locations.First())) 10680context.ReportDiagnostic(Diagnostic.Create(Warning03, context.Symbol.Locations.First()))
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (16)
CodeGen\CodeGenTuples.vb (16)
6899Assert.All(tupleWithoutNames.GetMembers().OfType(Of IFieldSymbol)().Select(Function(f) f.Locations.FirstOrDefault()), 6932Assert.Equal(loc1, tuple.GetMembers("i1").Single.Locations.Single()) 6933Assert.Equal(loc2, tuple.GetMembers("i2").Single.Locations.Single()) 6952Assert.All(tupleWithoutNames.GetMembers().OfType(Of IFieldSymbol)().Select(Function(f) f.Locations.FirstOrDefault()), 6972Assert.All(tupleWithoutNames.GetMembers().OfType(Of IFieldSymbol)().Select(Function(f) f.Locations.FirstOrDefault()), 6993Assert.All(tupleWithSomeNames.GetMembers().OfType(Of IFieldSymbol)().Select(Function(f) f.Locations.FirstOrDefault()), 7011Assert.All(tupleWithoutNames.GetMembers().OfType(Of IFieldSymbol)().Select(Function(f) f.Locations.FirstOrDefault()), 7036Assert.All(tuple8WithoutNames.GetMembers().OfType(Of IFieldSymbol)().Select(Function(f) f.Locations.FirstOrDefault()), 7061Assert.All(tuple8WithNames.GetMembers().OfType(Of IFieldSymbol)().Select(Function(f) f.Locations.FirstOrDefault()), 7086Assert.All(tuple9WithoutNames.GetMembers().OfType(Of IFieldSymbol)().Select(Function(f) f.Locations.FirstOrDefault()), 7111Assert.All(tuple9WithNames.GetMembers().OfType(Of IFieldSymbol)().Select(Function(f) f.Locations.FirstOrDefault()), 7136Assert.All(tuple9WithNames.GetMembers().OfType(Of IFieldSymbol)().Select(Function(f) f.Locations.FirstOrDefault()), 7160Assert.All(tupleWithoutNames.GetMembers().OfType(Of IFieldSymbol)().Select(Function(f) f.Locations.FirstOrDefault()), 7283Assert.Equal(loc1, tuple.GetMembers("i1").Single().Locations.Single()) 7284Assert.Equal(loc2, tuple.GetMembers("i2").Single().Locations.Single()) 9042Assert.Equal(nc.Name.GetLocation(), sym.Symbol.Locations(0)) ' Incorrect location
Microsoft.CodeAnalysis.VisualBasic.Features (8)
AddImport\VisualBasicAddImportFeatureService.vb (1)
275Return symbol IsNot Nothing AndAlso symbol.Locations.Length > 0
Debugging\BreakpointResolver.vb (1)
30Dim location = method.Locations.First(Function(loc) loc.IsInSource)
Debugging\ProximityExpressionsGetter.vb (1)
82Dim statement = info.Symbol.Locations.First().FindToken(cancellationToken).GetAncestor(Of StatementSyntax)()
ExtractMethod\VisualBasicSelectionValidator.vb (4)
284symbol.Locations.Length <> 1 OrElse 285Not symbol.Locations.First().IsInSource OrElse 286symbol.Locations.First().SourceTree IsNot semanticModel.SyntaxTree Then 294Dim startPosition = symbol.Locations.First().SourceSpan.Start
GoToDefinition\VisualBasicGoToDefinitionSymbolService.vb (1)
44Return Symbol.Locations.FirstOrNone().SourceSpan.Start
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (89)
Compilation\CompilationAPITests.vb (6)
1593Assert.All(type.GetMembers().OfType(Of IPropertySymbol)().Select(Function(p) p.Locations.FirstOrDefault()), 1614Assert.Equal(loc1, type.GetMembers("m1").Single().Locations.Single()) 1615Assert.Equal(loc2, type.GetMembers("m2").Single().Locations.Single()) 1640Assert.All(type.GetMembers().OfType(Of IPropertySymbol)().Select(Function(p) p.Locations.FirstOrDefault()), 1655Assert.All(type.GetMembers().OfType(Of IPropertySymbol)().Select(Function(p) p.Locations.FirstOrDefault()), 1669Assert.All(type.GetMembers().OfType(Of IPropertySymbol)().Select(Function(p) p.Locations.FirstOrDefault()),
Compilation\SemanticModelAPITests.vb (3)
196Dim ploc = parasym.Locations(0) 205Assert.Equal(ploc, argsym1.Locations(0)) 206Assert.Equal(ploc, argsym2.Locations(0))
Compilation\SemanticModelGetDeclaredSymbolAPITests.vb (49)
1258paramSymbol1.Locations.Single().SourceSpan.Start) 1266paramSymbol2.Locations.Single().SourceSpan.Start - "Optional ".Length) 1274paramSymbol3.Locations.Single().SourceSpan.Start) 1282paramSymbol4.Locations.Single().SourceSpan.Start) 1290paramSymbol5.Locations.Single().SourceSpan.Start) 1369Assert.Equal(syntax.SpanStart + 6, paramSymbol1.Locations.Single().SourceSpan.Start) 1374Assert.Equal(syntax.SpanStart + 6, paramSymbol2.Locations.Single().SourceSpan.Start) 1379Assert.Equal(syntax.SpanStart, paramSymbol3.Locations.Single().SourceSpan.Start) 1384Assert.Equal(syntax.SpanStart + 6, paramSymbol4.Locations.Single().SourceSpan.Start) 1848Assert.Equal(2, tpSymbol1.Locations.Length()) 1849Assert.True(syntax.SpanStart = tpSymbol1.Locations.Item(0).SourceSpan.Start OrElse 1850syntax.SpanStart = tpSymbol1.Locations.Item(1).SourceSpan.Start, 1857Assert.Equal(2, tpSymbol2.Locations.Length()) 1858Assert.True(syntax.SpanStart = tpSymbol2.Locations.Item(0).SourceSpan.Start OrElse 1859syntax.SpanStart = tpSymbol2.Locations.Item(1).SourceSpan.Start, 1866Assert.Equal(2, tpSymbol3.Locations.Length()) 1867Assert.True(syntax.SpanStart = tpSymbol3.Locations.Item(0).SourceSpan.Start OrElse 1868syntax.SpanStart = tpSymbol3.Locations.Item(1).SourceSpan.Start, 1875Assert.Equal(2, tpSymbol4.Locations.Length()) 1876Assert.True(syntax.SpanStart = tpSymbol4.Locations.Item(0).SourceSpan.Start OrElse 1877syntax.SpanStart = tpSymbol4.Locations.Item(1).SourceSpan.Start, 1884Assert.Equal(1, tpSymbol5.Locations.Length()) 1885Assert.Equal(syntax.SpanStart, tpSymbol5.Locations.Single().SourceSpan.Start) 2021Assert.Equal(1, varSymbol1.Locations.Length()) 2022Assert.True(syntax.SpanStart = varSymbol1.Locations.Item(0).SourceSpan.Start OrElse 2023syntax.SpanStart = varSymbol1.Locations.Item(1).SourceSpan.Start, 2031Assert.Equal(1, varSymbol2.Locations.Length()) 2032Assert.True(syntax.SpanStart = varSymbol2.Locations.Item(0).SourceSpan.Start OrElse 2033syntax.SpanStart = varSymbol2.Locations.Item(1).SourceSpan.Start, 2041Assert.Equal(1, varSymbol3.Locations.Length()) 2042Assert.True(syntax.SpanStart = varSymbol3.Locations.Item(0).SourceSpan.Start OrElse 2043syntax.SpanStart = varSymbol3.Locations.Item(1).SourceSpan.Start, 2051Assert.Equal(1, varSymbol4.Locations.Length()) 2052Assert.True(syntax.SpanStart = varSymbol4.Locations.Item(0).SourceSpan.Start OrElse 2053syntax.SpanStart = varSymbol4.Locations.Item(1).SourceSpan.Start, 2061Assert.Equal(1, varSymbol5.Locations.Length()) 2062Assert.True(syntax.SpanStart = varSymbol5.Locations.Item(0).SourceSpan.Start OrElse 2063syntax.SpanStart = varSymbol5.Locations.Item(1).SourceSpan.Start, 2071Assert.Equal(1, varSymbol6.Locations.Length()) 2072Assert.True(syntax.SpanStart = varSymbol6.Locations.Item(0).SourceSpan.Start OrElse 2073syntax.SpanStart = varSymbol6.Locations.Item(1).SourceSpan.Start, 2082Assert.Equal(1, varSymbol7.Locations.Length()) 2083Assert.True(syntax.SpanStart = varSymbol7.Locations.Item(0).SourceSpan.Start OrElse 2084syntax.SpanStart = varSymbol7.Locations.Item(1).SourceSpan.Start, 2092Assert.Equal(1, varSymbol8.Locations.Length()) 2093Assert.True(syntax.SpanStart = varSymbol8.Locations.Item(0).SourceSpan.Start OrElse 2094syntax.SpanStart = varSymbol8.Locations.Item(1).SourceSpan.Start, 2615Assert.Equal(3, nsSymbolA.Locations.Length) 2627Assert.Equal(nsSymbolA.Locations.Length, memSymbol.Locations.Length)
Diagnostics\DiagnosticAnalyzerTests.vb (2)
316Dim sourceLoc = context.Symbol.Locations.First(Function(l) l.IsInSource) 510Dim sourceLoc = context.Symbol.Locations.First(Function(l) l.IsInSource)
ExtensionMethods\SemanticModelTests.vb (2)
1473Assert.Equal(LocationKind.None, alias1.Locations.Single().Kind) 1478Assert.Equal(LocationKind.SourceFile, alias2.Locations.Single().Kind)
Semantics\GetExtendedSemanticInfoTests.vb (2)
8601Assert.NotEqual(alias1.Locations.Single(), alias2.Locations.Single())
Semantics\PartialMethodsTest.vb (25)
69Assert.Equal(2, ptSym01.Locations.Length) 82Assert.Equal(1, pmSym01.Locations.Length) 83Assert.Equal(1, pmSym02.Locations.Length) 92Assert.Equal(1, ppSym01.Locations.Length) 93Assert.Equal(1, ppSym02.Locations.Length) 149Assert.Equal(2, ptSym01.Locations.Length) 162Assert.Equal(1, pmSym01.Locations.Length) 163Assert.Equal(1, pmSym02.Locations.Length) 172Assert.Equal(1, ppSym01.Locations.Length) 173Assert.Equal(1, ppSym02.Locations.Length) 231Assert.Equal(2, ptSym01.Locations.Length) 244Assert.Equal(1, pmSym01.Locations.Length) 245Assert.Equal(1, pmSym02.Locations.Length) 254Assert.Equal(1, ppSym01.Locations.Length) 255Assert.Equal(1, ppSym02.Locations.Length) 387Assert.Equal(1, pmSym01.Locations.Length) 388Assert.Equal(1, pmSym02.Locations.Length) 1055Assert.NotEqual(paraSym1.Locations(0), paraSym2.Locations(0)) 1065Assert.NotEqual(typeParaSym1.Locations(0), typeParaSym2.Locations(0)) 1111Assert.NotEqual(paraSym1.Locations(0), paraSym2.Locations(0)) 1121Assert.NotEqual(typeParaSym1.Locations(0), typeParaSym2.Locations(0))
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (17)
CompilationAPITests.vb (1)
65Assert.Equal(2, types(0).Locations.Length)
DocumentationComments\DocCommentTests.vb (2)
4996Array.Sort(list, Function(x As ISymbol, y As ISymbol) compilation.CompareSourceLocations(x.Locations(0), y.Locations(0)))
SymbolsTests\AnonymousTypes\AnonymousTypesSemanticsTests.vb (12)
56Assert.Equal(1, info0.Type.Locations.Length) 57Assert.Equal(info0.Type.Locations(0).SourceSpan, tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 1).Span) 60Assert.Equal(1, info1.Type.Locations.Length) 61Assert.Equal(info1.Type.Locations(0).SourceSpan, tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 3).Span) 64Assert.Equal(1, info2.Type.Locations.Length) 65Assert.Equal(info2.Type.Locations(0).SourceSpan, tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 5).Span) 508Assert.Equal(1, info0.Type.Locations.Length) 509Assert.Equal(info0.Type.Locations(0).SourceSpan, tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 1).Span) 512Assert.Equal(1, info1.Type.Locations.Length) 513Assert.Equal(info1.Type.Locations(0).SourceSpan, tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 2).Span) 516Assert.Equal(1, info2.Type.Locations.Length) 517Assert.Equal(info2.Type.Locations(0).SourceSpan, tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 4).Span)
SymbolsTests\CompilationCreationTests.vb (2)
2229Assert.Equal(Math.Sign(compilation.CompareSourceLocations(types(i).Locations(0), types(j).Locations(0))), Math.Sign(i.CompareTo(j)))
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (2)
SemanticModelTestBase.vb (2)
90" Location1.SourceSpan.Start : " & tpSymbol.Locations.Item(0).SourceSpan.Start & 91" Location2.SourceSpan.Start : " & tpSymbol.Locations.Item(0).SourceSpan.Start
Microsoft.CodeAnalysis.VisualBasic.Workspaces (8)
Rename\VisualBasicRenameRewriterLanguageService.vb (7)
124_renamableDeclarationLocation = _renamedSymbol.Locations.Where(Function(loc) loc.IsInSource AndAlso loc.SourceTree Is _semanticModel.SyntaxTree).FirstOrDefault() 699Dim token = renamedSymbol.Locations.Single().FindToken(cancellationToken) 720token = matchingParameterSymbol.Locations.Single().FindToken(cancellationToken) 738conflicts.AddRange(renamedSymbol.ContainingSymbol.Locations _ 746Dim token = renamedSymbol.Locations.Single().FindToken(cancellationToken) 771For Each location In renamedSymbol.Locations 787.SelectMany(Function(t) t.Locations)
VisualBasicSemanticFacts.vb (1)
76If symbol.Locations.Contains(location) Then
Microsoft.CodeAnalysis.Workspaces (60)
FindSymbols\FindReferences\DependentTypeFinder.cs (3)
73var searchInMetadata = type.Locations.Any(s_isInMetadata); 363derivedType.Locations.Any(s_isInMetadata) && 378Debug.Assert(type.Locations.All(assert), message);
FindSymbols\FindReferences\Finders\AbstractMemberScopedReferenceFinder.cs (1)
34var location = symbol.Locations.FirstOrDefault();
FindSymbols\FindReferences\MetadataUnifyingEquivalenceComparer.cs (1)
51=> symbol.Locations.Any(static l => l.IsInSource);
FindSymbols\SymbolFinder.cs (2)
178else if (!symbol.Locations.Any(static loc => loc.IsInMetadata)) 206return symbol.Locations.Any(static loc => loc.IsInSource);
FindSymbols\SymbolFinder_Helpers.cs (1)
22if (symbol.Locations.Any(static l => l.IsInMetadata))
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.cs\ISymbolExtensions.cs (2)
555=> symbol.Locations.Any() && symbol.Locations.All(location => location.IsInSource);
ReassignedVariable\AbstractReassignedVariableService.cs (2)
185if (parameter.Locations.Length > 0) 187var parameterLocation = parameter.Locations[0];
Recommendations\AbstractRecommendationServiceRunner.cs (1)
305recommendationSymbol.Locations.Any(
Rename\ConflictEngine\ConflictResolver.cs (7)
102var renameSymbolDeclarationLocation = renameLocations.Symbol.Locations.Where(loc => loc.IsInSource).FirstOrDefault(); 174return conflictResolution.ReplacementTextValid && renamedSymbol != null && renamedSymbol.Locations.Any(static loc => loc.IsInSource); 331foreach (var newLocation in newSymbol.Locations) 356var locations = symbol.Locations; 366overriddenFromMetadata = overriddenSymbol == null || overriddenSymbol.Locations.All(loc => loc.IsInMetadata); 405var locations = symbol.Locations; 410locations = originalsourcesymbol.Locations;
Rename\ConflictEngine\ConflictResolver.Session.cs (3)
242var definitionLocations = _renameLocationSet.Symbol.Locations; 571if (conflictAnnotation.RenameDeclarationLocationReferences[symbolIndex].SymbolLocationsCount != symbol.Locations.Length) 609if (overriddenSymbol == null || !overriddenSymbol.Locations.All(loc => loc.IsInMetadata))
Rename\ConflictEngine\DeclarationConflictHelpers.cs (2)
63builder.AddRange(conflictingSymbol.Locations); 68builder.AddRange(conflictingSymbol.Locations);
Rename\IRenameRewriterLanguageService.cs (1)
148conflicts.AddRange(conflictingParameter.Locations);
Rename\RenameUtilities.cs (1)
91var documentsOfRenameSymbolDeclaration = symbol.Locations.Where(l => l.IsInSource).Select(l => solution.GetRequiredDocument(l.SourceTree!));
Rename\SymbolicRenameLocations.ReferenceProcessing.cs (8)
68referencedSymbol.Locations.Any(static loc => loc.IsInSource)) 171var location = originalSymbol.Locations.Single(); 177foreach (var location in referencedSymbol.Locations) 187if (referencedSymbol.Kind == SymbolKind.NamedType && referencedSymbol.Locations.All(l => l.IsInSource)) 189var firstLocation = referencedSymbol.Locations[0]; 200foreach (var location in method.Locations) 265var aliasLocation = location.Alias.Locations.Single(); 284var aliasLocation = location.Alias.Locations.Single();
Shared\Extensions\IFindReferencesResultExtensions.cs (4)
23? SpecializedCollections.SingletonEnumerable(definition.Locations.First()) 24: definition.Locations; 77if (definition.Locations.Any(static loc => loc.IsInSource)) 83definition.Locations.Any(static loc => loc.IsInMetadata))
Shared\Extensions\ISymbolExtensions.cs (2)
81if (symbol.Locations.All(loc => loc.IsInSource)) 663(s.IsNamespace() || s.Locations.Any(isSymbolDefinedInSource) || !s.HasUnsupportedMetadata) &&
Shared\Extensions\ITypeSymbolExtensions.cs (1)
163typeSymbol.Locations.Any(static location => location.IsInSource)) ||
SymbolEquivalenceComparer.EquivalenceVisitor.cs (4)
275return x.Locations.Length == 1 && y.Locations.Length == 1 && 276x.Locations.First().Equals(y.Locations.First());
SymbolEquivalenceComparer.GetHashCodeVisitor.cs (4)
103Hash.Combine(x.Locations.FirstOrDefault(), currentHash)); 107=> Hash.Combine(x.Locations.FirstOrDefault(), currentHash); 117return Hash.Combine(x.Locations.FirstOrDefault(), currentHash); 293=> Hash.Combine(x.Locations.FirstOrDefault(), currentHash);
SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
32visitor.WriteLocation(symbol.Locations.First());
SymbolKey.AnonymousTypeSymbolKey.cs (1)
26var propertyLocations = properties.SelectAsArray(p => p.Locations.FirstOrDefault());
SymbolKey.BodyLevelSymbolKey.cs (3)
23Contract.ThrowIfTrue(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty); 27foreach (var location in symbol.Locations) 62Contract.ThrowIfTrue(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty);
SymbolKey.SymbolKeyReader.cs (1)
722var location = module.Locations.FirstOrDefault();
SymbolKey.TupleTypeSymbolKey.cs (1)
32locations.Add(element.Locations.FirstOrDefault() ?? Location.None);
SymbolKey.TypeParameterSymbolKey.cs (1)
20visitor.WriteLocation(symbol.Locations[0]);
Workspace\Solution\SolutionState.SymbolToProjectId.cs (2)
37var syntaxTree = symbol.Locations[0].SourceTree; 137var tree = typeParameter.Locations[0].SourceTree;
Microsoft.CodeAnalysis.Workspaces.UnitTests (3)
FindReferencesTests.cs (1)
639foreach (var location in reference.Definition.Locations)
SymbolKeyTests.cs (2)
1362Assert.True(resolved.Symbol.Locations[0].SourceSpan.Start > symbol.Locations[0].SourceSpan.Start);
Microsoft.VisualStudio.LanguageServices (15)
Library\ObjectBrowser\AbstractListItemFactory.cs (5)
133|| symbol.Locations.Any(static l => l.IsInSource || l.IsInMetadata); 148if (symbol.Locations.Any(static l => l.IsInSource)) 153if (symbol.Locations.Any(static l => l.IsInMetadata)) 578if (typeMember.Locations.Any(static l => l.IsInSource)) 583if (typeMember.Locations.Any(static l => l.IsInMetadata))
MoveStaticMembers\VisualStudioMoveStaticMembersOptionsService.cs (1)
181return t.Locations
Progression\GraphBuilder.cs (4)
186var preferredLocation = symbol.Locations.FirstOrDefault(l => l.SourceTree != null); 193preferredLocation = symbol.Locations.FirstOrDefault(l => l.SourceTree == syntaxTree) ?? preferredLocation; 197if (preferredLocation == null && symbol.Locations.Any(static loc => loc.IsInMetadata)) 201preferredLocation = newSymbol.Locations.Where(loc => loc.IsInSource).FirstOrDefault();
Progression\GraphQueries\IsUsedByGraphQuery.cs (1)
34var allLocations = referencedSymbol.Locations.Concat(reference.Locations.Select(r => r.Location))
Venus\ContainedLanguageCodeSupport.cs (3)
211var position = type.Locations.First(loc => loc.SourceTree == targetSyntaxTree).SourceSpan.Start; 305? semanticModel.LookupSymbols(position: type.Locations[0].SourceSpan.Start, container: type, name: null) 496var typeLocation = type.Locations.FirstOrDefault(d => d.SourceTree == containingTree);
Workspace\VisualStudioSymbolNavigationService.cs (1)
69var sourceLocations = symbol.Locations.Where(loc => loc.IsInSource);
Microsoft.VisualStudio.LanguageServices.Implementation (5)
CodeModel\AbstractCodeModelService.cs (1)
592foreach (var location in typeSymbol.Locations)
CodeModel\Collections\ExternalNamespaceEnumerator.cs (1)
86if (namedType.Locations.Any(static l => l.IsInMetadata || l.IsInSource))
CodeModel\Collections\OverloadsCollection.cs (1)
71var location = method.Locations.FirstOrDefault(l => l.IsInSource);
CodeModel\Collections\PartialTypeCollection.cs (1)
55foreach (var location in symbol.Locations.Where(l => l.IsInSource))
RoslynVisualStudioWorkspace.cs (1)
136var sourceLocation = symbol.Locations.Where(l => l.IsInSource).FirstOrDefault();
Microsoft.VisualStudio.LanguageServices.VisualBasic (2)
Venus\ContainedLanguageStaticEventBinding.vb (2)
66Dim targetDocument = document.Project.Solution.GetDocument(memberSymbol.Locations.First().SourceTree) 94Dim targetDocument = document.Project.Solution.GetDocument(memberSymbol.Locations.First().SourceTree)