364 references to LookupSymbols
Microsoft.CodeAnalysis (4)
Compilation\SemanticModel.cs (3)
473/// Backing implementation of <see cref="LookupSymbols"/>. 483/// calling <see cref="LookupSymbols"/> with the container set to the immediate base type of 548/// Essentially the same as filtering instance members out of the results of an analogous <see cref="LookupSymbols"/> call.
SymbolDisplay\AbstractSymbolDisplayVisitor_Minimal.cs (1)
27: SemanticModelOpt.LookupSymbols(PositionOpt, name: symbol.Name);
Microsoft.CodeAnalysis.CodeStyle (2)
src\Analyzers\Core\Analyzers\UseCollectionInitializer\AbstractUseCollectionInitializerAnalyzer.cs (1)
191var addMethods = this.SemanticModel.LookupSymbols(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.cs (1)
599var potentialGetAwaiters = semanticModel.LookupSymbols(position,
Microsoft.CodeAnalysis.CodeStyle.Fixes (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\SemanticsFactsService\AbstractSemanticFactsService.cs (1)
92=> semanticModel.LookupSymbols(location.SpanStart).Concat(semanticModel.GetExistingSymbols(container, cancellationToken));
Microsoft.CodeAnalysis.CSharp.CodeStyle (3)
src\Analyzers\CSharp\Analyzers\UseDeconstruction\CSharpUseDeconstructionDiagnosticAnalyzer.cs (1)
207var reservedNames = semanticModel.LookupSymbols(container.SpanStart)
src\Analyzers\CSharp\Analyzers\UseNameofInNullableAttribute\CSharpUseNameofInNullableAttributeDiagnosticAnalyzer.cs (1)
102var symbols = semanticModel.LookupSymbols(argument.Expression.SpanStart, name: stringValue);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SemanticModelExtensions.cs (1)
125return semanticModel.LookupSymbols(expr.SpanStart, container: symbol, name: name, includeReducedExtensionMethods: true);
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSemanticFactsService.cs (1)
43var visibleSymbols = semanticModel.LookupSymbols(location.SpanStart);
Microsoft.CodeAnalysis.CSharp.EditorFeatures (1)
EventHookup\EventHookupSessionManager_EventHookupSession.cs (1)
228var reservedNames = semanticModel.LookupSymbols(plusEqualsToken.SpanStart).Select(m => m.Name);
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (7)
CodeGen\CodeGenDeconstructTests.cs (4)
3583Assert.Same(symbol, model.LookupSymbols(decl.SpanStart, name: decl.Identifier.ValueText).Single()); 3603Assert.Same(symbol, model.LookupSymbols(reference.SpanStart, name: decl.Identifier.ValueText).Single()); 3615Assert.Same(field, model.LookupSymbols(decl.SpanStart, name: decl.Identifier.ValueText).Single()); 3622Assert.Same(field, model.LookupSymbols(reference.SpanStart, name: decl.Identifier.ValueText).Single());
CodeGen\CodeGenTupleTest.cs (3)
12695var m1Tuple = model.LookupSymbols(node.SpanStart, name: "v1").OfType<ILocalSymbol>().Single().Type.GetSymbol<NamedTypeSymbol>(); 12696var m2Tuple = model.LookupSymbols(node.SpanStart, name: "v2").OfType<ILocalSymbol>().Single().Type.GetSymbol<NamedTypeSymbol>(); 12697var m6Tuple = model.LookupSymbols(node.SpanStart, name: "v6").OfType<ILocalSymbol>().Single().Type.GetSymbol<NamedTypeSymbol>();
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (74)
FirstClassSpanTests.cs (1)
4913var lookupResult = model.LookupSymbols(d1Access.Name.SpanStart, aSymbol.Type, "M", includeReducedExtensionMethods: true);
Semantics\OutVarTests.cs (7)
1156Assert.False(model.LookupSymbols(reference.SpanStart, name: reference.Identifier.ValueText).Any()); 1166Assert.Same(symbol, model.LookupSymbols(reference.SpanStart, name: reference.Identifier.ValueText).Single()); 1197Assert.Same(symbol, model.LookupSymbols(reference.SpanStart, name: reference.Identifier.ValueText).Single()); 9654Assert.Equal("System.Int64 y1", model.LookupSymbols(x1Ref[0].SpanStart, name: "y1").Single().ToTestDisplayString()); 10222Assert.Equal("System.Boolean y1", model.LookupSymbols(x1Ref[0].SpanStart, name: "y1").Single().ToTestDisplayString()); 21308var y1 = model.LookupSymbols(x1Ref[0].SpanStart, name: "y1").Single(); 22671Assert.False(model.LookupSymbols(reference.SpanStart, name: reference.Identifier.ValueText).Any());
Semantics\PatternMatchingTestBase.cs (12)
87var other = model.LookupSymbols(designation.SpanStart, name: designation.Identifier.ValueText).Single(); 126Assert.Same(symbol, model.LookupSymbols(reference.SpanStart, name: designation.Identifier.ValueText).Single()); 147Assert.NotEqual(symbol, model.LookupSymbols(designation.SpanStart, name: designation.Identifier.ValueText).Single()); 173Assert.NotEqual(symbol, model.LookupSymbols(declarator.SpanStart, name: declarator.Identifier.ValueText).Single()); 187Assert.NotEqual(symbol, model.LookupSymbols(designation.SpanStart, name: designation.Identifier.ValueText).Single()); 197Assert.Same(symbol, model.LookupSymbols(reference.SpanStart, name: reference.Identifier.ValueText).Single()); 210var other = model.LookupSymbols(reference.SpanStart, name: reference.Identifier.ValueText).Single(); 218Assert.False(model.LookupSymbols(reference.SpanStart, name: reference.Identifier.ValueText).Any()); 250var symbols = model.LookupSymbols(designation.SpanStart, name: designation.Identifier.ValueText); 302symbols = model.LookupSymbols(reference.SpanStart, name: designation.Identifier.ValueText); 368Assert.False(model.LookupSymbols(designation.SpanStart, name: identifierText).Any()); 411Assert.False(model.LookupSymbols(reference.SpanStart, name: reference.Identifier.ValueText).Any());
Semantics\PatternMatchingTests_Scope.cs (3)
6484Assert.Equal("System.Int64 y1", model.LookupSymbols(x1Ref[0].SpanStart, name: "y1").Single().ToTestDisplayString()); 6895Assert.Equal("System.Boolean y1", model.LookupSymbols(x1Ref[0].SpanStart, name: "y1").Single().ToTestDisplayString()); 12158var y1 = model.LookupSymbols(x1Ref[0].SpanStart, name: "y1").Single();
Semantics\PrimaryConstructorTests.cs (28)
1013Assert.Same(symbol, model.LookupSymbols(x.SpanStart, name: "X").Single()); 1081Assert.Contains(symbol, model.LookupSymbols(x.SpanStart, name: "X")); 1308Assert.Contains(symbol, model.LookupSymbols(x.SpanStart, name: "X")); 1321Assert.Contains(symbol, model.LookupSymbols(x.SpanStart, name: "y")); 1331Assert.Contains(symbol, model.LookupSymbols(x.SpanStart, name: "Test")); 1373Assert.Empty(model.LookupSymbols(x.SpanStart, name: "X")); 1419Assert.Empty(model.LookupSymbols(x.SpanStart, name: "X")); 1479Assert.Empty(model.LookupSymbols(x.SpanStart, name: "X")); 1537Assert.Contains(symbol, model.LookupSymbols(x.SpanStart, name: "X")); 1548Assert.Empty(model.LookupSymbols(x.SpanStart, name: "X")); 1626Assert.Contains(symbol, model.LookupSymbols(x.SpanStart, name: "X")); 1637Assert.Empty(model.LookupSymbols(x.SpanStart, name: "X")); 1822Assert.Empty(model.LookupSymbols(x.SpanStart, name: "X")); 1862Assert.Empty(model.LookupSymbols(x.SpanStart, name: "X")); 1903Assert.Equal("System.Int32 X", model.LookupSymbols(x.SpanStart, name: "X").Single().ToTestDisplayString()); 1975Assert.Contains(symbol, model.LookupSymbols(x.SpanStart, name: "X")); 2433Assert.Empty(model.LookupSymbols(x.SpanStart, name: "X")); 2649Assert.Contains(symbol, model.LookupSymbols(x.SpanStart, name: "X")); 2687Assert.Contains(symbol, model.LookupSymbols(x.SpanStart, name: "X")); 2724Assert.Contains(symbol, model.LookupSymbols(x.SpanStart, name: "X")); 2760Assert.Contains(symbol, model.LookupSymbols(x.SpanStart, name: "X")); 6862Assert.Contains("System.Int32 y", model.LookupSymbols(mCall.SpanStart).Select(s => s.ToTestDisplayString())); 6863Assert.DoesNotContain("System.Int32 y", model.LookupSymbols(attrApplication.ArgumentList!.OpenParenToken.SpanStart + 1).Select(s => s.ToTestDisplayString())); 6864Assert.DoesNotContain("System.Int32 y", model.LookupSymbols(mDefinition.SpanStart).Select(s => s.ToTestDisplayString())); 7805Assert.Empty(model.LookupSymbols(p1.SpanStart, name: "p1")); 7833Assert.Same(symbol, model.LookupSymbols(p1.SpanStart, name: "p1").Single()); 8765Assert.Contains(symbol, model.LookupSymbols(p1.SpanStart, name: "p1")); 9171Assert.Contains(symbol, model.LookupSymbols(p1.SpanStart, name: "p1"));
Semantics\RecordTests.cs (23)
21153Assert.Contains(symbol, model.LookupSymbols(x.SpanStart, name: "X")); 21382Assert.Contains(symbol, model.LookupSymbols(x.SpanStart, name: "X")); 21395Assert.Contains(symbol, model.LookupSymbols(x.SpanStart, name: "y")); 21405Assert.Contains(symbol, model.LookupSymbols(x.SpanStart, name: "Test")); 21447Assert.Empty(model.LookupSymbols(x.SpanStart, name: "X")); 21493Assert.Empty(model.LookupSymbols(x.SpanStart, name: "X")); 21553Assert.Empty(model.LookupSymbols(x.SpanStart, name: "X")); 21611Assert.Contains(symbol, model.LookupSymbols(x.SpanStart, name: "X")); 21622Assert.Empty(model.LookupSymbols(x.SpanStart, name: "X")); 21700Assert.Contains(symbol, model.LookupSymbols(x.SpanStart, name: "X")); 21711Assert.Empty(model.LookupSymbols(x.SpanStart, name: "X")); 21896Assert.Empty(model.LookupSymbols(x.SpanStart, name: "X")); 21933Assert.Empty(model.LookupSymbols(x.SpanStart, name: "X")); 21971Assert.Equal("System.Int32 X", model.LookupSymbols(x.SpanStart, name: "X").Single().ToTestDisplayString()); 22008Assert.Empty(model.LookupSymbols(x.SpanStart, name: "X")); 22087Assert.Contains(symbol, model.LookupSymbols(x.SpanStart, name: "X")); 24651Assert.Contains(symbol, model.LookupSymbols(x.SpanStart, name: "X")); 24686Assert.Contains(symbol, model.LookupSymbols(x.SpanStart, name: "X")); 24720Assert.Contains(symbol, model.LookupSymbols(x.SpanStart, name: "X")); 24755Assert.Contains(symbol, model.LookupSymbols(x.SpanStart, name: "X")); 30399Assert.Contains("System.Int32 y", model.LookupSymbols(mCall.SpanStart).Select(s => s.ToTestDisplayString())); 30400Assert.DoesNotContain("System.Int32 y", model.LookupSymbols(attrApplication.ArgumentList!.OpenParenToken.SpanStart + 1).Select(s => s.ToTestDisplayString())); 30401Assert.DoesNotContain("System.Int32 y", model.LookupSymbols(mDefinition.SpanStart).Select(s => s.ToTestDisplayString()));
Microsoft.CodeAnalysis.CSharp.Features (12)
Completion\CompletionProviders\CrefCompletionProvider.cs (2)
183result.AddRange(semanticModel.LookupSymbols(token.SpanStart)); 219result.AddRange(semanticModel.LookupSymbols(token.SpanStart, container));
Completion\CompletionProviders\NamedParameterCompletionProvider.cs (1)
194var indexers = semanticModel.LookupSymbols(position, expressionType, WellKnownMemberNames.Indexer).OfType<IPropertySymbol>();
Completion\CompletionProviders\PropertySubPatternCompletionProvider.cs (1)
137var members = semanticModel.LookupSymbols(position, type);
SignatureHelp\ElementAccessExpressionSignatureHelpProvider.cs (1)
219indexers = semanticModel.LookupSymbols(position, expressionType, WellKnownMemberNames.Indexer)
Snippets\AbstractCSharpForLoopSnippetProvider.cs (1)
50var iteratorName = NameGenerator.GenerateUniqueName(s_iteratorBaseNames, n => semanticModel.LookupSymbols(syntaxContext.Position, name: n).IsEmpty);
Snippets\AbstractCSharpMainMethodSnippetProvider.cs (1)
38!semanticModel.LookupSymbols(context.Position, container: enclosingTypeSymbol, name: WellKnownMemberNames.EntryPointMethodName).IsEmpty)
Snippets\CSharpForEachLoopSnippetProvider.cs (2)
69var enumerationSymbol = semanticModel.LookupSymbols(position).FirstOrDefault(symbol => symbol.GetSymbolType() is { } symbolType && 78"item", name => semanticModel.LookupSymbols(position, name: name).IsEmpty);
src\Analyzers\CSharp\Analyzers\UseDeconstruction\CSharpUseDeconstructionDiagnosticAnalyzer.cs (1)
207var reservedNames = semanticModel.LookupSymbols(container.SpanStart)
src\Analyzers\CSharp\Analyzers\UseNameofInNullableAttribute\CSharpUseNameofInNullableAttributeDiagnosticAnalyzer.cs (1)
102var symbols = semanticModel.LookupSymbols(argument.Expression.SpanStart, name: stringValue);
UsePatternMatching\CSharpIsAndCastCheckWithoutNameDiagnosticAnalyzer.cs (1)
145var reservedNames = semanticModel.LookupSymbols(isExpression.SpanStart)
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (111)
Semantics\BindingTests.cs (7)
3391Assert.True(model.LookupSymbols(node1.SpanStart, name: "MathMin").IsEmpty); 3392Assert.Equal(1, model.LookupSymbols(node1.SpanStart, name: "MathMax").Length); 3393Assert.Equal(1, model.LookupSymbols(node1.SpanStart, name: "F1").Length); 3394Assert.True(model.LookupSymbols(node1.SpanStart, name: "F2").IsEmpty); 3395Assert.True(model.LookupSymbols(node1.SpanStart, name: "MathMax2").IsEmpty); 3396Assert.True(model.LookupSymbols(node1.SpanStart, name: "MathMax3").IsEmpty); 3398var symbols = model.LookupSymbols(node1.SpanStart);
Semantics\ExpressionBodiedMemberTests.cs (1)
1027Assert.Equal($"System.Int32 y{i}", model.LookupSymbols(nodes[i].SpanStart, name: $"y{i}").Single().ToTestDisplayString());
Semantics\LambdaTests.cs (1)
6518Assert.DoesNotContain("parameter", model.LookupSymbols(parameterUsage.Position).ToTestDisplayStrings());
Semantics\LocalFunctionTests.cs (5)
7663Assert.Equal(findAnyways, model.LookupSymbols(tParameterUsage.Position).ToTestDisplayStrings().Contains("TParameter")); 7670var lookupResults = model.LookupSymbols(tParameterUsage.Position).ToTestDisplayStrings(); 8696Assert.DoesNotContain("parameter", model.LookupSymbols(parameterUsage.Position).ToTestDisplayStrings()); 8703var lookupResults = model.LookupSymbols(parameterUsage.Position).ToTestDisplayStrings(); 8782Assert.False(model.LookupSymbols(nameofExpression.ArgumentList.CloseParenToken.SpanStart).ToTestDisplayStrings().Contains("parameter"));
Semantics\LookupPositionTests.cs (1)
3126var actualSymbols = model.LookupSymbols(position).Select(SymbolExtensions.ToTestDisplayString).ToArray();
Semantics\LookupTests.cs (5)
635var actual_lookupSymbols = model.LookupSymbols(GetPositionForBinding(tree)); 636var actual_lookupSymbols_ignoreAcc = model.LookupSymbols(GetPositionForBinding(tree)); 1371var symbols = model.LookupSymbols(eof); 1792var symbols = model.LookupSymbols(position, name: "T"); 1824var symbols = model.LookupSymbols(position, name: "M");
Semantics\RecordStructTests.cs (4)
2602Assert.Contains(symbol, model.LookupSymbols(x.SpanStart, name: "X")); 2637Assert.Contains(symbol, model.LookupSymbols(x.SpanStart, name: "X")); 2671Assert.Contains(symbol, model.LookupSymbols(x.SpanStart, name: "X")); 2706Assert.Contains(symbol, model.LookupSymbols(x.SpanStart, name: "X"));
Semantics\ScriptSemanticsTests.cs (1)
591var symbols = model.LookupSymbols(text.Length);
Semantics\SuppressAccessibilityChecksTests.cs (1)
59Assert.NotEmpty(semanticModel.LookupSymbols(position, name: "A"));
Semantics\TopLevelStatementsTests.cs (83)
198Assert.Contains(refSymbol, model1.LookupSymbols(localRef.SpanStart)); 199Assert.Same(refSymbol, model1.LookupSymbols(localRef.SpanStart, name: refSymbol.Name).Single()); 241Assert.Contains(declSymbol, model1.LookupSymbols(localDecl.SpanStart)); 242Assert.Same(declSymbol, model1.LookupSymbols(localDecl.SpanStart, name: declSymbol.Name).Single()); 326Assert.Empty(model1.LookupSymbols(localRef.SpanStart).Where(s => s.Name == name)); 327Assert.Empty(model1.LookupSymbols(localRef.SpanStart, name: name)); 364Assert.Contains(declSymbol, model2.LookupSymbols(localDecl.SpanStart)); 365Assert.Same(declSymbol, model2.LookupSymbols(localDecl.SpanStart, name: declSymbol.Name).Single()); 485Assert.Contains(declSymbol, model1.LookupSymbols(localDecl.SpanStart)); 486Assert.Same(declSymbol, model1.LookupSymbols(localDecl.SpanStart, name: declSymbol.Name).Single()); 494Assert.Contains(declSymbol, model1.LookupSymbols(localFuncRef.SpanStart)); 495Assert.Same(declSymbol, model1.LookupSymbols(localFuncRef.SpanStart, name: declSymbol.Name).Single()); 505Assert.Empty(model2.LookupSymbols(localRef.SpanStart).Where(s => s.Name == name)); 506Assert.Empty(model2.LookupSymbols(localRef.SpanStart, name: name)); 537Assert.Contains(declSymbol, model1.LookupSymbols(localDecl.SpanStart)); 538Assert.Same(declSymbol, model1.LookupSymbols(localDecl.SpanStart, name: declSymbol.Name).Single()); 548Assert.Contains(declSymbol, model1.LookupSymbols(localRef.SpanStart)); 549Assert.Same(declSymbol, model1.LookupSymbols(localRef.SpanStart, name: declSymbol.Name).Single()); 577Assert.Contains(declSymbol, model1.LookupSymbols(localDecl.SpanStart)); 578Assert.Same(declSymbol, model1.LookupSymbols(localDecl.SpanStart, name: declSymbol.Name).Single()); 586Assert.Contains(declSymbol, model1.LookupSymbols(localFuncRef.SpanStart)); 587Assert.Same(declSymbol, model1.LookupSymbols(localFuncRef.SpanStart, name: declSymbol.Name).Single()); 595Assert.Contains(refSymbol, model1.LookupSymbols(localRef.SpanStart)); 596Assert.Same(refSymbol, model1.LookupSymbols(localRef.SpanStart, name: refSymbol.Name).Single()); 1690var symbols = model1.LookupSymbols(localDecl.SpanStart); 1697Assert.Same(declSymbol, model1.LookupSymbols(localDecl.SpanStart, name: "Test").Single()); 1724symbols = model.LookupSymbols(nameRef.SpanStart); 1730Assert.Same(testType, model.LookupSymbols(nameRef.SpanStart, name: "Test").Single()); 1764var symbols = model.LookupSymbols(nameRef.SpanStart); 1767Assert.Same(declSymbol, model.LookupSymbols(nameRef.SpanStart, name: "Test").Single()); 1863var symbols = model1.LookupSymbols(localDecl.SpanStart); 1870Assert.Same(declSymbol, model1.LookupSymbols(localDecl.SpanStart, name: "Test").Single()); 1892symbols = model2.LookupSymbols(nameRef.SpanStart); 1898Assert.Same(testType, model2.LookupSymbols(nameRef.SpanStart, name: "Test").Single()); 1932var symbols = model2.LookupSymbols(nameRef.SpanStart); 1935Assert.Same(declSymbol, model2.LookupSymbols(nameRef.SpanStart, name: "Test").Single()); 2088var symbols = model1.LookupSymbols(localDecl.SpanStart); 2093Assert.Same(declSymbol, model1.LookupSymbols(localDecl.SpanStart, name: "Test").Single()); 2109symbols = model1.LookupSymbols(nameRef.SpanStart); 2113Assert.Same(testType, model1.LookupSymbols(nameRef.SpanStart, name: "Test").Single()); 2145var symbols = model2.LookupSymbols(nameRef.SpanStart); 2148Assert.Same(declSymbol, model2.LookupSymbols(nameRef.SpanStart, name: "Test").Single()); 2252var symbols = model1.LookupSymbols(localDecl.SpanStart); 2257Assert.Same(declSymbol, model1.LookupSymbols(localDecl.SpanStart, name: "Test").Single()); 2275symbols = model2.LookupSymbols(nameRef.SpanStart); 2279Assert.Same(testType, model2.LookupSymbols(nameRef.SpanStart, name: "Test").Single()); 2311var symbols = model2.LookupSymbols(nameRef.SpanStart); 2314Assert.Same(declSymbol, model2.LookupSymbols(nameRef.SpanStart, name: "Test").Single()); 2431var symbols = model1.LookupSymbols(labelDecl.SpanStart); 2436Assert.Same(testType, model1.LookupSymbols(labelDecl.SpanStart, name: "Test").Single()); 2455symbols = model1.LookupSymbols(nameRef.SpanStart); 2459Assert.Same(testType, model1.LookupSymbols(nameRef.SpanStart, name: "Test").Single()); 2470symbols = model1.LookupSymbols(nameRef.SpanStart); 2474Assert.Same(testType, model1.LookupSymbols(nameRef.SpanStart, name: "Test").Single()); 2508var symbols = model2.LookupSymbols(nameRef.SpanStart); 2511Assert.Same(testType, model2.LookupSymbols(nameRef.SpanStart, name: "Test").Single()); 3950var symbols = model.LookupSymbols(nameRef.SpanStart); 3953Assert.Same(testType, model.LookupSymbols(nameRef.SpanStart, name: "args").Single()); 3964symbols = model.LookupSymbols(nameRef.SpanStart); 3967Assert.Same(parameter, model.LookupSymbols(nameRef.SpanStart, name: "args").Single()); 4004var symbols = model.LookupSymbols(nameRef.SpanStart); 4007Assert.Same(testType, model.LookupSymbols(nameRef.SpanStart, name: "args").Single()); 4099var symbols = model.LookupSymbols(nameRef.SpanStart); 4102Assert.Same(testType, model.LookupSymbols(nameRef.SpanStart, name: "args").Single()); 4134var symbols = model.LookupSymbols(nameRef.SpanStart); 4137Assert.Same(testType, model.LookupSymbols(nameRef.SpanStart, name: "args").Single()); 6042Assert.Contains(declSymbol, model1.LookupSymbols(localRef.SpanStart)); 6043Assert.Same(declSymbol, model1.LookupSymbols(localRef.SpanStart, name: declSymbol.Name).Single()); 6282Assert.Same(x, semanticModel.LookupSymbols(localDecl.SpanStart, name: "x").Single()); 6284Assert.Same(x, semanticModel.LookupSymbols(localRef.SpanStart, name: "x").Single()); 6327Assert.Same(xDecl, semanticModel1.LookupSymbols(localDecl.SpanStart, name: "x").Single()); 6329Assert.Same(xRef, semanticModel1.LookupSymbols(localRef.SpanStart, name: "x").Single()); 6378Assert.Same(xDecl, semanticModel1.LookupSymbols(localDecl.SpanStart, name: "x").Single()); 6384Assert.Same(xRef, semanticModel2.LookupSymbols(localRef.SpanStart, name: "x").Single()); 8580var symbols = model.LookupSymbols(invocations[0].Position, name: "args"); 8582symbols = model.LookupSymbols(invocations[0].SpanStart, name: "args"); 8585symbols = model.LookupSymbols(invocations[1].Position, name: "args"); 8587symbols = model.LookupSymbols(invocations[1].SpanStart, name: "args"); 8590symbols = model.LookupSymbols(invocations[2].Position, name: "args"); 8592symbols = model.LookupSymbols(invocations[2].SpanStart, name: "args"); 8655var symbols = model.LookupSymbols(i, name: "args"); 8677var symbols = model.LookupSymbols(i, name: "args"); 8699var symbols = model.LookupSymbols(i, name: "args");
Semantics\UsingStatementTests.cs (2)
75var lookupSymbol = model.LookupSymbols(memberAccessExpression.SpanStart, name: declaredLocal.Name).Single(); 1896var actualSymbol = model.LookupSymbols(usingStatements[index - 1].SpanStart, name: symbol.Name).Single();
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (114)
Compilation\GetSemanticInfoTests.cs (4)
1028var symbols = model.LookupSymbols(0, returnType); 1712var lookupSymbols = model.LookupSymbols(exprSyntaxToBind.SpanStart, name: "x"); 1747var lookupSymbols = model.LookupSymbols(exprSyntaxToBind.SpanStart, name: "value"); 2229return model.LookupSymbols(exprSyntaxToBind.SpanStart, typeParameter, memberName);
Compilation\IndexedProperties_BindingTests.cs (1)
169var actual_lookupSymbols = model.LookupSymbols(position);
Compilation\SemanticModelAPITests.cs (2)
3848var symbol = model.LookupSymbols(syntax.SpanStart, name: "Alias").Single(); 3875var symbol = model.LookupSymbols(endPosition, name: "M0").Single();
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (40)
1058var symbols = model.LookupSymbols(memberDecl.SpanStart, null, "DateTime"); 1088var symbols = model.LookupSymbols(methodDecl.SpanStart, null, "B"); 1092symbols = model.LookupSymbols(localDecl.SpanStart, null, "B"); 1129var symbols = model.LookupSymbols(positionInB, name: "Z"); 1137symbols = model.LookupSymbols(positionInC, name: "Z"); 1141symbols = model.LookupSymbols(positionInC, name: "AliasZ"); 1145symbols = model.LookupSymbols(positionInC, name: "C"); 1148symbols = model.LookupSymbols(positionInC, name: "AliasZ", container: container); 1385var symbolsInC = model.LookupSymbols(positionInC); 1438var symbols = model.LookupSymbols(methodDecl.SpanStart, paramSymbol.Type); 1452symbols = model.LookupSymbols(methodDecl.SpanStart, paramSymbol.Type); 1559var symbols = model.LookupSymbols(constraintStart, null, name: name); 1633var symbols = model.LookupSymbols(position).Where(s => !s.IsStatic && !((s is ITypeSymbol))); 1636var symbols2 = model.LookupSymbols(position, container: symbolC).Where(s => !s.IsStatic && !((s is ITypeSymbol))); 1725var symbols = model.LookupSymbols(typeDeclStart, type, name: null, includeReducedExtensionMethods: true).WhereAsArray(isExtensionMethod); 1753symbols = model.LookupSymbols(statementStart, type, "E", includeReducedExtensionMethods: true); 1757symbols = model.LookupSymbols(statementStart, type, "F", includeReducedExtensionMethods: true); 1762symbols = model.LookupSymbols(statementStart, null, "F", includeReducedExtensionMethods: true); 1768symbols = model.LookupSymbols(namespaceStart, baseType, name: null, includeReducedExtensionMethods: true).WhereAsArray(isExtensionMethod); 1777symbols = model.LookupSymbols(typeDeclStart, valueType, name: "E", includeReducedExtensionMethods: true).WhereAsArray(isExtensionMethod); 1782symbols = model.LookupSymbols(namespaceStart, valueType, name: "H", includeReducedExtensionMethods: true).WhereAsArray(isExtensionMethod); 1787symbols = model.LookupSymbols(typeDeclStart, type, name: "C", includeReducedExtensionMethods: true).WhereAsArray(isExtensionMethod); 1819var symbols = model.LookupSymbols(methodStart, null, name: "E", includeReducedExtensionMethods: true); 1826symbols = model.LookupSymbols(methodStart, type, name: "E", includeReducedExtensionMethods: true); 1835symbols = model.LookupSymbols(methodStart, type, name: "E", includeReducedExtensionMethods: true); 1875var symbols = model.LookupSymbols(methodStart, null, name: "a"); 1879symbols = model.LookupSymbols(methodStart, null, name: "b"); 1888symbols = model.LookupSymbols(methodStart, typeB, name: null, includeReducedExtensionMethods: true).WhereAsArray(isExtensionMethod); 1900symbols = model.LookupSymbols(methodStart, typeA, name: null, includeReducedExtensionMethods: true).WhereAsArray(isExtensionMethod); 1938var symbols = model.LookupSymbols(position, container: null, name: "F", includeReducedExtensionMethods: true); 1978symbols = model.LookupSymbols(position, container: null, name: "F", includeReducedExtensionMethods: true); 2012var symbols = model.LookupSymbols(methodStart, null, name: "o"); 2018symbols = model.LookupSymbols(methodStart, type, name: "First", includeReducedExtensionMethods: true); 2080var symbols = model.LookupSymbols(position, name: "a"); 2083symbols = model.LookupSymbols(position, name: "b"); 4446var lookupSymbols = model.LookupSymbols(conversionDecl.DescendantNodes().OfType<ReturnStatementSyntax>().Single().SpanStart, name: WellKnownMemberNames.ImplicitConversionName); 4477var lookupSymbols = model.LookupSymbols(conversionDecl.DescendantNodes().OfType<ReturnStatementSyntax>().Single().SpanStart, name: WellKnownMemberNames.ExplicitConversionName); 4508var lookupSymbols = model.LookupSymbols(operatorDecl.DescendantNodes().OfType<ReturnStatementSyntax>().Single().SpanStart, name: WellKnownMemberNames.AdditionOperatorName); 4540var symbols = model.LookupSymbols(position, name: "Alias"); 4577var symbols = model.LookupSymbols(position, name: "Alias");
Compilation\SemanticModelGetSemanticInfoTests.cs (1)
1120symbols = model.LookupSymbols(expr.SpanStart, container: null, name: "F", includeReducedExtensionMethods: true);
DocumentationComments\CrefTests.cs (4)
3380AssertEx.SetEqual(model.LookupSymbols(position).Select(SymbolExtensions.ToTestDisplayString), 6053var members = model.LookupSymbols(typeParameterSyntax.SpanStart, (ITypeSymbol)typeParameterSymbol); 6077var members = model.LookupSymbols(methodNameSyntax.SpanStart, ((IMethodSymbol)methodSymbol).ReturnType); 6677Assert.Empty(model.LookupSymbols(name.SpanStart, typeParameter, "GetAwaiter"));
DocumentationComments\ParameterTests.cs (32)
411AssertEx.SetEqual(model.LookupSymbols(pos1).Select(SymbolExtensions.ToTestDisplayString)); 412AssertEx.SetEqual(model.LookupSymbols(pos2).Select(SymbolExtensions.ToTestDisplayString)); 413AssertEx.SetEqual(model.LookupSymbols(pos3).Select(SymbolExtensions.ToTestDisplayString), "T"); 414AssertEx.SetEqual(model.LookupSymbols(pos4).Select(SymbolExtensions.ToTestDisplayString), "T"); 438AssertEx.SetEqual(model.LookupSymbols(pos1).Select(SymbolExtensions.ToTestDisplayString), "System.Int32 x"); 439AssertEx.SetEqual(model.LookupSymbols(pos2).Select(SymbolExtensions.ToTestDisplayString), "System.Int32 x"); 440AssertEx.SetEqual(model.LookupSymbols(pos3).Select(SymbolExtensions.ToTestDisplayString), "T"); 441AssertEx.SetEqual(model.LookupSymbols(pos4).Select(SymbolExtensions.ToTestDisplayString), "T"); 465AssertEx.SetEqual(model.LookupSymbols(pos1).Select(SymbolExtensions.ToTestDisplayString), "System.Int32 value"); 466AssertEx.SetEqual(model.LookupSymbols(pos2).Select(SymbolExtensions.ToTestDisplayString), "System.Int32 value"); 467AssertEx.SetEqual(model.LookupSymbols(pos3).Select(SymbolExtensions.ToTestDisplayString)); 468AssertEx.SetEqual(model.LookupSymbols(pos4).Select(SymbolExtensions.ToTestDisplayString)); 492AssertEx.SetEqual(model.LookupSymbols(pos1).Select(SymbolExtensions.ToTestDisplayString)); 493AssertEx.SetEqual(model.LookupSymbols(pos2).Select(SymbolExtensions.ToTestDisplayString)); 494AssertEx.SetEqual(model.LookupSymbols(pos3).Select(SymbolExtensions.ToTestDisplayString)); 495AssertEx.SetEqual(model.LookupSymbols(pos4).Select(SymbolExtensions.ToTestDisplayString)); 519AssertEx.SetEqual(model.LookupSymbols(pos1).Select(SymbolExtensions.ToTestDisplayString), "System.Int32 x", "System.Int32 value"); 520AssertEx.SetEqual(model.LookupSymbols(pos2).Select(SymbolExtensions.ToTestDisplayString), "System.Int32 x", "System.Int32 value"); 521AssertEx.SetEqual(model.LookupSymbols(pos3).Select(SymbolExtensions.ToTestDisplayString)); 522AssertEx.SetEqual(model.LookupSymbols(pos4).Select(SymbolExtensions.ToTestDisplayString)); 546AssertEx.SetEqual(model.LookupSymbols(pos1).Select(SymbolExtensions.ToTestDisplayString), "System.Int32 x"); 547AssertEx.SetEqual(model.LookupSymbols(pos2).Select(SymbolExtensions.ToTestDisplayString), "System.Int32 x"); 548AssertEx.SetEqual(model.LookupSymbols(pos3).Select(SymbolExtensions.ToTestDisplayString)); 549AssertEx.SetEqual(model.LookupSymbols(pos4).Select(SymbolExtensions.ToTestDisplayString)); 574AssertEx.SetEqual(model.LookupSymbols(pos1).Select(SymbolExtensions.ToTestDisplayString)); 575AssertEx.SetEqual(model.LookupSymbols(pos2).Select(SymbolExtensions.ToTestDisplayString)); 576AssertEx.SetEqual(model.LookupSymbols(pos3).Select(SymbolExtensions.ToTestDisplayString)); 577AssertEx.SetEqual(model.LookupSymbols(pos4), compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("C").TypeParameters.Single()); 602AssertEx.SetEqual(model.LookupSymbols(pos1).Select(SymbolExtensions.ToTestDisplayString)); 603AssertEx.SetEqual(model.LookupSymbols(pos2).Select(SymbolExtensions.ToTestDisplayString)); 604AssertEx.SetEqual(model.LookupSymbols(pos3).Select(SymbolExtensions.ToTestDisplayString)); 605AssertEx.SetEqual(model.LookupSymbols(pos4), compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("C").TypeParameters.Single());
Symbols\AnonymousTypesSemanticsTests.cs (2)
1495var syms = data.Model.LookupSymbols(pos, container: info0.Type).Select(x => x.ToTestDisplayString()).OrderBy(x => x).ToArray(); 1514syms = data.Model.LookupSymbols(pos, container: info0.Type).Select(x => x.ToTestDisplayString()).OrderBy(x => x).ToArray();
Symbols\DestructorTests.cs (1)
420var lookupSymbols = model.LookupSymbols(finalizeSyntax.SpanStart, name: WellKnownMemberNames.DestructorName);
Symbols\ExtensionMethodTests.cs (10)
2954var lookupResult = model.LookupSymbols( 3784var symbols = model.LookupSymbols(member.Expression.EndPosition, type, includeReducedExtensionMethods: true).Select(s => s.Name).ToArray(); 3871var setMember = model.LookupSymbols(instance.Position, baseClass, "SetMember", includeReducedExtensionMethods: true).Single(); 3873Assert.Contains(setMember, model.LookupSymbols(instance.Position, baseClass, includeReducedExtensionMethods: true)); 3918Assert.Empty(model.LookupSymbols(instance.Position, baseClass, "SetMember", includeReducedExtensionMethods: true)); 3919Assert.Empty(model.LookupSymbols(instance.Position, baseClass, includeReducedExtensionMethods: true).Where(s => s.Name == "SetMembers")); 3963var setMember = model.LookupSymbols(instance.Position, baseClass, "SetMember", includeReducedExtensionMethods: true).Single(); 3965Assert.Contains(setMember, model.LookupSymbols(instance.Position, baseClass, includeReducedExtensionMethods: true)); 4013Assert.Empty(model.LookupSymbols(instance.Position, baseClass, "SetMember", includeReducedExtensionMethods: true)); 4014Assert.Empty(model.LookupSymbols(instance.Position, baseClass, includeReducedExtensionMethods: true).Where(s => s.Name == "SetMembers"));
Symbols\LookupSymbolsInfoTests.cs (1)
96var symbols = model.LookupSymbols(0, null, symbolName);
Symbols\Source\BaseClassTests.cs (3)
275var members = model.LookupSymbols(positionInA, a, "Z"); 280var members2 = model.LookupSymbols(positionInA, a, "Q"); 312var members = model.LookupSymbols(positionInA, a, "Q");
Symbols\Source\EventTests.cs (2)
305var eventSymbol1 = semanticModel.LookupSymbols(text.IndexOf("/*anchorE_1*/", StringComparison.Ordinal), name: "E1").SingleOrDefault() as IEventSymbol; 308var eventSymbol2 = semanticModel.LookupSymbols(text.IndexOf("/*anchorE_2*/", StringComparison.Ordinal), name: "E1").SingleOrDefault() as IEventSymbol;
Symbols\Source\FileModifierTests.cs (8)
3652var symbols = model.LookupSymbols(body.OpenBraceToken.EndPosition, name: "C"); 3655symbols = model.LookupSymbols(body.OpenBraceToken.EndPosition); 3724var symbols = model.LookupSymbols(body.OpenBraceToken.EndPosition, name: "C"); 3727symbols = model.LookupSymbols(body.OpenBraceToken.EndPosition); 3783var symbols = speculativeModel.LookupSymbols(newBody.OpenBraceToken.EndPosition, name: "C"); 3786symbols = speculativeModel.LookupSymbols(newBody.OpenBraceToken.EndPosition); 3825var symbols = speculativeModel.LookupSymbols(newBody.OpenBraceToken.EndPosition, name: "C"); 3828symbols = speculativeModel.LookupSymbols(newBody.OpenBraceToken.EndPosition);
Symbols\Source\NullablePublicAPITests.cs (1)
4122var lookupResults = model.LookupSymbols(position);
Symbols\Source\UsingAliasTests.cs (2)
486var symbols = model.LookupSymbols(root.Members[0].SpanStart, name: "O"); 507var symbols = model.LookupSymbols(root.Members[0].SpanStart, name: "O");
Microsoft.CodeAnalysis.CSharp.Test.Utilities (1)
CompilationTestUtils.cs (1)
349: model.LookupSymbols(position, container);
Microsoft.CodeAnalysis.CSharp.WinRT.UnitTests (2)
CodeGen\WinRTCollectionTests.cs (2)
7434Assert.True(model.LookupSymbols(add.SpanStart, jsonObjType, "Add").Contains(addMethod)); 7435Assert.True(model.LookupSymbols(add.SpanStart, jsonObjType).Contains(addMethod));
Microsoft.CodeAnalysis.CSharp.Workspaces (4)
Simplification\Simplifiers\AbstractCSharpSimplifier.cs (1)
412var symbols = semanticModel.LookupSymbols(expression.SpanStart, name: identifierName.Identifier.ValueText);
Simplification\Simplifiers\ExpressionSimplifier.cs (1)
232? semanticModel.LookupSymbols(memberAccess.SpanStart, name: memberAccess.Name.Identifier.ValueText)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SemanticModelExtensions.cs (1)
125return semanticModel.LookupSymbols(expr.SpanStart, container: symbol, name: name, includeReducedExtensionMethods: true);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSemanticFactsService.cs (1)
43var visibleSymbols = semanticModel.LookupSymbols(location.SpanStart);
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (3)
CodeGeneration\CodeGenerationTests.CSharp.cs (2)
681getExplicitInterfaces: s => s.LookupSymbols(input.IndexOf('M'), null, "M").OfType<IMethodSymbol>().ToImmutableArray()); 699getExplicitInterfaces: s => s.LookupSymbols(input.IndexOf('M'), null, "M").OfType<IMethodSymbol>().ToImmutableArray());
CodeGeneration\CodeGenerationTests.VisualBasic.cs (1)
647getExplicitInterfaces: s => s.LookupSymbols(input.IndexOf('M'), null, "M").OfType<IMethodSymbol>().ToImmutableArray());
Microsoft.CodeAnalysis.Features (2)
ExtractMethod\UniqueNameGenerator.cs (1)
28n => _semanticModel.LookupSymbols(contextNode.SpanStart, container: null, n).Length == 0);
src\Analyzers\Core\Analyzers\UseCollectionInitializer\AbstractUseCollectionInitializerAnalyzer.cs (1)
191var addMethods = this.SemanticModel.LookupSymbols(
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SemanticModelExtensions.vb (1)
68semanticModel.LookupSymbols(expr.SpanStart, container:=symbol, name:=name))
Microsoft.CodeAnalysis.VisualBasic.Features (8)
CodeFixes\GenerateEvent\GenerateEventCodeFixProvider.vb (1)
369If semanticModel.LookupSymbols(handlesClauseItem.SpanStart, container:=targetType, name:=handlesClauseItem.EventMember.Identifier.ValueText).
Completion\CompletionProviders\CrefCompletionProvider.vb (2)
166Return semanticModel.LookupSymbols(token.SpanStart) 182For Each symbol In semanticModel.LookupSymbols(token.SpanStart, container)
Completion\CompletionProviders\ImplementsClauseCompletionProvider.vb (2)
177Dim symbols = semanticModel.LookupSymbols(position, container) 206Dim symbols = New HashSet(Of ISymbol)(semanticModel.LookupSymbols(position))
NavigationBar\VisualBasicNavigationBarItemService.vb (1)
322Dim accessibleEvents = semanticModel.LookupSymbols(position, eventType).OfType(Of IEventSymbol).OrderBy(Function(e) e.Name)
SignatureHelp\FunctionAggregationSignatureHelpProvider.vb (1)
65Dim methods = semanticModel.LookupSymbols(
SignatureHelp\RaiseEventStatementSignatureHelpProvider.vb (1)
85semanticModel.LookupSymbols(raiseEventStatement.SpanStart, containingType, raiseEventStatement.Name.Identifier.ValueText))
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (2)
Semantics\GetExtendedSemanticInfoTests.vb (1)
8532Dim lus1 = DirectCast(model, SemanticModel).LookupSymbols(SLDeclaration.SpanStart, name:="i")
Semantics\MeMyBaseMyClassTests.vb (1)
550Dim symbol = model.LookupSymbols(pos, name:=name, includeReducedExtensionMethods:=True)
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (2)
DocumentationComments\DocCommentTests.vb (2)
6732model.LookupSymbols(firstIndex, 6758model.LookupSymbols(secondIndex,
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (1)
CompilationTestUtils.vb (1)
1252Dim result = If(namespacesAndTypesOnly, model.LookupNamespacesAndTypes(position, container), model.LookupSymbols(position, container))
Microsoft.CodeAnalysis.VisualBasic.Workspaces (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SemanticModelExtensions.vb (1)
68semanticModel.LookupSymbols(expr.SpanStart, container:=symbol, name:=name))
Microsoft.CodeAnalysis.Workspaces (5)
Recommendations\AbstractRecommendationServiceRunner.cs (3)
302var aliases = semanticModel.LookupSymbols(_context.Position, container).OfType<IAliasSymbol>().Where(a => systemNamespace.Equals(a.Target)); 327var aliases = _context.SemanticModel.LookupSymbols(_context.Position, container).OfType<IAliasSymbol>().Where(a => specialTypeSymbol.Equals(a.Target)); 396_context.SemanticModel.LookupSymbols(position, container, includeReducedExtensionMethods: true));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.cs (1)
599var potentialGetAwaiters = semanticModel.LookupSymbols(position,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\SemanticsFactsService\AbstractSemanticFactsService.cs (1)
92=> semanticModel.LookupSymbols(location.SpanStart).Concat(semanticModel.GetExistingSymbols(container, cancellationToken));
Microsoft.VisualStudio.LanguageServices (2)
Venus\ContainedLanguageCodeSupport.cs (2)
300? semanticModel.LookupSymbols(position: type.Locations[0].SourceSpan.Start, container: type, name: null) 497return semanticModel.LookupSymbols(typeLocation.SourceSpan.Start, objectType, nameOfEvent).SingleOrDefault(m => m.Kind == SymbolKind.Event);