628 references to Text
Microsoft.Analyzers.Extra (3)
CallAnalysis\Fixers\LegacyLoggingFixer.cs (1)
279if (cl.Identifier.Text == details.TargetClassName)
CallAnalysis\Fixers\LegacyLoggingFixer.FixDetails.cs (1)
71var argName = operation.Syntax.GetLastToken().Text;
Utilities\SyntaxNodeExtensions.cs (1)
135return expression is IdentifierNameSyntax id && id.Identifier.Text == expectedName;
Microsoft.Analyzers.Local (1)
InternalReferencedInPublicDocAnalyzer.cs (1)
67switch (modifier.Text)
Microsoft.AspNetCore.App.Analyzers (7)
Infrastructure\VirtualChars\AbstractVirtualCharService.cs (1)
140var tokenText = token.Text;
Infrastructure\VirtualChars\CSharpVirtualCharService.cs (3)
134var tokenText = token.Text; 204var tokenSourceText = SourceText.From(token.Text); 247var tokenText = token.Text;
Infrastructure\VirtualChars\IVirtualCharService.cs (2)
53/// cref="SyntaxToken.Text"/> 58/// cref="SyntaxToken.Text"/> of the token between the quotes maps to each character in the
RouteEmbeddedLanguage\RoutePatternHighlighter.cs (1)
98.Where(i => i.Identifier.Text == matchingParameter.Name)
Microsoft.AspNetCore.App.CodeFixes (3)
Authorization\AddAuthorizationBuilderFixer.cs (2)
87if (configureAction is InvocationExpressionSyntax { ArgumentList.Arguments: { Count: 2 } configureArguments, Expression: MemberAccessExpressionSyntax { Name.Identifier.Text: "AddPolicy" } }) 95else if (configureAction is AssignmentExpressionSyntax { Left: MemberAccessExpressionSyntax { Name.Identifier.Text: { } assignmentTargetName }, Right: { } assignmentExpression }
Dependencies\AddPackageFixer.cs (1)
55var methodName = node is IdentifierNameSyntax identifier ? identifier.Identifier.Text : null;
Microsoft.AspNetCore.SignalR.Client.SourceGenerator (2)
HubClientProxyGenerator.Parser.cs (1)
24Text: "HubClientProxy"
HubServerProxyGenerator.Parser.cs (1)
24Text: "HubServerProxy"
Microsoft.CodeAnalysis.CodeStyle (5)
src\Analyzers\Core\Analyzers\UseCollectionInitializer\UpdateExpressionState.cs (1)
390requiredArgumentName: identifier.Text,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (1)
144var tokenText = token.Text;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\IVirtualCharService.cs (2)
53/// cref="SyntaxToken.Text"/> 58/// cref="SyntaxToken.Text"/> of the token between the quotes maps to each character in the
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\AbstractDocumentationCommentService.cs (1)
135sb.Append(GetIdentifier(xmlName).Text);
Microsoft.CodeAnalysis.CSharp (26)
Binder\Binder_Expressions.cs (1)
7724Error(diagnostics, ErrorCode.ERR_BadUnaryOp, node, operatorToken.Text, boundLeft.Display);
Binder\Binder_Operators.cs (8)
839Error(diagnostics, ErrorCode.ERR_BadOpOnNullOrDefaultOrNew, node, operatorToken.Text, "default"); 842Error(diagnostics, ErrorCode.ERR_AmbigBinaryOpsOnDefault, node, operatorToken.Text, left.Display, right.Display); 846Error(diagnostics, ErrorCode.ERR_AmbigBinaryOpsOnUnconstrainedDefault, node, operatorToken.Text, right.Type); 850Error(diagnostics, ErrorCode.ERR_AmbigBinaryOpsOnUnconstrainedDefault, node, operatorToken.Text, left.Type); 853Error(diagnostics, ErrorCode.ERR_BadOpOnNullOrDefaultOrNew, node, operatorToken.Text, left.Display); 856Error(diagnostics, ErrorCode.ERR_BadOpOnNullOrDefaultOrNew, node, operatorToken.Text, right.Display); 878Error(diagnostics, errorCode, node, operatorToken.Text, left.Display, right.Display); 2313ReportUnaryOperatorError(node, diagnostics, operatorToken.Text, operand, resultKind);
CSharpExtensions.cs (4)
239return token.Kind() is (SyntaxKind.StringLiteralToken or SyntaxKind.Utf8StringLiteralToken) && token.Text.Length > 0 && token.Text[0] == '@'; 244return token.IsKind(SyntaxKind.IdentifierToken) && token.Text.Length > 0 && token.Text[0] == '@';
Symbols\FunctionPointers\FunctionPointerMethodSymbol.cs (2)
61diagnostics.Add(ErrorCode.ERR_DupReturnTypeMod, modifier.GetLocation(), modifier.Text); 66diagnostics.Add(ErrorCode.ERR_InvalidFuncPointerReturnTypeModifier, modifier.GetLocation(), modifier.Text);
Symbols\Source\SourceMemberContainerSymbol.cs (1)
1868ReportReservedTypeName(identifier?.Text, this.DeclaringCompilation, diagnostics.DiagnosticBag, identifier?.GetLocation() ?? Location.None);
Symbols\Source\SourceMethodSymbolWithAttributes.cs (5)
1093diagnostics.Add(ErrorCode.ERR_InterceptorNameNotInvoked, attributeLocation, referencedToken.Text); 1096diagnostics.Add(ErrorCode.ERR_InterceptorPositionBadToken, attributeLocation, referencedToken.Text); 1303diagnostics.Add(ErrorCode.ERR_InterceptorNameNotInvoked, attributeLocation, referencedToken.Text); 1306diagnostics.Add(ErrorCode.ERR_InterceptorPositionBadToken, attributeLocation, referencedToken.Text); 1315diagnostics.Add(ErrorCode.ERR_InterceptorMustReferToStartOfTokenPosition, attributeLocation, referencedToken.Text, linePositionZeroBased.Line + 1, linePositionZeroBased.Character + 1);
Symbols\Source\SourceNamespaceSymbol.AliasesAndUsings.cs (1)
675SourceMemberContainerTypeSymbol.ReportReservedTypeName(identifier.Text, compilation, diagnostics, location);
Syntax\SyntaxFactory.cs (2)
1206if (rewrittenToken.IsKind(SyntaxKind.LessThanToken) && string.Equals("<", rewrittenToken.Text, StringComparison.Ordinal)) 1209if (rewrittenToken.IsKind(SyntaxKind.GreaterThanToken) && string.Equals(">", rewrittenToken.Text, StringComparison.Ordinal))
Syntax\SyntaxNormalizer.cs (2)
913var tokenLastChar = token.Text.Last(); 914var nextFirstChar = next.Text.First();
Microsoft.CodeAnalysis.CSharp.CodeStyle (13)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\CSharpVirtualCharService.cs (3)
132var tokenText = token.Text; 193var tokenSourceText = SourceText.From(token.Text); 234var tokenText = token.Text;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ExpressionSyntaxExtensions.cs (1)
429name.Identifier.Text == SyntaxFacts.GetText(SyntaxKind.NameOfKeyword))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ParenthesizedExpressionSyntaxExtensions.cs (2)
48var previousChar = tokenBeforeParen.Text.LastOrDefault(); 49var nextChar = tokenAfterParen.Text.FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.SingleLineRewriter.cs (2)
62if (s_newlinePattern.IsMatch(token.Text)) 64var newText = s_newlinePattern.Replace(token.Text, " ");
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTreeExtensions.cs (1)
373(token.Span.Length > startDelimeterLength && token.Text[^1] != lastChar);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (4)
343SyntaxKind.IdentifierToken => token.Text switch 822return identifier.IsMissing ? missingTokenPlaceholder : identifier.Text; 845name = nameToken.IsMissing ? missingTokenPlaceholder : nameToken.Text; 874name = nameToken.IsMissing ? missingTokenPlaceholder : nameToken.Text;
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (14)
src\Analyzers\CSharp\CodeFixes\DocumentationComments\CSharpRemoveDocCommentNodeCodeFixProvider.cs (1)
47=> token.Kind() == SyntaxKind.XmlTextLiteralToken && IsWhitespace(token.Text);
src\Analyzers\CSharp\CodeFixes\MakeMethodAsynchronous\CSharpMakeMethodAsynchronousCodeFixProvider.cs (1)
49return token.Kind() == SyntaxKind.IdentifierToken && token.Text == "await";
src\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (1)
94edits.Add(new TextChange(new TextSpan(nextExpression.SpanStart, 0), token.Text + " "));
src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (1)
96edits.Add(new TextChange(new TextSpan(nextExpression.SpanStart, 0), token.Text + " "));
src\Analyzers\CSharp\CodeFixes\Nullable\CSharpDeclareAsNullableCodeFixProvider.cs (1)
225var parameter = method.Parameters.Where(p => p.Name == identifier.Text).FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EnumMemberGenerator.cs (1)
134LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(numericLiteral.Token.Text, 1)),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Editing\CSharpImportAdder.cs (2)
204if (!_importedTypes.ContainsKey((node.Identifier.Text, node.Arity))) 211=> _importedExtensionMethods.ContainsKey(node.Name.Identifier.Text);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs (1)
700token.Text == "dynamic";
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (2)
1269else if (token.IsKind(SyntaxKind.IdentifierToken) && token.Text == "scoped" && token.Parent is IdentifierNameSyntax scopedIdentifierName && scopedIdentifierName.Parent.IsKind(SyntaxKind.Parameter)) 2879if (token.Text == SyntaxFacts.GetText(SyntaxKind.AsyncKeyword))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpReplaceDiscardDeclarationsWithAssignmentsService.cs (3)
81text: discardSyntax.UnderscoreToken.Text, 121=> variable.Identifier.Text == DiscardVariableName; 123=> catchDeclaration.Identifier.Text == DiscardVariableName;
Microsoft.CodeAnalysis.CSharp.EditorFeatures (10)
CompleteStatement\CompleteStatementCommandHandler.cs (5)
468&& literalExpression.Token.Text.StartsWith("@")) 480&& (literalExpression.Token.Text.Length == 1 || literalExpression.Token.Text[^1] != '"')) 486&& (literalExpression.Token.Text.Length == 1 || literalExpression.Token.Text[^1] != '\''))
EventHookup\EventHookupSessionManager_EventHookupSession.cs (2)
257return lhsGenericNameSyntax.Identifier.Text; 275? typeDeclaration.Identifier.Text
RawStringLiteral\RawStringLiteralCommandHandler_TypeChar.cs (1)
226if (!endToken.Text.EndsWith(new string('"', quoteCount)))
TextStructureNavigation\CSharpTextStructureNavigatorProvider.cs (2)
87SyntaxKind.StringLiteralToken => position == token.Span.End - 1 && token.Text[^1] == '"', 88SyntaxKind.Utf8StringLiteralToken => position == token.Span.End - 3 && token.Text is [.., '"', 'u' or 'U', '8'],
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (3)
CodeGen\CodeGenInterpolatedString.cs (3)
39Assert.Equal("@$\"", token1.Text); 43Assert.Equal("$@\"", token2.Text); 48Assert.False(string.IsNullOrEmpty(token.Text));
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (21)
Attributes\AttributeTests_RefReadOnly.cs (4)
1379var userFunction = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(method => method.Identifier.Text == "User"); 1421var userFunction = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(method => method.Identifier.Text == "User"); 1450var userFunction = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(method => method.Identifier.Text == "User"); 1477var userFunction = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(method => method.Identifier.Text == "User");
Semantics\CollectionExpressionTests.cs (17)
7534var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 8257var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 8328var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 8412var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 8497var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26013var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26139var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26253var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26311var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26382var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26464var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26530var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26591var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26661var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26836var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26901var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "CreateCollection"); 26957var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create");
Microsoft.CodeAnalysis.CSharp.Features (19)
Completion\CompletionProviders\DeclarationName\DeclarationNameRecommender.cs (2)
261if (seenUniqueNames.Add(uniqueName.Text)) 263result.Add((uniqueName.Text,
Completion\CompletionProviders\XmlDocCommentCompletionProvider.cs (1)
215if (token.IsKind(SyntaxKind.XmlTextLiteralToken) && string.IsNullOrWhiteSpace(token.Text))
Completion\KeywordRecommenders\RefKeywordRecommender.cs (1)
185case SyntaxKind.IdentifierToken when token.Text == "scoped":
ConvertPrimaryToRegularConstructor\ConvertPrimaryToRegularConstructorCodeRefactoringProvider_DocumentationComments.cs (3)
57t => t.Kind() == SyntaxKind.XmlTextLiteralNewLineToken || string.IsNullOrWhiteSpace(t.Text)))) 85if (lastIndex - 1 >= 0 && tokens[lastIndex - 1].Kind() == SyntaxKind.XmlTextLiteralToken && string.IsNullOrWhiteSpace(tokens[lastIndex - 1].Text)) 157if (textToken.Kind() == SyntaxKind.XmlTextLiteralToken && string.IsNullOrWhiteSpace(textToken.Text))
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (2)
1066join newVariable in newVariables on oldVariable.Identifier.Text equals newVariable.Identifier.Text
EditAndContinue\SyntaxComparer.cs (4)
1606oldToken.Text, Math.Min(oldToken.Text.Length, LongestCommonSubsequence.MaxSequenceLengthForDistanceCalculation), 1607newToken.Text, Math.Min(newToken.Text.Length, LongestCommonSubsequence.MaxSequenceLengthForDistanceCalculation));
Rename\CSharpRenameIssuesService.cs (1)
71return declaredType == parent && token.Text == "var";
src\Analyzers\CSharp\CodeFixes\DocumentationComments\CSharpRemoveDocCommentNodeCodeFixProvider.cs (1)
47=> token.Kind() == SyntaxKind.XmlTextLiteralToken && IsWhitespace(token.Text);
src\Analyzers\CSharp\CodeFixes\MakeMethodAsynchronous\CSharpMakeMethodAsynchronousCodeFixProvider.cs (1)
49return token.Kind() == SyntaxKind.IdentifierToken && token.Text == "await";
src\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (1)
94edits.Add(new TextChange(new TextSpan(nextExpression.SpanStart, 0), token.Text + " "));
src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (1)
96edits.Add(new TextChange(new TextSpan(nextExpression.SpanStart, 0), token.Text + " "));
src\Analyzers\CSharp\CodeFixes\Nullable\CSharpDeclareAsNullableCodeFixProvider.cs (1)
225var parameter = method.Parameters.Where(p => p.Name == identifier.Text).FirstOrDefault();
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (1)
EditAndContinue\ActiveStatementTests.cs (1)
12557if (node.Parent is MethodDeclarationSyntax methodDecl && methodDecl.Identifier.Text == "G")
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (50)
Semantics\BindingTests.cs (1)
3939var lambda = tree.GetRoot().DescendantNodes().OfType<SimpleLambdaExpressionSyntax>().Single(s => s.Parameter.Identifier.Text == "x");
Semantics\ColorColorTests.cs (4)
1892var node2 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.Text == "E" && (n.Parent is EqualsValueClauseSyntax)).Single(); 1949var node2 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.Text == "E" && (n.Parent is EqualsValueClauseSyntax)).Single(); 2006var node2 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.Text == "E" && (n.Parent is EqualsValueClauseSyntax)).Single(); 2055var node2 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.Text == "E" && (n.Parent is EqualsValueClauseSyntax)).Single();
Semantics\DelegateTypeTests.cs (3)
11086var variables = nodes.OfType<VariableDeclaratorSyntax>().Where(v => v.Identifier.Text == "d").ToArray(); 11092var identifiers = nodes.OfType<InvocationExpressionSyntax>().Where(i => i.Expression is IdentifierNameSyntax id && id.Identifier.Text == "Report").Select(i => i.ArgumentList.Arguments[0].Expression).ToArray(); 11170var variables = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(v => v.Identifier.Text == "d").ToArray();
Semantics\InterceptorsTests.cs (2)
1976var node1 = root.DescendantNodes().First(node => node is IdentifierNameSyntax name && name.Identifier.Text == "Prop"); 1982var node3 = root.DescendantNodes().Last(node => node is IdentifierNameSyntax name && name.Identifier.Text == "Program");
Semantics\LambdaTests.cs (2)
3978Assert.Equal("A", a.Identifier.Text); 3991Assert.Equal("A", a.Identifier.Text);
Semantics\LocalFunctionTests.cs (3)
354Assert.Equal("X", x.Identifier.Text); 396Assert.Equal("A", a.Identifier.Text); 410Assert.Equal("A", a.Identifier.Text);
Semantics\MethodTypeInferenceTests.cs (4)
1119var book = (IdentifierNameSyntax)tree.GetRoot().DescendantTokens().Last(t => t.Text == "b").Parent; 1160var author = (IdentifierNameSyntax)tree.GetRoot().DescendantTokens().Last(t => t.Text == "a").Parent; 1201var bookResult = (IdentifierNameSyntax)tree.GetRoot().DescendantTokens().Last(t => t.Text == "bookResult").Parent; 1205var authorResult = (IdentifierNameSyntax)tree.GetRoot().DescendantTokens().Last(t => t.Text == "authorResult").Parent;
Semantics\NullableContextTests.cs (1)
734bool expectedAnalysis = expectedAnalyzedKeys.Contains(methodDeclaration.Identifier.Text);
Semantics\RefFieldTests.cs (3)
17946var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(v => v.Identifier.Text == "f").ToArray(); 22831var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(v => v.Identifier.Text is "r1" or "r2").ToArray(); 22899var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(v => v.Identifier.Text is "r1" or "r2").ToArray();
Semantics\StackAllocInitializerTests.cs (10)
1051Assert.Equal("obj1", obj1.Identifier.Text); 1059Assert.Equal("obj2", obj2.Identifier.Text); 1067Assert.Equal("obj3", obj3.Identifier.Text); 1075Assert.Equal("obj4", obj4.Identifier.Text); 1083Assert.Equal("obj5", obj5.Identifier.Text); 1153Assert.Equal("obj1", obj1.Identifier.Text); 1162Assert.Equal("obj2", obj2.Identifier.Text); 1170Assert.Equal("obj3", obj3.Identifier.Text); 1178Assert.Equal("obj4", obj4.Identifier.Text); 1186Assert.Equal("obj5", obj5.Identifier.Text);
Semantics\StackAllocSpanExpressionsTests.cs (10)
57Assert.Equal("obj1", obj1.Identifier.Text); 65Assert.Equal("obj2", obj2.Identifier.Text); 73Assert.Equal("obj3", obj3.Identifier.Text); 81Assert.Equal("obj4", obj4.Identifier.Text); 89Assert.Equal("obj5", obj5.Identifier.Text); 131Assert.Equal("obj1", obj1.Identifier.Text); 140Assert.Equal("obj2", obj2.Identifier.Text); 148Assert.Equal("obj3", obj3.Identifier.Text); 156Assert.Equal("obj4", obj4.Identifier.Text); 164Assert.Equal("obj5", obj5.Identifier.Text);
Semantics\TopLevelStatementsTests.cs (1)
9677var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().First(id => id.Identifier.Text == "var");
SourceGeneration\GeneratorDriverTests.cs (2)
4062$"{syntax.Identifier.Text}.g", 4063$"partial class {syntax.Identifier.Text} {{ /* generated */ }}");
SourceGeneration\GeneratorDriverTests_Attributes_FullyQualifiedName.cs (2)
1246$"{syntax.Identifier.Text}.g", 1247$"partial class {syntax.Identifier.Text} {{ /* generated */ }}"));
SourceGeneration\SyntaxAwareGeneratorTests.cs (2)
696var classDeclarations = testReceiver.VisitedNodes.OfType<ClassDeclarationSyntax>().Select(c => c.Identifier.Text); 753var classDeclarations = testReceiver.VisitedNodes.OfType<ClassDeclarationSyntax>().Select(c => c.Identifier.Text);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (41)
Compilation\GetImportScopesTests.cs (24)
149Assert.True(scopes.Single().Imports.Any(i => i.DeclaringSyntaxReference!.GetSyntax() is UsingDirectiveSyntax { Name: IdentifierNameSyntax { Identifier.Text: nameof(System) } })); 150Assert.True(scopes.Single().Imports.Any(i => i.DeclaringSyntaxReference!.GetSyntax() is UsingDirectiveSyntax { Name: IdentifierNameSyntax { Identifier.Text: nameof(Microsoft) } })); 176Assert.True(scopes.Single().Imports.Single().DeclaringSyntaxReference!.GetSyntax() is UsingDirectiveSyntax { Name: IdentifierNameSyntax { Identifier.Text: nameof(System) } }); 199Assert.True(scopes[0].Imports.Single().DeclaringSyntaxReference!.GetSyntax() is UsingDirectiveSyntax { Name: IdentifierNameSyntax { Identifier.Text: nameof(Microsoft) } }); 201Assert.True(scopes[1].Imports.Single().DeclaringSyntaxReference!.GetSyntax() is UsingDirectiveSyntax { Name: IdentifierNameSyntax { Identifier.Text: nameof(System) } }); 227Assert.True(scopes[0].Imports.Single().DeclaringSyntaxReference!.GetSyntax() is UsingDirectiveSyntax { Name: IdentifierNameSyntax { Identifier.Text: nameof(Microsoft) } }); 229Assert.True(scopes[1].Imports.Single().DeclaringSyntaxReference!.GetSyntax() is UsingDirectiveSyntax { Name: IdentifierNameSyntax { Identifier.Text: nameof(System) } }); 338Assert.True(scopes.Single().Aliases.Any(a => a.DeclaringSyntaxReferences.Single().GetSyntax() is UsingDirectiveSyntax { Name: IdentifierNameSyntax { Identifier.Text: nameof(System) } })); 339Assert.True(scopes.Single().Aliases.Any(a => a.DeclaringSyntaxReferences.Single().GetSyntax() is UsingDirectiveSyntax { Name: IdentifierNameSyntax { Identifier.Text: nameof(Microsoft) } })); 365Assert.True(scopes.Single().Aliases.Single().DeclaringSyntaxReferences.Single().GetSyntax() is UsingDirectiveSyntax { Name: IdentifierNameSyntax { Identifier.Text: nameof(System) } }); 388Assert.True(scopes[0].Aliases.Single().DeclaringSyntaxReferences.Single().GetSyntax() is UsingDirectiveSyntax { Name: IdentifierNameSyntax { Identifier.Text: nameof(Microsoft) } }); 390Assert.True(scopes[1].Aliases.Single().DeclaringSyntaxReferences.Single().GetSyntax() is UsingDirectiveSyntax { Name: IdentifierNameSyntax { Identifier.Text: nameof(System) } }); 538Assert.True(scopes.Single().ExternAliases.Any(a => a.DeclaringSyntaxReferences.Single().GetSyntax() is ExternAliasDirectiveSyntax { Identifier.Text: "CORE1" })); 539Assert.True(scopes.Single().ExternAliases.Any(a => a.DeclaringSyntaxReferences.Single().GetSyntax() is ExternAliasDirectiveSyntax { Identifier.Text: "CORE2" })); 568Assert.True(scopes.Single().ExternAliases.Single().DeclaringSyntaxReferences.Single().GetSyntax() is ExternAliasDirectiveSyntax { Identifier.Text: "CORE1" }); 594Assert.True(scopes[0].ExternAliases.Single().DeclaringSyntaxReferences.Single().GetSyntax() is ExternAliasDirectiveSyntax { Identifier.Text: "CORE2" }); 596Assert.True(scopes[1].ExternAliases.Single().DeclaringSyntaxReferences.Single().GetSyntax() is ExternAliasDirectiveSyntax { Identifier.Text: "CORE1" }); 623Assert.True(scopes.Single().Aliases.Single().DeclaringSyntaxReferences.Single().GetSyntax() is UsingDirectiveSyntax { Alias.Name.Identifier.Text: "M" }); 626Assert.True(scopes.Single().Imports.Single().DeclaringSyntaxReference!.GetSyntax() is UsingDirectiveSyntax { Name: IdentifierNameSyntax { Identifier.Text: nameof(System) } }); 653Assert.True(scopes.Single().Aliases.Single().DeclaringSyntaxReferences.Single().GetSyntax() is UsingDirectiveSyntax { Alias.Name.Identifier.Text: "M" }); 683Assert.True(scopes.Single().Imports.Any(i => i.DeclaringSyntaxReference!.GetSyntax() is UsingDirectiveSyntax { Name: IdentifierNameSyntax { Identifier.Text: nameof(System) } })); 685Assert.True(scopes.Single().Imports.Any(i => i.DeclaringSyntaxReference!.GetSyntax() is UsingDirectiveSyntax { Name: QualifiedNameSyntax { Right: IdentifierNameSyntax { Identifier.Text: nameof(System.IO) } } })); 689Assert.True(scopes.Single().Aliases.Any(i => i.DeclaringSyntaxReferences.Single().GetSyntax() is UsingDirectiveSyntax { Name: IdentifierNameSyntax { Identifier.Text: nameof(Microsoft) } })); 691Assert.True(scopes.Single().Aliases.Any(i => i.DeclaringSyntaxReferences.Single().GetSyntax() is UsingDirectiveSyntax { Name: QualifiedNameSyntax { Right: IdentifierNameSyntax { Identifier.Text: nameof(System.Threading) } } }));
Compilation\SemanticModelAPITests.cs (9)
4611var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(ident => ident.Identifier.Text == "global").Single(); 4625var nodes = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(ident => ident.Identifier.Text == "global").ToArray(); 4644var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Single(i => i.Identifier.Text == "M"); 4661var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Single(i => i.Identifier.Text == "M2"); 4676var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Single(i => i.Identifier.Text == "M2"); 4692var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Single(i => i.Identifier.Text == "NotNullWhen"); 4708var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Single(i => i.Identifier.Text == "M2"); 4727var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Single(i => i.Identifier.Text == "M2"); 4743var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Single(i => i.Identifier.Text == "M2");
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (2)
5357.First(s => s.Left is IdentifierNameSyntax { Identifier.Text: "Thing" }) 5543.First(s => s.Left is IdentifierNameSyntax { Identifier.Text: "Thing" })
Symbols\AccessorOverriddenOrHiddenMembersTests.cs (2)
1015Assert.Equal("d", identifierSyntax.Identifier.Text); 1020Assert.Equal("Dispose", memberNameSyntax.Identifier.Text);
Symbols\SymbolExtensionTests.cs (4)
101var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().First(id => id.Identifier.Text == "var"); 119var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().First(id => id.Identifier.Text == "var"); 137var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().First(id => id.Identifier.Text == "var"); 156var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Last(id => id.Identifier.Text == "var");
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (260)
Diagnostics\DiagnosticTest.cs (2)
1991Assert.Equal(2335, defineName.Text.Length); 1997Assert.Equal(2335, errorCodeName.Text.Length);
LexicalAndXml\LexicalTests.cs (205)
487Assert.Equal("@: More text", token.Text); 524Assert.Equal("Identifier", token.Text); 616Assert.Equal(text, token.Text); 631Assert.Equal(text, token.Text); 646Assert.Equal(text, token.Text); 661Assert.Equal(text, token.Text); 676Assert.Equal(text, token.Text); 691Assert.Equal(text, token.Text); 706Assert.Equal(text, token.Text); 721Assert.Equal(text, token.Text); 738Assert.Equal(text, token.Text); 755Assert.Equal(text, token.Text); 772Assert.Equal(text, token.Text); 789Assert.Equal(text, token.Text); 806Assert.Equal(text, token.Text); 845Assert.Equal(text, token.Text); 865Assert.Equal(text, token.Text); 886Assert.Equal(text, token.Text); 965Assert.Equal(text, token.Text); 980Assert.Equal(text, token.Text); 995Assert.Equal(text, token.Text); 1010Assert.Equal(text, token.Text); 1025Assert.Equal(text, token.Text); 1040Assert.NotEqual(text, token.Text); 1056Assert.Equal(text, token.Text); 1072Assert.Equal(text, token.Text); 1089Assert.Equal(text, token.Text); 1105Assert.Equal(text, token.Text); 1121Assert.Equal(text, token.Text); 1137Assert.Equal(text, token.Text); 1156Assert.Equal(text, token.Text); 1175Assert.Equal(text, token.Text); 1193Assert.Equal(text, token.Text); 1209Assert.Equal(text, token.Text); 1225Assert.Equal(text, token.Text); 1241Assert.Equal(text, token.Text); 1257Assert.Equal(text, token.Text); 1273Assert.Equal(text, token.Text); 1289Assert.Equal(text, token.Text); 1305Assert.Equal(text, token.Text); 1321Assert.Equal(text, token.Text); 1337Assert.Equal(text, token.Text); 1354Assert.Equal(text, token.Text); 1370Assert.Equal(text, token.Text); 1386Assert.Equal(text, token.Text); 1402Assert.Equal(text, token.Text); 1418Assert.Equal(text, token.Text); 1434Assert.Equal(text, token.Text); 1450Assert.Equal(text, token.Text); 1466Assert.Equal(text, token.Text); 1482Assert.Equal(text, token.Text); 1498Assert.Equal(text, token.Text); 1515Assert.Equal(text, token.Text); 1532Assert.Equal("'a", token.Text); 1548Assert.Equal("'", token.Text); 1566Assert.Equal("'ab", token.Text); 1586Assert.Equal("'\uFFFF'", token.Text); 1604Assert.Equal(text, token.Text); 1619Assert.Equal(text, token.Text); 1634Assert.Equal(text, token.Text); 1649Assert.Equal(text, token.Text); 1712Assert.Equal(text, token.Text); 1728Assert.Equal(text, token.Text); 1744Assert.Equal(text, token.Text); 1760Assert.Equal(text, token.Text); 1776Assert.Equal(text, token.Text); 1792Assert.Equal(text, token.Text); 1808Assert.Equal(text, token.Text); 1823Assert.Equal(text, token.Text); 1838Assert.Equal(text, token.Text); 1853Assert.Equal(text, token.Text); 1868Assert.Equal(text, token.Text); 1883Assert.Equal(text, token.Text); 1898Assert.Equal(text, token.Text); 1920Assert.Equal(text, token.Text); 1936Assert.Equal(text, token.Text); 1950Assert.Equal(text, token.Text); 1966Assert.Equal(text, token.Text); 1980Assert.Equal(text, token.Text); 1995Assert.Equal(text, token.Text); 2011Assert.Equal(text, token.Text); 2027Assert.Equal(text, token.Text); 2043Assert.Equal(text, token.Text); 2059Assert.Equal(text, token.Text); 2075Assert.Equal(text, token.Text); 2091Assert.Equal(text, token.Text); 2107Assert.Equal(text, token.Text); 2123Assert.Equal(text, token.Text); 2139Assert.Equal(text, token.Text); 2155Assert.Equal(text, token.Text); 2171Assert.Equal(text, token.Text); 2187Assert.Equal(text, token.Text); 2203Assert.Equal(text, token.Text); 2219Assert.Equal(text, token.Text); 2235Assert.Equal(text, token.Text); 2251Assert.Equal(text, token.Text); 2267Assert.Equal(text, token.Text); 2277Assert.Equal(text, token.Text); 2293Assert.Equal(text, token.Text); 2303Assert.Equal(text, token.Text); 2319Assert.Equal(text, token.Text); 2329Assert.Equal(text, token.Text); 2345Assert.Equal(text, token.Text); 2355Assert.Equal(text, token.Text); 2371Assert.Equal(text, token.Text); 2381Assert.Equal(text, token.Text); 2397Assert.Equal(text, token.Text); 2406Assert.Equal(text, token.Text); 2422Assert.Equal(text, token.Text); 2432Assert.Equal(text, token.Text); 2448Assert.Equal(text, token.Text); 2458Assert.Equal(text, token.Text); 2473Assert.Equal(text, token.Text); 2488Assert.Equal(text, token.Text); 2498Assert.Equal(text, token.Text); 2514Assert.Equal(text, token.Text); 2523Assert.Equal(text, token.Text); 2539Assert.Equal(text, token.Text); 2549Assert.Equal(text, token.Text); 2565Assert.Equal(text, token.Text); 2575Assert.Equal(text, token.Text); 2590Assert.Equal(text, token.Text); 2605Assert.Equal(text, token.Text); 2621Assert.Equal(text, token.Text); 2637Assert.Equal(text, token.Text); 2653Assert.Equal(text, token.Text); 2669Assert.Equal(text, token.Text); 2683Assert.Equal(text, token.Text); 2698Assert.Equal(text, token.Text); 2713Assert.Equal(text, token.Text); 2729Assert.Equal(text, token.Text); 2744Assert.Equal(text, token.Text); 2760Assert.Equal(text, token.Text); 2776Assert.Equal(text, token.Text); 2792Assert.Equal(text, token.Text); 2808Assert.Equal(text, token.Text); 2824Assert.Equal(text, token.Text); 2840Assert.Equal(text, token.Text); 2856Assert.Equal(text, token.Text); 2872Assert.Equal(text, token.Text); 2888Assert.Equal(text, token.Text); 2904Assert.Equal(text, token.Text); 2920Assert.Equal(text, token.Text); 2936Assert.Equal(text, token.Text); 2952Assert.Equal(text, token.Text); 2968Assert.Equal(text, token.Text); 2984Assert.Equal(text, token.Text); 3000Assert.Equal(text, token.Text); 3016Assert.Equal(text, token.Text); 3033Assert.Equal(text, token.Text); 3049Assert.Equal(text, token.Text); 3063Assert.Equal(text, token.Text); 3072Assert.Equal(text, token.Text); 3081Assert.Equal(text, token.Text); 3090Assert.Equal(text, token.Text); 3099Assert.Equal(text, token.Text); 3108Assert.Equal(text, token.Text); 3117Assert.Equal(text, token.Text); 3131Assert.Equal(text, token.Text); 3145Assert.Equal(text, token.Text); 3154Assert.Equal(text, token.Text); 3163Assert.Equal(text, token.Text); 3172Assert.Equal(text, token.Text); 3186Assert.Equal(text, token.Text); 3195Assert.Equal(text, token.Text); 3204Assert.Equal(text, token.Text); 3214Assert.Equal(text, token.Text); 3237Assert.Equal(text, token.Text); 3248Assert.Equal(text, token.Text); 3263Assert.Equal(text, token.Text); 3274Assert.Equal(text, token.Text); 3285Assert.Equal(text, token.Text); 3296Assert.Equal(text, token.Text); 3307Assert.Equal(text, token.Text); 3318Assert.Equal(text, token.Text); 3329Assert.Equal(text, token.Text); 3340Assert.Equal(text, token.Text); 3351Assert.Equal(text, token.Text); 3362Assert.Equal(text, token.Text); 3374Assert.Equal(text, token.Text); 3389Assert.Equal("3", token.Text); 3405Assert.Equal(text, token.Text); 3421Assert.Equal(text, token.Text); 3437Assert.Equal(text, token.Text); 3458Assert.Equal(text, token.Text); 3468Assert.Equal(text, token.Text); 3478Assert.Equal(text.Substring(0, text.Length - 1), token.Text); 3488Assert.Equal("@", token.Text); 3494Assert.Equal("@0x0", token.Text); 3500Assert.Equal("@0X012345678", token.Text); 3506Assert.Equal("@0x9abcdefA", token.Text); 3512Assert.Equal("@0xBCDEF", token.Text); 3518Assert.Equal("@", token.Text); 3524Assert.Equal("@", token.Text); 3530Assert.Equal("@", token.Text); 3536Assert.Equal("@", token.Text); 3542Assert.Equal("@0xffff0000ffff0000ffff0000", token.Text); 3562Assert.Equal(text, token.Text); 3572Assert.Equal(text, token.Text); 3582Assert.Equal(text.Substring(0, text.Length - 1), token.Text); 3592Assert.Equal(text.Substring(0, text.Length - 1), token.Text); 3603Assert.Equal(text, token.Text); 3615Assert.Equal("token", token.Text); 3633Assert.Equal("token", token.Text); 3653Assert.Equal("to\uFEFFken\uFEFF", token.Text);
LexicalAndXml\PreprocessorTests.cs (2)
237Assert.Equal(String.Empty, ld.Line.Text); 242Assert.Equal(exp.Number, Int32.Parse(ld.Line.Text));
LexicalAndXml\XmlDocCommentTests.cs (7)
1132Assert.Equal("ProcessingInstruction", ProcessingInstruction.Name.LocalName.Text); 1164Assert.Equal("prefix", ProcessingInstruction.Name.Prefix.Prefix.Text); 1165Assert.Equal(":", ProcessingInstruction.Name.Prefix.ColonToken.Text); 1166Assert.Equal("localname", ProcessingInstruction.Name.LocalName.Text); 1196Assert.Equal("incomplete", ProcessingInstruction.Name.LocalName.Text); 1222Assert.Equal("name", ProcessingInstruction.Name.LocalName.Text); 1249Assert.Equal("name", ProcessingInstruction.Name.LocalName.Text);
Syntax\SyntaxFactoryTests.cs (8)
26Assert.Equal("$@\"", token.Text); 219Assert.Equal(text, token.Text); 387Assert.Equal("\"\\u2028\"", literal.Text); 395Assert.Equal("'\\udbff'", literal.Text); 424Assert.Equal("1l", literal.Text); 438Assert.Equal("1L", literal.Text); 449Assert.Equal("1l", expression.Token.Text); 463Assert.Equal("1L", expression.Token.Text);
Syntax\SyntaxNodeTests.cs (26)
85var e = expression.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "e"); 103var e = expression.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "e"); 122var e = expression.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "e"); 1035Assert.Equal("garbage", tokens[0].Text); 1135Assert.Equal("garbage", tokens[0].Text); 2254var bToken = expr.DescendantTokens().First(t => t.Text == "b"); 2291var identifierC = cu.DescendantTokens().First(t => t.Text == "C"); 2322var identifierC = cu.DescendantTokens().First(t => t.Text == "C"); 2395var trivia = expr.DescendantTokens().First(t => t.Text == "a").TrailingTrivia[0]; 2479var b = expr.DescendantTokens().Where(t => t.Text == "b").Select(t => t.Parent.FirstAncestorOrSelf<ArgumentSyntax>()).FirstOrDefault(); 2494var b = expr.DescendantTokens().Where(t => t.Text == "b").Select(t => t.Parent.FirstAncestorOrSelf<ArgumentSyntax>()).FirstOrDefault(); 2510var b = expr.DescendantTokens().Where(t => t.Text == "b").Select(t => t.Parent.FirstAncestorOrSelf<ArgumentSyntax>()).FirstOrDefault(); 2527var b = expr.DescendantTokens().Where(t => t.Text == "b").Select(t => t.Parent.FirstAncestorOrSelf<ArgumentSyntax>()).FirstOrDefault(); 2548var b = expr.DescendantTokens().Where(t => t.Text == "b").Select(t => t.Parent.FirstAncestorOrSelf<ArgumentSyntax>()).FirstOrDefault(); 2567var b = expr.DescendantTokens().Where(t => t.Text == "b").Select(t => t.Parent.FirstAncestorOrSelf<ArgumentSyntax>()).FirstOrDefault(); 2583var b = expr.DescendantTokens().Where(t => t.Text == "b").Select(t => t.Parent.FirstAncestorOrSelf<ArgumentSyntax>()).FirstOrDefault(); 2599var b = expr.DescendantTokens().Where(t => t.Text == "b").Select(t => t.Parent.FirstAncestorOrSelf<ArgumentSyntax>()).FirstOrDefault(); 2615var b = expr.DescendantTokens().Where(t => t.Text == "b").Select(t => t.Parent.FirstAncestorOrSelf<ArgumentSyntax>()).FirstOrDefault(); 2635var b = expr.DescendantTokens().Where(t => t.Text == "b").Select(t => t.Parent.FirstAncestorOrSelf<ArgumentSyntax>()).FirstOrDefault(); 2652var n = expr.DescendantTokens().Where(t => t.Text == "a").Select(t => t.Parent.FirstAncestorOrSelf<ArgumentSyntax>()).FirstOrDefault(); 2666var n = expr.DescendantTokens().Where(t => t.Text == "a").Select(t => t.Parent.FirstAncestorOrSelf<ArgumentSyntax>()).FirstOrDefault(); 2680var n = expr.DescendantTokens().Where(t => t.Text == "c").Select(t => t.Parent.FirstAncestorOrSelf<ArgumentSyntax>()).FirstOrDefault(); 2694var b = expr.DescendantTokens().Where(t => t.Text == "b").Select(t => t.Parent.FirstAncestorOrSelf<StatementSyntax>()).FirstOrDefault(); 2708var b = expr.DescendantTokens().Where(t => t.Text == "b").Select(t => t.Parent.FirstAncestorOrSelf<StatementSyntax>()).FirstOrDefault(); 3842var a = expression.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "a"); 3843var e = expression.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "e");
Syntax\TrackNodeTests.cs (10)
24var a = expr.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "a"); 35var a = expr.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "a"); 47var a = expr.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "a"); 56var a = expr.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "a"); 66var originalA = expr.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "a"); 81var originalA = expr.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "a"); 97var originalA = expr.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "a"); 109var originalA = expr.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "a"); 122var originalA = expr.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "a"); 134var originalA = expr.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "a");
Microsoft.CodeAnalysis.CSharp.Workspaces (37)
Classification\SyntaxClassification\DiscardSyntaxClassifier.cs (2)
36case ParameterSyntax parameter when parameter.Identifier.Text == "_": 46case IdentifierNameSyntax identifierName when identifierName.Identifier.Text == "_":
Classification\SyntaxClassification\NameSyntaxClassifier.cs (2)
158if (name is IdentifierNameSyntax { Identifier.Text: "args" } && 323name is IdentifierNameSyntax { Identifier.Text: "async" or "nameof" or "partial" })
Classification\Worker.cs (1)
133token.Text.EndsWith("u8", StringComparison.OrdinalIgnoreCase))
CodeGeneration\CSharpSyntaxGenerator.cs (1)
1382TypeDeclarationSyntax typeDeclaration => AsClassMember(member, typeDeclaration.Identifier.Text),
FindSymbols\CSharpDeclaredSymbolInfoFactoryService.cs (5)
527builder.Append(parameter.Identifier.Text); 574builder.Append(modifier.Text); 584builder.Append(parameter.Identifier.Text); 705var text = identifierNameNode.Identifier.Text; 714var name = genericNameNode.Identifier.Text;
Rename\CSharpRenameRewriterLanguageService.cs (1)
275&& _replacementText.Equals(prefix + "_" + property.Identifier.Text, StringComparison.Ordinal);
Simplification\Simplifiers\AbstractCSharpSimplifier.cs (1)
389identifierName.Identifier.Text == "nameof" &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\CSharpVirtualCharService.cs (3)
132var tokenText = token.Text; 193var tokenSourceText = SourceText.From(token.Text); 234var tokenText = token.Text;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ExpressionSyntaxExtensions.cs (1)
429name.Identifier.Text == SyntaxFacts.GetText(SyntaxKind.NameOfKeyword))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ParenthesizedExpressionSyntaxExtensions.cs (2)
48var previousChar = tokenBeforeParen.Text.LastOrDefault(); 49var nextChar = tokenAfterParen.Text.FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.SingleLineRewriter.cs (2)
62if (s_newlinePattern.IsMatch(token.Text)) 64var newText = s_newlinePattern.Replace(token.Text, " ");
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTreeExtensions.cs (1)
373(token.Span.Length > startDelimeterLength && token.Text[^1] != lastChar);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (4)
343SyntaxKind.IdentifierToken => token.Text switch 822return identifier.IsMissing ? missingTokenPlaceholder : identifier.Text; 845name = nameToken.IsMissing ? missingTokenPlaceholder : nameToken.Text; 874name = nameToken.IsMissing ? missingTokenPlaceholder : nameToken.Text;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EnumMemberGenerator.cs (1)
134LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(numericLiteral.Token.Text, 1)),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Editing\CSharpImportAdder.cs (2)
204if (!_importedTypes.ContainsKey((node.Identifier.Text, node.Arity))) 211=> _importedExtensionMethods.ContainsKey(node.Name.Identifier.Text);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs (1)
700token.Text == "dynamic";
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (4)
1112else if (token.IsKind(SyntaxKind.IdentifierToken) && token.Text == "scoped" && token.Parent is IdentifierNameSyntax scopedIdentifierName) 1269else if (token.IsKind(SyntaxKind.IdentifierToken) && token.Text == "scoped" && token.Parent is IdentifierNameSyntax scopedIdentifierName && scopedIdentifierName.Parent.IsKind(SyntaxKind.Parameter)) 1865if (token.IsKind(SyntaxKind.IdentifierToken) && token.Text == "scoped" && token.Parent.IsKind(SyntaxKind.IdentifierName) && token.Parent.Parent is VariableDeclarationSyntax or ExpressionStatementSyntax or IncompleteMemberSyntax) 2879if (token.Text == SyntaxFacts.GetText(SyntaxKind.AsyncKeyword))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpReplaceDiscardDeclarationsWithAssignmentsService.cs (3)
81text: discardSyntax.UnderscoreToken.Text, 121=> variable.Identifier.Text == DiscardVariableName; 123=> catchDeclaration.Identifier.Text == DiscardVariableName;
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (1)
Formatting\FormattingElasticTriviaTests.cs (1)
111var decl = generator.GetDeclaration(root.DescendantNodes().OfType<VariableDeclaratorSyntax>().First(vd => vd.Identifier.Text == "f2"));
Microsoft.CodeAnalysis.Features (8)
ConvertToInterpolatedString\AbstractConvertConcatenationToInterpolatedStringRefactoringProvider.cs (2)
155var text = piece.GetFirstToken().Text; 259var existingText = interpolatedStringTextNode.GetFirstToken().Text;
ConvertToInterpolatedString\ConvertRegularStringToInterpolatedStringRefactoringProvider.cs (1)
93var text = literalExpression.GetFirstToken().Text;
EmbeddedLanguages\Classification\AbstractFallbackEmbeddedLanguageClassifier.cs (1)
43if (virtualChars.Length == token.Text.Length)
InlineMethod\AbstractInlineMethodRefactoringProvider.cs (1)
498.LocalDeclarationStatement(calleeMethodSymbol.ReturnType, unusedLocalName.Text,
InlineMethod\AbstractInlineMethodRefactoringProvider.InlineContext.cs (1)
373cancellationToken).Text;
SpellCheck\AbstractSpellCheckSpanService.cs (1)
131token.Text.AsSpan().IndexOf(escapeChar.Value) >= 0)
src\Analyzers\Core\Analyzers\UseCollectionInitializer\UpdateExpressionState.cs (1)
390requiredArgumentName: identifier.Text,
Microsoft.CodeAnalysis.VisualBasic (2)
Syntax\SyntaxFactory.vb (2)
923If rewrittenToken.IsKind(SyntaxKind.LessThanToken) AndAlso String.Equals("<", rewrittenToken.Text, StringComparison.Ordinal) Then 927If rewrittenToken.IsKind(SyntaxKind.GreaterThanToken) AndAlso String.Equals(">", rewrittenToken.Text, StringComparison.Ordinal) Then
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (5)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SingleLineRewriter.vb (2)
46If s_newlinePattern.IsMatch(token.Text) Then 47Dim newText = s_newlinePattern.Replace(token.Text, " ")
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Services\SyntaxFacts\VisualBasicSyntaxFacts.vb (3)
1009Return If(identifier.IsMissing, missingTokenPlaceholder, identifier.Text) 1053builder.Append(typeParameterList.Parameters(0).Identifier.Text) 1056builder.Append(typeParameterList.Parameters(i).Identifier.Text)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (6)
src\Analyzers\VisualBasic\CodeFixes\DocumentationComments\VisualBasicRemoveDocCommentNodeCodeFixProvider.vb (1)
76Return token.Kind() = SyntaxKind.XmlTextLiteralToken AndAlso IsWhitespace(token.Text)
src\Analyzers\VisualBasic\CodeFixes\Iterator\VisualBasicConvertToIteratorCodeFixProvider.vb (1)
47If String.Compare(identifier.Identifier.Text, "Yield", StringComparison.OrdinalIgnoreCase) <> 0 Then
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\EnumMemberGenerator.vb (1)
99left:=SyntaxFactory.NumericLiteralExpression(SyntaxFactory.IntegerLiteralToken(numericLiteral.Token.Text, LiteralBase.Decimal, TypeCharacter.None, 1)),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Editing\VisualBasicImportAdder.vb (3)
190If _importedTypesAndNamespaces.ContainsKey((node.Identifier.Text, node.Arity)) Then 194If _importedMembers.ContainsKey(node.Identifier.Text) Then 202Return _importedExtensionMethods.ContainsKey(node.Name.Identifier.Text)
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures (2)
TextStructureNavigation\VisualBasicTextStructureNavigatorProvider.vb (2)
38If position = token.Span.End - 1 AndAlso token.Text.EndsWith("""", StringComparison.Ordinal) Then 61If token.Kind() = SyntaxKind.StringLiteralToken AndAlso position.Position = token.Span.End - 1 AndAlso token.Text.EndsWith("""", StringComparison.Ordinal) Then
Microsoft.CodeAnalysis.VisualBasic.Features (6)
EditAndContinue\SyntaxComparer.vb (4)
1395oldToken.Text, Math.Min(oldToken.Text.Length, LongestCommonSubsequence.MaxSequenceLengthForDistanceCalculation), 1396newToken.Text, Math.Min(newToken.Text.Length, LongestCommonSubsequence.MaxSequenceLengthForDistanceCalculation))
src\Analyzers\VisualBasic\CodeFixes\DocumentationComments\VisualBasicRemoveDocCommentNodeCodeFixProvider.vb (1)
76Return token.Kind() = SyntaxKind.XmlTextLiteralToken AndAlso IsWhitespace(token.Text)
src\Analyzers\VisualBasic\CodeFixes\Iterator\VisualBasicConvertToIteratorCodeFixProvider.vb (1)
47If String.Compare(identifier.Identifier.Text, "Yield", StringComparison.OrdinalIgnoreCase) <> 0 Then
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (2)
Compilation\GetImportScopesTests.vb (2)
55name = DirectCast(syntax, IdentifierNameSyntax).Identifier.Text 60Return TypeOf syntax Is SimpleImportsClauseSyntax AndAlso DirectCast(syntax, SimpleImportsClauseSyntax).Alias.Identifier.Text = name
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (2)
SymbolDisplay\ObjectDisplayTests.vb (2)
186Assert.Equal("ChrW(8232) & ""x""", literal.Text) 188Assert.Equal("ChrW(56319)", literal.Text)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (14)
FindSymbols\VisualBasicDeclaredSymbolInfoFactoryService.vb (4)
479builder.Append(parameter.Identifier.Text) 528builder.Append(modifier.Text) 590Dim text = identifierName.Identifier.Text 601Dim name = genericName.Identifier.Text
Simplification\Simplifiers\NameSimplifier.vb (1)
172If token.Text = valueText OrElse (inDeclarationContext OrElse inMemberAccessContext) Then
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SingleLineRewriter.vb (2)
46If s_newlinePattern.IsMatch(token.Text) Then 47Dim newText = s_newlinePattern.Replace(token.Text, " ")
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Services\SyntaxFacts\VisualBasicSyntaxFacts.vb (3)
1009Return If(identifier.IsMissing, missingTokenPlaceholder, identifier.Text) 1053builder.Append(typeParameterList.Parameters(0).Identifier.Text) 1056builder.Append(typeParameterList.Parameters(i).Identifier.Text)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\EnumMemberGenerator.vb (1)
99left:=SyntaxFactory.NumericLiteralExpression(SyntaxFactory.IntegerLiteralToken(numericLiteral.Token.Text, LiteralBase.Decimal, TypeCharacter.None, 1)),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Editing\VisualBasicImportAdder.vb (3)
190If _importedTypesAndNamespaces.ContainsKey((node.Identifier.Text, node.Arity)) Then 194If _importedMembers.ContainsKey(node.Identifier.Text) Then 202Return _importedExtensionMethods.ContainsKey(node.Name.Identifier.Text)
Microsoft.CodeAnalysis.Workspaces (4)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (1)
144var tokenText = token.Text;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\IVirtualCharService.cs (2)
53/// cref="SyntaxToken.Text"/> 58/// cref="SyntaxToken.Text"/> of the token between the quotes maps to each character in the
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\AbstractDocumentationCommentService.cs (1)
135sb.Append(GetIdentifier(xmlName).Text);
Microsoft.DotNet.GenFacades (1)
TypeParser.cs (1)
173if (modifier.Text == "public")
Microsoft.Extensions.Logging.Generators (7)
LoggerMessageGenerator.Parser.cs (7)
313Diag(DiagnosticDescriptors.ShouldntReuseEventIds, ma.GetLocation(), lm.EventId, classDec.Identifier.Text); 319Diag(DiagnosticDescriptors.ShouldntReuseEventNames, ma.GetLocation(), lm.EventName, classDec.Identifier.Text); 343if (paramSyntax != null && !string.IsNullOrEmpty(paramSyntax.Identifier.Text)) 345needsAtSign = paramSyntax.Identifier.Text[0] == '@'; 458Diag(DiagnosticDescriptors.MultipleLoggerFields, method.GetLocation(), classDec.Identifier.Text); 463Diag(DiagnosticDescriptors.MissingLoggerField, method.GetLocation(), classDec.Identifier.Text); 701Diag(DiagnosticDescriptors.PrimaryConstructorParameterLoggerHidden, parameter.Locations[0], classDec.Identifier.Text);
Microsoft.Gen.ComplianceReports (1)
src\Generators\Shared\GeneratorUtilities.cs (1)
95return shortAttributeNames.Contains(id.Identifier.Text);
Microsoft.Gen.ContextualOptions (2)
Model\OptionsContextType.cs (1)
17public string Keyword => Definitions[0].Keyword.Text;
src\Generators\Shared\GeneratorUtilities.cs (1)
95return shortAttributeNames.Contains(id.Identifier.Text);
Microsoft.Gen.ContextualOptions.Unit.Tests (2)
SyntaxContextReceiverTests.cs (2)
36Assert.Equal(declaration.Key.Name, declaration.Value.Single().Identifier.Text); 75Assert.All(declaration.Value.Select(dec => dec.Identifier.Text), className => Assert.Equal("Class2", className));
Microsoft.Gen.Logging (8)
Parsing\Parser.cs (5)
229Diag(DiagDescriptors.MultipleLoggerMembers, secondLoggerMember.GetLocation(), typeDec.Identifier.Text); 234Diag(DiagDescriptors.MissingLoggerMember, method.Identifier.GetLocation(), typeDec.Identifier.Text); 524if (!string.IsNullOrEmpty(paramSyntax!.Identifier.Text)) 526needsAtSign = paramSyntax.Identifier.Text[0] == '@'; 723Diag(DiagDescriptors.PrimaryConstructorParameterLoggerHidden, parameter.GetLocation(), classDec.Identifier.Text);
Parsing\Parser.LogProperties.cs (2)
78PropertyDeclarationSyntax propertySyntax => propertySyntax.Identifier.Text, // a regular property 79ParameterSyntax paramSyntax => paramSyntax.Identifier.Text, // a property of a "record"
src\Generators\Shared\GeneratorUtilities.cs (1)
95return shortAttributeNames.Contains(id.Identifier.Text);
Microsoft.Gen.Metrics (1)
src\Generators\Shared\GeneratorUtilities.cs (1)
95return shortAttributeNames.Contains(id.Identifier.Text);
Microsoft.Gen.MetricsReports (1)
src\Generators\Shared\GeneratorUtilities.cs (1)
95return shortAttributeNames.Contains(id.Identifier.Text);
Microsoft.Interop.ComInterfaceGenerator (1)
VirtualMethodPointerStubGenerator.cs (1)
166MethodDeclaration(returnType, $"ABI_{methodStub.StubMethodSyntaxTemplate.Identifier.Text}")
Microsoft.Interop.LibraryImportGenerator (3)
Analyzers\ConvertToLibraryImportFixer.cs (2)
563string name = arg.NameEquals.Name.Identifier.Text; 676return arg.NameEquals != null && arg.NameEquals.Name.Identifier.Text == nameToMatch;
LibraryImportGenerator.cs (1)
369pinvokeStub.StubMethodSyntaxTemplate.Identifier.Text);
Microsoft.Interop.LibraryImportGenerator.Downlevel (1)
DownlevelLibraryImportGenerator.cs (1)
263pinvokeStub.StubMethodSyntaxTemplate.Identifier.Text);
Microsoft.Interop.SourceGeneration (1)
MethodSignatureDiagnosticLocations.cs (1)
48: this(syntax.Identifier.Text, syntax.ParameterList.Parameters.Select(p => p.Identifier.GetLocation()).ToImmutableArray(), syntax.Identifier.GetLocation())
Microsoft.ML.InternalCodeAnalyzer (8)
ContractsCheckNameofFixProvider.cs (1)
73var sameNameNodes = argList.DescendantTokens().Where(tok => tok.Text == nameArgValue)
NameAnalyzer.cs (3)
34string text = identifier.Text; 136if (!Utils.NameIsGood(token.Text, 0, true)) 159var name = identifier.Text;
NameFixProvider.cs (1)
61if (token.Text != originalName)
ParameterVariableNameAnalyzer.cs (1)
56var name = identifier.Text;
SingleVariableDeclarationAnalyzer.cs (1)
46string jointVariableNames = string.Join("', '", vars.Select(v => v.Identifier.Text));
TypeParamNameAnalyzer.cs (1)
43var name = identifier.Text;
Microsoft.VisualStudio.LanguageServices.CSharp (3)
LanguageService\CSharpHelpContextService.cs (3)
361text = $"#{token.Text}"; 378if (token.Text == "nameof") 521text = Keyword(token.Text);
Microsoft.VisualStudio.LanguageServices.VisualBasic (17)
Help\VisualBasicHelpContextService.vb (1)
44Return "vb." + token.Text
Help\VisualBasicHelpContextService.Visitor.vb (14)
126result = Keyword(node.OperatorToken.Text) 130result = Keyword(node.CallKeyword.Text) 134result = Keyword(node.WhenKeyword.Text) 146result = Keyword(node.ContinueKeyword.Text) 151result = Keyword(node.DeclareKeyword.Text) 156result = Keyword(node.DelegateKeyword.Text) 170result = Keyword(node.ThenKeyword.Text) 178result = Keyword(node.ThenKeyword.Text) 186result = Keyword(node.ThenKeyword.Text) 205result = Keyword(node.Keyword.Text) 213result = Keyword(node.AsKeyword.Text) 291result = Keyword(node.GetXmlNamespaceKeyword.Text) 390result = Keyword(node.DeclarationKeyword.Text) 778result = Keyword(modifier.Text)
Venus\VisualBasicContainedLanguage.vb (2)
183multiLineLambda.SubOrFunctionHeader.ParameterList.Parameters(0).Identifier.Identifier.Text <> "__razor_helper_writer" Then 208Not String.Equals(helperToken.Text, "Helper", StringComparison.OrdinalIgnoreCase) Then
System.Private.CoreLib.Generators (2)
IntrinsicsInSystemPrivateCoreLibAnalyzer.cs (2)
200if (memberAccessExpression.Name is IdentifierNameSyntax identifierName && identifierName.Identifier.Text == "IsSupported") 215if (identifierName.Identifier.Text == "IsSupported")
System.Text.Json.SourceGeneration (1)
JsonSourceGenerator.Parser.cs (1)
180stringBuilder.Append(modifier.Text);