355 references to SyntaxTree
Microsoft.AspNetCore.App.Analyzers (4)
RouteEmbeddedLanguage\RoutePatternAnalyzer.cs (3)
30var syntaxTree = semanticModel.SyntaxTree; 62Location.Create(context.SemanticModel.SyntaxTree, diag.Span), 105Location.Create(context.SemanticModel.SyntaxTree, unusedParameter.Span),
RouteHandlers\RouteHandlerAnalyzer.cs (1)
128var methodOperation = syntaxNode.SyntaxTree == invocation.SemanticModel!.SyntaxTree
Microsoft.CodeAnalysis (21)
DiagnosticAnalyzer\AnalysisContextInfo.cs (1)
28this(model.Compilation, new SourceOrAdditionalFile(model.SyntaxTree))
DiagnosticAnalyzer\AnalyzerDriver.cs (2)
1905if (!analysisScope.ShouldAnalyze(semanticModel.SyntaxTree)) 1910var isGeneratedCode = IsGeneratedCode(semanticModel.SyntaxTree, cancellationToken);
DiagnosticAnalyzer\AnalyzerExecutor.cs (10)
520IsAnalyzerSuppressedForTree(analyzer, semanticModel.SyntaxTree, cancellationToken)) 525var diagReporter = GetAddSemanticDiagnostic(semanticModel.SyntaxTree, analyzer, cancellationToken); 673Debug.Assert(!IsAnalyzerSuppressedForTree(operationAction.Analyzer, semanticModel.SyntaxTree, cancellationToken)); 791var diagReporter = GetAddSemanticDiagnostic(semanticModel.SyntaxTree, declaredNode.FullSpan, analyzer, cancellationToken); 968IsAnalyzerSuppressedForTree(analyzer, model.SyntaxTree, cancellationToken)) 973var diagReporter = GetAddSemanticDiagnostic(model.SyntaxTree, spanForContainingTopmostNodeForAnalysis, analyzer, cancellationToken); 997Debug.Assert(!IsAnalyzerSuppressedForTree(analyzer, model.SyntaxTree, cancellationToken)); 1069IsAnalyzerSuppressedForTree(analyzer, model.SyntaxTree, cancellationToken)) 1074var diagReporter = GetAddSemanticDiagnostic(model.SyntaxTree, spanForContainingOperationBlock, analyzer, cancellationToken); 1097Debug.Assert(!IsAnalyzerSuppressedForTree(analyzer, model.SyntaxTree, cancellationToken));
DiagnosticAnalyzer\CompilationWithAnalyzers.cs (3)
193if (!_compilation.ContainsSyntaxTree(model.SyntaxTree)) 653var analysisScope = AnalysisScope.Create(analyzers, new SourceOrAdditionalFile(model.SyntaxTree), filterSpan, isSyntacticSingleFileAnalysis: false, this); 660var analysisScope = AnalysisScope.Create(analyzers, new SourceOrAdditionalFile(model.SyntaxTree), filterSpan, isSyntacticSingleFileAnalysis: false, this);
DiagnosticAnalyzer\DiagnosticAnalysisContext.cs (2)
717/// Indicates if the underlying <see cref="SemanticModel.SyntaxTree"/> is generated code. 740FilterTree = semanticModel.SyntaxTree;
Operations\OperationExtensions.cs (1)
51if (model is null || model.SyntaxTree != operation.Syntax.SyntaxTree)
SourceGeneration\GeneratorSyntaxWalker.cs (2)
26&& model.Value.SyntaxTree == node.SyntaxTree); 30Debug.Assert(model.Value.SyntaxTree == child.SyntaxTree);
Microsoft.CodeAnalysis.CodeStyle (17)
src\Analyzers\Core\Analyzers\RemoveUnnecessaryCast\AbstractRemoveUnnecessaryCastDiagnosticAnalyzer.cs (1)
65var tree = model.SyntaxTree;
src\Analyzers\Core\Analyzers\RemoveUnnecessaryImports\AbstractRemoveUnnecessaryImportsDiagnosticAnalyzer.cs (1)
87var tree = context.SemanticModel.SyntaxTree;
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (5)
98var tree = semanticModel.SyntaxTree; 464var analysisResult = await compilationWithAnalyzers.GetAnalysisResultAsync(semanticModel.SyntaxTree, analyzers, cancellationToken).ConfigureAwait(false); 466if (analysisResult.SyntaxDiagnostics.TryGetValue(semanticModel.SyntaxTree, out var diagnostics)) 473if (analysisResult.SemanticDiagnostics.TryGetValue(semanticModel.SyntaxTree, out diagnostics)) 478AddAllCompilationDiagnosticsForTree(analysisResult, semanticModel.SyntaxTree, reportedDiagnostics);
src\Analyzers\Core\Analyzers\SimplifyTypeNames\SimplifyTypeNamesDiagnosticAnalyzerBase.cs (3)
125if (model.SyntaxTree.OverlapsHiddenPosition(issueSpan, cancellationToken)) 163var tree = model.SyntaxTree; 273var (completed, intervalTree) = _codeBlockIntervals.GetOrAdd(context.SemanticModel.SyntaxTree, syntaxTree => (new StrongBox<bool>(true), null));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\AnalysisContextExtensions.cs (1)
157=> context.SemanticModel.SyntaxTree.FindNode(context.FilterSpan, findInTrivia, getInnermostNodeForTie, context.CancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Helpers\RemoveUnnecessaryImports\AbstractUnnecessaryImportsProvider.cs (1)
32var node = model.SyntaxTree.FindNode(span, findInTrivia: false, getInnermostNodeForTie: false, cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.BodyLevelSymbolKey.cs (1)
258Contract.ThrowIfTrue(semanticModel.SyntaxTree != containerDeclaration.SyntaxTree);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AliasSymbolCache.cs (2)
37!treeMap.TryGetValue((semanticModel.SyntaxTree, namespaceId), out var symbolMap)) 55var key = (tree: semanticModel.SyntaxTree, namespaceId);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\ISpeculationAnalyzer.cs (2)
11/// <see cref="SemanticModel.SyntaxTree"/> that <see cref="OriginalSemanticModel"/> points at. 17/// cref="SemanticModel.SyntaxTree"/> that <see cref="SpeculativeSemanticModel"/> points at.
Microsoft.CodeAnalysis.CodeStyle.Fixes (12)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ContextQuery\SyntaxContext.cs (1)
93this.SyntaxTree = semanticModel.SyntaxTree;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions.cs (1)
473var condition = generatorInternal.SupportsPatterns(semanticModel.SyntaxTree.Options)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (1)
74factory, generatorInternal, semanticModel.Compilation, semanticModel.SyntaxTree.Options, containingType, symbols);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_Negate.cs (4)
65var options = semanticModel.SyntaxTree.Options; 186else if (operation is IIsTypeOperation { TypeOperand.SpecialType: SpecialType.System_Object } && generatorInternal.SupportsPatterns(semanticModel.SyntaxTree.Options)) 191else if (syntaxFacts.IsIsTypeExpression(expressionNode) && syntaxFacts.SupportsNotPattern(semanticModel.SyntaxTree.Options)) 270if (syntaxFacts.SupportsNotPattern(semanticModel.SyntaxTree.Options))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.State.cs (1)
173if (semanticModel.SyntaxTree.OverlapsHiddenPosition(affectedSpan, cancellationToken))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (3)
203if (currentNodeOrToken.SyntaxTree != semanticModelForReduce.SyntaxTree) 237newRoot = await semanticModelForReduce.SyntaxTree.GetRootAsync(cancellationToken).ConfigureAwait(false); 292var root = await model.SyntaxTree.GetRootAsync(cancellationToken).ConfigureAwait(false);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\Simplifiers\AbstractMemberAccessExpressionSimplifier.cs (1)
71return !semanticModel.SyntaxTree.OverlapsHiddenPosition(memberAccessExpression.Span, cancellationToken) &&
Microsoft.CodeAnalysis.CSharp (3)
src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpDeclarationComputer.cs (1)
29ComputeDeclarations(model, associatedSymbol: null, model.SyntaxTree.GetRoot(cancellationToken),
SymbolDisplay\SymbolDisplay.cs (1)
261else if (positionOpt < 0 || positionOpt > semanticModelOpt.SyntaxTree.Length) // Note: not >= since EOF is allowed.
SymbolDisplay\SymbolDisplayVisitor_Minimal.cs (1)
193var token = semanticModel.SyntaxTree.GetRoot().FindToken(position);
Microsoft.CodeAnalysis.CSharp.CodeStyle (19)
src\Analyzers\CSharp\Analyzers\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionDiagnosticAnalyzer.Analyzer.cs (1)
36var analyzer = new Analyzer(supportsOrPatterns: semanticModel.SyntaxTree.Options.LanguageVersion() >= LanguageVersion.CSharp9);
src\Analyzers\CSharp\Analyzers\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessAnalyzer.cs (1)
130var tree = context.SemanticModel.SyntaxTree;
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (1)
60var syntaxTree = semanticModel.SyntaxTree;
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\CSharpRemoveUnnecessaryNullableDirectiveDiagnosticAnalyzer.cs (2)
91var root = context.SemanticModel.SyntaxTree.GetCompilationUnitRoot(context.CancellationToken); 308var syntaxTreeState = GetOrCreateSyntaxTreeState(context.SemanticModel.SyntaxTree, defaultCompleted: true, context.SemanticModel, context.CancellationToken);
src\Analyzers\CSharp\Analyzers\RemoveUnreachableCode\CSharpRemoveUnreachableCodeDiagnosticAnalyzer.cs (1)
59var root = semanticModel.SyntaxTree.GetRoot(cancellationToken);
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForArrayDiagnosticAnalyzer.cs (2)
38var syntaxTree = semanticModel.SyntaxTree; 141var syntaxTree = semanticModel.SyntaxTree;
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForCreateDiagnosticAnalyzer.cs (1)
29var syntaxTree = semanticModel.SyntaxTree;
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs (1)
94var sourceText = semanticModel.SyntaxTree.GetText(cancellationToken);
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForNewDiagnosticAnalyzer.cs (1)
42var syntaxTree = semanticModel.SyntaxTree;
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForStackAllocDiagnosticAnalyzer.cs (2)
44var syntaxTree = semanticModel.SyntaxTree; 86var syntaxTree = semanticModel.SyntaxTree;
src\Analyzers\CSharp\Analyzers\UseExpressionBodyForLambda\UseExpressionBodyForLambdaDiagnosticAnalyzer.cs (1)
40var syntaxTree = context.SemanticModel.SyntaxTree;
src\Analyzers\CSharp\Analyzers\UseLocalFunction\CSharpUseLocalFunctionDiagnosticAnalyzer.cs (1)
127var options = semanticModel.SyntaxTree.Options;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SemanticModelExtensions.cs (1)
508var languageVersion = semanticModel.SyntaxTree.Options.LanguageVersion();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Helpers\RemoveUnnecessaryImports\CSharpUnnecessaryImportsProvider.cs (1)
28var root = model.SyntaxTree.GetRoot(cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseImplicitTypeHelper.cs (2)
175if (!semanticModel.SyntaxTree.HasCompilationUnitRoot) 184var tree = semanticModel.SyntaxTree;
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (18)
src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateMethodService.cs (1)
156if (semanticModel.SyntaxTree.IsNameOfContext(expression.SpanStart, semanticModel, cancellationToken))
src\Analyzers\CSharp\CodeFixes\UseLocalFunction\CSharpUseLocalFunctionCodeFixProvider.cs (1)
86var languageVersion = semanticModel.SyntaxTree.Options.LanguageVersion();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\CSharpSyntaxContext.cs (1)
185var syntaxTree = semanticModel.SyntaxTree;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.cs (1)
123var root = await semanticModel.SyntaxTree.GetRootAsync(cancellationToken).ConfigureAwait(false);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSemanticFactsService.cs (14)
75return semanticModel.SyntaxTree.IsExpressionContext( 77semanticModel.SyntaxTree.FindTokenOnLeftOfPosition(position, cancellationToken), 83return semanticModel.SyntaxTree.IsStatementContext( 84position, semanticModel.SyntaxTree.FindTokenOnLeftOfPosition(position, cancellationToken), cancellationToken); 88=> semanticModel.SyntaxTree.IsTypeContext(position, cancellationToken, semanticModel); 91=> semanticModel.SyntaxTree.IsNamespaceContext(position, cancellationToken, semanticModel); 94=> semanticModel.SyntaxTree.IsNamespaceDeclarationNameContext(position, cancellationToken); 98return semanticModel.SyntaxTree.IsTypeDeclarationContext( 99position, semanticModel.SyntaxTree.FindTokenOnLeftOfPosition(position, cancellationToken), cancellationToken); 104return semanticModel.SyntaxTree.IsMemberDeclarationContext( 105position, semanticModel.SyntaxTree.FindTokenOnLeftOfPosition(position, cancellationToken)); 109=> semanticModel.SyntaxTree.IsGlobalStatementContext(position, cancellationToken); 112=> semanticModel.SyntaxTree.IsLabelContext(position, cancellationToken); 115=> semanticModel.SyntaxTree.IsAttributeNameContext(position, cancellationToken);
Microsoft.CodeAnalysis.CSharp.EditorFeatures (1)
EventHookup\EventHookupSessionManager_EventHookupSession.cs (1)
252semanticModel.SyntaxTree.GetRoot(),
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (5)
Diagnostics\DiagnosticAnalyzerTests.cs (4)
4338? await compilationWithAnalyzers.GetAnalysisResultAsync(semanticModel.SyntaxTree, filterSpan, analyzers, CancellationToken.None) 4339: await compilationWithAnalyzers.GetAnalysisResultAsync(semanticModel.SyntaxTree, filterSpan, CancellationToken.None); 4344? await compilationWithAnalyzers.GetAnalyzerSyntaxDiagnosticsAsync(semanticModel.SyntaxTree, filterSpan, analyzers, CancellationToken.None) 4345: await compilationWithAnalyzers.GetAnalyzerSyntaxDiagnosticsAsync(semanticModel.SyntaxTree, filterSpan, CancellationToken.None);
Diagnostics\GetDiagnosticsTests.cs (1)
1673AssertEx.SetEqual(expectedSemanticModelTreeCallbacks, analyzer.AnalyzedSemanticModels.Select(s => s.SyntaxTree).ToHashSet());
Microsoft.CodeAnalysis.CSharp.Features (36)
Completion\CompletionProviders\AttributeNamedParameterCompletionProvider.cs (2)
160var rightToken = semanticModel.SyntaxTree.FindTokenOnRightOfPosition(context.Position, context.CancellationToken); 182var rightToken = semanticModel.SyntaxTree.FindTokenOnRightOfPosition(context.Position, context.CancellationToken);
Completion\CompletionProviders\ObjectAndWithInitializerCompletionProvider.cs (1)
105var tree = semanticModel.SyntaxTree;
Diagnostics\Analyzers\TypeSyntaxSimplifierWalker.cs (1)
83var root = semanticModel.SyntaxTree.GetRoot(cancellationToken);
EmbeddedLanguages\CSharpTestEmbeddedLanguageClassifier.cs (3)
72var text = semanticModel.SyntaxTree.GetText(cancellationToken); 115var encoding = semanticModel.SyntaxTree.Encoding; 118var testFileTree = SyntaxFactory.ParseSyntaxTree(testFileSourceText, semanticModel.SyntaxTree.Options, cancellationToken: cancellationToken);
GenerateType\CSharpGenerateTypeService.cs (3)
182var syntaxTree = semanticModel.SyntaxTree; 565? semanticModel.SyntaxTree.GetLocation(new TextSpan(lastMember.Span.End, 0)) 566: semanticModel.SyntaxTree.GetLocation(new TextSpan());
NavigationBar\CSharpNavigationBarItemService.cs (1)
137nodesToVisit.Push(semanticModel.SyntaxTree.GetRoot(cancellationToken));
QuickInfo\CSharpSemanticQuickInfoProvider.cs (1)
89var parseOptions = (CSharpParseOptions)semanticModel.SyntaxTree!.Options;
src\Analyzers\CSharp\Analyzers\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionDiagnosticAnalyzer.Analyzer.cs (1)
36var analyzer = new Analyzer(supportsOrPatterns: semanticModel.SyntaxTree.Options.LanguageVersion() >= LanguageVersion.CSharp9);
src\Analyzers\CSharp\Analyzers\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessAnalyzer.cs (1)
130var tree = context.SemanticModel.SyntaxTree;
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (1)
60var syntaxTree = semanticModel.SyntaxTree;
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\CSharpRemoveUnnecessaryNullableDirectiveDiagnosticAnalyzer.cs (2)
91var root = context.SemanticModel.SyntaxTree.GetCompilationUnitRoot(context.CancellationToken); 308var syntaxTreeState = GetOrCreateSyntaxTreeState(context.SemanticModel.SyntaxTree, defaultCompleted: true, context.SemanticModel, context.CancellationToken);
src\Analyzers\CSharp\Analyzers\RemoveUnreachableCode\CSharpRemoveUnreachableCodeDiagnosticAnalyzer.cs (1)
59var root = semanticModel.SyntaxTree.GetRoot(cancellationToken);
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForArrayDiagnosticAnalyzer.cs (2)
38var syntaxTree = semanticModel.SyntaxTree; 141var syntaxTree = semanticModel.SyntaxTree;
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForCreateDiagnosticAnalyzer.cs (1)
29var syntaxTree = semanticModel.SyntaxTree;
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs (1)
94var sourceText = semanticModel.SyntaxTree.GetText(cancellationToken);
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForNewDiagnosticAnalyzer.cs (1)
42var syntaxTree = semanticModel.SyntaxTree;
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForStackAllocDiagnosticAnalyzer.cs (2)
44var syntaxTree = semanticModel.SyntaxTree; 86var syntaxTree = semanticModel.SyntaxTree;
src\Analyzers\CSharp\Analyzers\UseExpressionBodyForLambda\UseExpressionBodyForLambdaDiagnosticAnalyzer.cs (1)
40var syntaxTree = context.SemanticModel.SyntaxTree;
src\Analyzers\CSharp\Analyzers\UseLocalFunction\CSharpUseLocalFunctionDiagnosticAnalyzer.cs (1)
127var options = semanticModel.SyntaxTree.Options;
src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateMethodService.cs (1)
156if (semanticModel.SyntaxTree.IsNameOfContext(expression.SpanStart, semanticModel, cancellationToken))
src\Analyzers\CSharp\CodeFixes\UseLocalFunction\CSharpUseLocalFunctionCodeFixProvider.cs (1)
86var languageVersion = semanticModel.SyntaxTree.Options.LanguageVersion();
src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpDeclarationComputer.cs (1)
29ComputeDeclarations(model, associatedSymbol: null, model.SyntaxTree.GetRoot(cancellationToken),
UsePatternMatching\CSharpIsAndCastCheckWithoutNameDiagnosticAnalyzer.cs (6)
67var syntaxTree = semanticModel.SyntaxTree; 202var root = updatedSemanticModel.SyntaxTree.GetRoot(cancellationToken); 215var root = semanticModel.SyntaxTree.GetRoot(cancellationToken); 242var updatedSyntaxTree = semanticModel.SyntaxTree.WithRootAndOptions( 243changedRoot, semanticModel.SyntaxTree.Options); 246semanticModel.SyntaxTree, updatedSyntaxTree);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (9)
Semantics\AccessibilityTests.cs (1)
53s_testModel.IsAccessible(s_testModel.SyntaxTree.GetCompilationUnitRoot().FullSpan.End + 1, s_testSymbol));
Semantics\InitOnlyMemberTests.cs (1)
3153speculativeModel.SyntaxTree.GetRoot()
Semantics\LookupPositionTests.cs (1)
3129SyntaxToken token = model.SyntaxTree.GetCompilationUnitRoot().FindToken(position, findInsideTrivia: true);
Semantics\SuppressAccessibilityChecksTests.cs (5)
54var invocation = semanticModel.SyntaxTree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 61semanticModel = semanticModel.Compilation.GetSemanticModel(semanticModel.SyntaxTree); 72var invocation = semanticModel.SyntaxTree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 87var invocation = semanticModel.SyntaxTree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 228speculativeModel.SyntaxTree.GetRoot()
SourceGeneration\SyntaxAwareGeneratorTests.cs (1)
295Assert.Equal(testReceiver.VisitedNodes[0].SemanticModel.SyntaxTree, testReceiver.VisitedNodes[0].Node.SyntaxTree);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (13)
Compilation\CompilationAPITests.cs (1)
884Assert.Equal(t1, bind.SyntaxTree);
SymbolDisplay\SymbolDisplayTests.cs (12)
7039var declarations = semanticModel.SyntaxTree.GetRoot().DescendantNodes().Where(n => n.Kind() == SyntaxKind.StructDeclaration).Cast<BaseTypeDeclarationSyntax>().ToArray(); 7077var declarations = semanticModel.SyntaxTree.GetRoot().DescendantNodes().Where(n => n.Kind() == SyntaxKind.StructDeclaration).Cast<BaseTypeDeclarationSyntax>().ToArray(); 7115var declarations = semanticModel.SyntaxTree.GetRoot().DescendantNodes().Where(n => n.Kind() == SyntaxKind.StructDeclaration).Cast<BaseTypeDeclarationSyntax>().ToArray(); 7175var declaration = (BaseTypeDeclarationSyntax)semanticModel.SyntaxTree.GetRoot().DescendantNodes().Single(n => n.Kind() == SyntaxKind.StructDeclaration); 7247var declaration = (BaseTypeDeclarationSyntax)semanticModel.SyntaxTree.GetRoot().DescendantNodes().Single(n => n.Kind() == SyntaxKind.StructDeclaration); 7507var declaration = (BaseTypeDeclarationSyntax)semanticModel.SyntaxTree.GetRoot().DescendantNodes().Single(n => n.Kind() == SyntaxKind.StructDeclaration); 7660var declaration = (BaseTypeDeclarationSyntax)semanticModel.SyntaxTree.GetRoot().DescendantNodes().Single(n => n.Kind() == SyntaxKind.StructDeclaration); 7688var structure = semanticModel.SyntaxTree.GetRoot().DescendantNodes().Single(n => n.RawKind == (int)VisualBasic.SyntaxKind.StructureStatement); 8398var syntaxTree = semanticModel.SyntaxTree; 8399var declaration = (LocalDeclarationStatementSyntax)semanticModel.SyntaxTree.GetRoot().DescendantNodes().Single(n => n.Kind() == SyntaxKind.LocalDeclarationStatement); 8449var syntaxTree = semanticModel.SyntaxTree; 8450var declaration = (LocalDeclarationStatementSyntax)semanticModel.SyntaxTree.GetRoot().DescendantNodes().Single(n => n.Kind() == SyntaxKind.LocalDeclarationStatement);
Microsoft.CodeAnalysis.CSharp.Workspaces (27)
Classification\SyntaxClassification\SyntaxTokenClassifier.cs (1)
34var syntaxTree = semanticModel.SyntaxTree;
Rename\CSharpRenameRewriterLanguageService.cs (2)
146_renamableDeclarationLocation = _renamedSymbol.Locations.FirstOrDefault(loc => loc.IsInSource && loc.SourceTree == _semanticModel.SyntaxTree); 1243if (node.SyntaxTree == originalSemanticModel.SyntaxTree)
Simplification\CSharpSimplificationService.cs (1)
188var root = model.SyntaxTree.GetRoot(cancellationToken);
Simplification\CSharpSimplificationService.Expander.cs (1)
673_semanticModel.SyntaxTree.IsNameOfContext(originalSimpleName.SpanStart, _semanticModel, _cancellationToken))
Simplification\Simplifiers\AbstractCSharpSimplifier.cs (2)
213if (!model.SyntaxTree.HasCompilationUnitRoot) 216var root = (CompilationUnitSyntax)model.SyntaxTree.GetRoot(cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SemanticModelExtensions.cs (1)
508var languageVersion = semanticModel.SyntaxTree.Options.LanguageVersion();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Helpers\RemoveUnnecessaryImports\CSharpUnnecessaryImportsProvider.cs (1)
28var root = model.SyntaxTree.GetRoot(cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseImplicitTypeHelper.cs (2)
175if (!semanticModel.SyntaxTree.HasCompilationUnitRoot) 184var tree = semanticModel.SyntaxTree;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\CSharpSyntaxContext.cs (1)
185var syntaxTree = semanticModel.SyntaxTree;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.cs (1)
123var root = await semanticModel.SyntaxTree.GetRootAsync(cancellationToken).ConfigureAwait(false);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSemanticFactsService.cs (14)
75return semanticModel.SyntaxTree.IsExpressionContext( 77semanticModel.SyntaxTree.FindTokenOnLeftOfPosition(position, cancellationToken), 83return semanticModel.SyntaxTree.IsStatementContext( 84position, semanticModel.SyntaxTree.FindTokenOnLeftOfPosition(position, cancellationToken), cancellationToken); 88=> semanticModel.SyntaxTree.IsTypeContext(position, cancellationToken, semanticModel); 91=> semanticModel.SyntaxTree.IsNamespaceContext(position, cancellationToken, semanticModel); 94=> semanticModel.SyntaxTree.IsNamespaceDeclarationNameContext(position, cancellationToken); 98return semanticModel.SyntaxTree.IsTypeDeclarationContext( 99position, semanticModel.SyntaxTree.FindTokenOnLeftOfPosition(position, cancellationToken), cancellationToken); 104return semanticModel.SyntaxTree.IsMemberDeclarationContext( 105position, semanticModel.SyntaxTree.FindTokenOnLeftOfPosition(position, cancellationToken)); 109=> semanticModel.SyntaxTree.IsGlobalStatementContext(position, cancellationToken); 112=> semanticModel.SyntaxTree.IsLabelContext(position, cancellationToken); 115=> semanticModel.SyntaxTree.IsAttributeNameContext(position, cancellationToken);
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (11)
CodeFixes\CodeFixServiceTests.cs (1)
1202var variableDeclarations = context.SemanticModel.SyntaxTree.GetRoot().DescendantNodes().OfType<CodeAnalysis.CSharp.Syntax.VariableDeclarationSyntax>();
CodeGeneration\CodeGenerationTests.cs (8)
543testContext.Result = testContext.Document.WithSyntaxRoot(testContext.SemanticModel.SyntaxTree.GetRoot().ReplaceNode(oldNode, newNode)); 559var info = codeGenerator.GetInfo(CodeGenerationContext.Default, options, testContext.SemanticModel.SyntaxTree.Options); 562testContext.Result = testContext.Document.WithSyntaxRoot(testContext.SemanticModel.SyntaxTree.GetRoot().ReplaceNode(declarationNode, newNode)); 614testContext.Result = testContext.Document.WithSyntaxRoot(testContext.SemanticModel.SyntaxTree.GetRoot().ReplaceNode(declarationNode, updatedDeclarationNode)); 867this.SyntaxTree = SemanticModel.SyntaxTree; 886return SemanticModel.SyntaxTree.GetRoot().FindNode(destSpan, getInnermostNodeForTie: true); 907var token = semanticModel.SyntaxTree.GetRoot().FindToken(selection.Start); 919var token = SemanticModel.SyntaxTree.GetRoot().FindToken(destSpan.Start);
Diagnostics\DiagnosticAnalyzerServiceTests.cs (2)
924context.RegisterSemanticModelAction(c => c.ReportDiagnostic(Diagnostic.Create(s_semanticRule, c.SemanticModel.SyntaxTree.GetRoot().GetLocation()))); 940context.RegisterSemanticModelAction(c => c.ReportDiagnostic(Diagnostic.Create(s_semanticRule, c.SemanticModel.SyntaxTree.GetRoot().GetLocation())));
Microsoft.CodeAnalysis.Features (25)
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.RemoveSuppressionCodeAction_Pragma.cs (1)
204var tree = model.SyntaxTree;
DocumentHighlighting\AbstractDocumentHighlightsService.cs (1)
97var root = semanticModel.SyntaxTree.GetRoot(cancellationToken);
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (3)
1132syntaxMaps = new SyntaxMaps(newModel.SyntaxTree, matchingNodes, runtimeRudeEdits); 1272newActiveStatements[activeStatementIndex] = GetActiveStatementWithSpan(oldActiveStatements[activeStatementIndex], newModel.SyntaxTree, newSpan, diagnostics, cancellationToken); 1303syntaxMaps = new SyntaxMaps(newModel.SyntaxTree);
EmbeddedLanguages\Classification\AbstractEmbeddedLanguageClassificationService.cs (1)
57var root = semanticModel.SyntaxTree.GetRoot(cancellationToken);
EmbeddedLanguages\Json\LanguageServices\AbstractJsonDiagnosticAnalyzer.cs (1)
80Location.Create(context.SemanticModel.SyntaxTree, diag.Span),
EmbeddedLanguages\RegularExpressions\LanguageServices\AbstractRegexDiagnosticAnalyzer.cs (1)
92Location.Create(context.SemanticModel.SyntaxTree, diag.Span),
ExtractMethod\SelectionValidator.cs (1)
80return IsFinalSpanSemanticallyValidSpan(semanticModel.SyntaxTree.GetRoot(cancellationToken), textSpan, returnStatements, cancellationToken);
GenerateType\AbstractGenerateTypeService.Editor.cs (1)
297new CodeGenerationContext(newSemanticModel.SyntaxTree.GetLocation(new TextSpan()))),
GoToDefinition\AbstractGoToDefinitionSymbolService.cs (1)
67var syntaxTree = semanticModel.SyntaxTree;
LanguageServices\SymbolDisplayService\AbstractSymbolDisplayService.AbstractSymbolDescriptionBuilder.cs (1)
120if (_semanticModel.SyntaxTree == tree)
QuickInfo\CommonSemanticQuickInfoProvider.cs (1)
142var root = linkedModel.SyntaxTree.GetRoot(cancellationToken);
ReplaceDocCommentTextWithTag\AbstractReplaceDocCommentTextWithTagCodeRefactoringProvider.cs (2)
112var sourceText = semanticModel.SyntaxTree.GetText(cancellationToken); 128var root = semanticModel.SyntaxTree.GetRoot(cancellationToken);
src\Analyzers\Core\Analyzers\RemoveUnnecessaryCast\AbstractRemoveUnnecessaryCastDiagnosticAnalyzer.cs (1)
65var tree = model.SyntaxTree;
src\Analyzers\Core\Analyzers\RemoveUnnecessaryImports\AbstractRemoveUnnecessaryImportsDiagnosticAnalyzer.cs (1)
87var tree = context.SemanticModel.SyntaxTree;
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (5)
98var tree = semanticModel.SyntaxTree; 464var analysisResult = await compilationWithAnalyzers.GetAnalysisResultAsync(semanticModel.SyntaxTree, analyzers, cancellationToken).ConfigureAwait(false); 466if (analysisResult.SyntaxDiagnostics.TryGetValue(semanticModel.SyntaxTree, out var diagnostics)) 473if (analysisResult.SemanticDiagnostics.TryGetValue(semanticModel.SyntaxTree, out diagnostics)) 478AddAllCompilationDiagnosticsForTree(analysisResult, semanticModel.SyntaxTree, reportedDiagnostics);
src\Analyzers\Core\Analyzers\SimplifyTypeNames\SimplifyTypeNamesDiagnosticAnalyzerBase.cs (3)
125if (model.SyntaxTree.OverlapsHiddenPosition(issueSpan, cancellationToken)) 163var tree = model.SyntaxTree; 273var (completed, intervalTree) = _codeBlockIntervals.GetOrAdd(context.SemanticModel.SyntaxTree, syntaxTree => (new StrongBox<bool>(true), null));
Microsoft.CodeAnalysis.Test.Utilities (6)
CommonTestBase.cs (2)
599var root = model.SyntaxTree.GetRoot(); 648foreach (var node in model.SyntaxTree.GetRoot().DescendantNodes())
Diagnostics\CommonDiagnosticAnalyzers.cs (4)
1107Diagnostic.Create(Descriptor, context.SemanticModel.SyntaxTree.GetRoot().GetLocation()))); 1565sortedCallbackSemanticModelPaths.Add($"{context.SemanticModel.SyntaxTree.FilePath}(IsGeneratedCode:{context.IsGeneratedCode})")); 2745ReportDiagnosticsInAllTrees("RegisterSemanticModelAction", semanticModelContext.SemanticModel.SyntaxTree, semanticModelContext.SemanticModel.Compilation, semanticModelContext.ReportDiagnostic)); 2946context.RegisterSemanticModelAction(context => HandleCallback(context.SemanticModel.SyntaxTree.GetRoot().GetLocation(), context.SemanticModel.Compilation, context.ReportDiagnostic, context.CancellationToken));
Microsoft.CodeAnalysis.UnitTests (1)
Diagnostics\SuppressMessageTargetSymbolResolverTests.cs (1)
1397var token = model.SyntaxTree.GetRoot().FindToken(pos);
Microsoft.CodeAnalysis.VisualBasic (4)
src\Compilers\VisualBasic\BasicAnalyzerDriver\VisualBasicDeclarationComputer.vb (1)
20ComputeDeclarationsCore(model, model.SyntaxTree.GetRoot(cancellationToken),
SymbolDisplay\SymbolDisplay.vb (1)
128ElseIf positionOpt < 0 OrElse positionOpt > semanticModelOpt.SyntaxTree.Length Then 'Note: not >= since EOF is allowed.
SymbolDisplay\SymbolDisplayVisitor_Minimal.vb (2)
181Return semanticModel.SyntaxTree 186Return semanticModel.ParentModel.SyntaxTree
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (6)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SemanticModelExtensions.vb (1)
171Dim root = semanticModel.SyntaxTree.GetCompilationUnitRoot()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Helpers\RemoveUnnecessaryImports\VisualBasicUnnecessaryImportsProvider.vb (5)
30Dim root = model.SyntaxTree.GetRoot(cancellationToken) 73Dim root = DirectCast(model.SyntaxTree.GetRoot(cancellationToken), CompilationUnitSyntax) 76Dim updatedSyntaxTree = model.SyntaxTree.WithRootAndOptions(updatedRoot, model.SyntaxTree.Options) 77Dim updatedCompilation = model.Compilation.ReplaceSyntaxTree(model.SyntaxTree, updatedSyntaxTree)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (21)
src\Analyzers\VisualBasic\CodeFixes\GenerateParameterizedMember\VisualBasicCommonGenerationServiceMethods.vb (1)
14Dim root = semanticModel.SyntaxTree.GetRoot
src\Analyzers\VisualBasic\CodeFixes\GenerateParameterizedMember\VisualBasicGenerateMethodService.vb (1)
147Dim tree = semanticModel.SyntaxTree
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ContextQuery\VisualBasicSyntaxContext.vb (2)
117Dim syntaxTree = semanticModel.SyntaxTree 159Dim syntaxTree = semanticModel.SyntaxTree
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicSemanticFactsService.vb (17)
51Dim token = semanticModel.SyntaxTree.GetTargetToken(position, cancellationToken) 52Return semanticModel.SyntaxTree.IsExpressionContext(position, token, cancellationToken, semanticModel) 56Dim token = semanticModel.SyntaxTree.GetTargetToken(position, cancellationToken) 57Return semanticModel.SyntaxTree.IsInterfaceMemberDeclarationKeywordContext(position, token, cancellationToken) OrElse 58semanticModel.SyntaxTree.IsTypeMemberDeclarationKeywordContext(position, token, cancellationToken) 64Dim token = semanticModel.SyntaxTree.GetTargetToken(position, cancellationToken) 65Return semanticModel.SyntaxTree.IsNamespaceContext(position, token, cancellationToken, semanticModel) 69Dim token = semanticModel.SyntaxTree.GetTargetToken(position, cancellationToken) 70Return semanticModel.SyntaxTree.IsSingleLineStatementContext(position, token, cancellationToken) OrElse 71semanticModel.SyntaxTree.IsMultiLineStatementStartContext(position, token, cancellationToken) 77Dim token = semanticModel.SyntaxTree.GetTargetToken(position, cancellationToken) 78Return semanticModel.SyntaxTree.IsTypeContext(position, token, cancellationToken, semanticModel) 82Dim token = semanticModel.SyntaxTree.GetTargetToken(position, cancellationToken) 83Return semanticModel.SyntaxTree.IsTypeDeclarationContext(position, token, cancellationToken) 91Dim tree = semanticModel.SyntaxTree 97Dim tree = semanticModel.SyntaxTree 103Return semanticModel.SyntaxTree.IsNamespaceDeclarationNameContext(position, cancellationToken)
Microsoft.CodeAnalysis.VisualBasic.Features (18)
CodeRefactorings\InlineTemporary\VisualBasicInlineTemporaryCodeRefactoringProvider.vb (1)
422Dim syntaxRootBeforeInline = Await semanticModelBeforeInline.SyntaxTree.GetRootAsync(cancellationToken).ConfigureAwait(False)
Completion\CompletionProviders\ObjectInitializerCompletionProvider.vb (1)
58Dim tree = semanticModel.SyntaxTree
Diagnostics\Analyzers\TypeSyntaxSimplifierWalker.vb (1)
82Dim root = semanticModel.SyntaxTree.GetRoot(cancellationToken)
Diagnostics\Analyzers\VisualBasicSimplifyTypeNamesDiagnosticAnalyzer.vb (1)
60Dim configOptions = context.Options.AnalyzerConfigOptionsProvider.GetOptions(context.SemanticModel.SyntaxTree)
ExtractMethod\VisualBasicSelectionValidator.vb (4)
102Dim root = semanticModel.SyntaxTree.GetRoot(cancellationToken) 193semanticModel.SyntaxTree.GetRoot(cancellationToken), GetControlFlowSpan(selectionInfo), cancellationToken) 280symbol.Locations.First().SourceTree IsNot semanticModel.SyntaxTree Then 289Dim root = semanticModel.SyntaxTree.GetRoot(cancellationToken)
GenerateMember\GenerateVariable\VisualBasicGenerateVariableService.vb (1)
109Dim tree = semanticModel.SyntaxTree
GenerateType\VisualBasicGenerateTypeService.vb (2)
445semanticModel.SyntaxTree.GetLocation(New TextSpan()), 446semanticModel.SyntaxTree.GetLocation(New TextSpan(lastMember.Span.End, 0)))
NavigationBar\VisualBasicNavigationBarItemService.vb (4)
66nodesToVisit.Push(DirectCast(semanticModel.SyntaxTree.GetRoot(cancellationToken), SyntaxNode)) 112items.AddIfNotNull(CreateItemForEnum(solution, type, semanticModel.SyntaxTree, symbolDeclarationService)) 114items.AddIfNotNull(CreatePrimaryItemForType(solution, type, semanticModel.SyntaxTree, workspaceSupportsDocumentChanges, symbolDeclarationService, cancellationToken)) 346Dim methodLocation = GetSymbolLocation(solution, methods.First(), semanticModel.SyntaxTree, symbolDeclarationService)
src\Analyzers\VisualBasic\CodeFixes\GenerateParameterizedMember\VisualBasicCommonGenerationServiceMethods.vb (1)
14Dim root = semanticModel.SyntaxTree.GetRoot
src\Analyzers\VisualBasic\CodeFixes\GenerateParameterizedMember\VisualBasicGenerateMethodService.vb (1)
147Dim tree = semanticModel.SyntaxTree
src\Compilers\VisualBasic\BasicAnalyzerDriver\VisualBasicDeclarationComputer.vb (1)
20ComputeDeclarationsCore(model, model.SyntaxTree.GetRoot(cancellationToken),
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (4)
Compilation\SuppressAccessibilityChecksTests.vb (4)
55Dim invocation = semanticModel.SyntaxTree.GetRoot().DescendantNodes().OfType(Of InvocationExpressionSyntax)().Single() 68Dim invocation = semanticModel.SyntaxTree.GetRoot().DescendantNodes().OfType(Of InvocationExpressionSyntax)().Single() 80Dim syntaxTree = semanticModel.SyntaxTree 256speculativeModel.SyntaxTree.GetRoot() _
Microsoft.CodeAnalysis.VisualBasic.Workspaces (35)
Classification\SyntaxClassification\NameSyntaxClassifier.vb (2)
177semanticModel.SyntaxTree.IsExpressionContext(token.SpanStart, cancellationToken, semanticModel) Then 186If semanticModel.SyntaxTree.IsExpressionContext(token.SpanStart, cancellationToken, semanticModel) Then
Rename\VisualBasicRenameRewriterLanguageService.vb (5)
123_renamableDeclarationLocation = _renamedSymbol.Locations.Where(Function(loc) loc.IsInSource AndAlso loc.SourceTree Is _semanticModel.SyntaxTree).FirstOrDefault() 197newNode = Me._speculativeModel.SyntaxTree.GetRoot(_cancellationToken).GetAnnotatedNodes(Of SyntaxNode)(annotation).First() 221probableRenameNode = Me._speculativeModel.SyntaxTree.GetRoot(_cancellationToken).GetAnnotatedNodes(Of SyntaxNode)(annotation).First() 222speculativeNewNode = Me._speculativeModel.SyntaxTree.GetRoot(_cancellationToken).GetAnnotatedNodes(Of SyntaxNode)(annotationForSpeculativeNode).First() 1028If node.SyntaxTree Is originalSemanticModel.SyntaxTree Then
Simplification\VisualBasicSimplificationService.Expander.vb (1)
650_semanticModel.SyntaxTree.IsNameOfContext(originalSimpleName.SpanStart, _cancellationToken) Then
Simplification\VisualBasicSimplificationService.vb (2)
128nodeToSpeculate = speculativeModel.SyntaxTree.GetRoot() 165Dim root = model.SyntaxTree.GetRoot(cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SemanticModelExtensions.vb (1)
171Dim root = semanticModel.SyntaxTree.GetCompilationUnitRoot()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Helpers\RemoveUnnecessaryImports\VisualBasicUnnecessaryImportsProvider.vb (5)
30Dim root = model.SyntaxTree.GetRoot(cancellationToken) 73Dim root = DirectCast(model.SyntaxTree.GetRoot(cancellationToken), CompilationUnitSyntax) 76Dim updatedSyntaxTree = model.SyntaxTree.WithRootAndOptions(updatedRoot, model.SyntaxTree.Options) 77Dim updatedCompilation = model.Compilation.ReplaceSyntaxTree(model.SyntaxTree, updatedSyntaxTree)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ContextQuery\VisualBasicSyntaxContext.vb (2)
117Dim syntaxTree = semanticModel.SyntaxTree 159Dim syntaxTree = semanticModel.SyntaxTree
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicSemanticFactsService.vb (17)
51Dim token = semanticModel.SyntaxTree.GetTargetToken(position, cancellationToken) 52Return semanticModel.SyntaxTree.IsExpressionContext(position, token, cancellationToken, semanticModel) 56Dim token = semanticModel.SyntaxTree.GetTargetToken(position, cancellationToken) 57Return semanticModel.SyntaxTree.IsInterfaceMemberDeclarationKeywordContext(position, token, cancellationToken) OrElse 58semanticModel.SyntaxTree.IsTypeMemberDeclarationKeywordContext(position, token, cancellationToken) 64Dim token = semanticModel.SyntaxTree.GetTargetToken(position, cancellationToken) 65Return semanticModel.SyntaxTree.IsNamespaceContext(position, token, cancellationToken, semanticModel) 69Dim token = semanticModel.SyntaxTree.GetTargetToken(position, cancellationToken) 70Return semanticModel.SyntaxTree.IsSingleLineStatementContext(position, token, cancellationToken) OrElse 71semanticModel.SyntaxTree.IsMultiLineStatementStartContext(position, token, cancellationToken) 77Dim token = semanticModel.SyntaxTree.GetTargetToken(position, cancellationToken) 78Return semanticModel.SyntaxTree.IsTypeContext(position, token, cancellationToken, semanticModel) 82Dim token = semanticModel.SyntaxTree.GetTargetToken(position, cancellationToken) 83Return semanticModel.SyntaxTree.IsTypeDeclarationContext(position, token, cancellationToken) 91Dim tree = semanticModel.SyntaxTree 97Dim tree = semanticModel.SyntaxTree 103Return semanticModel.SyntaxTree.IsNamespaceDeclarationNameContext(position, cancellationToken)
Microsoft.CodeAnalysis.Workspaces (36)
Classification\Classifier.cs (2)
90var root = semanticModel.SyntaxTree.GetRoot(cancellationToken); 118var sourceText = await semanticModel.SyntaxTree.GetTextAsync(cancellationToken).ConfigureAwait(false);
Classification\SyntaxClassification\AbstractSyntaxClassificationService.Worker.cs (1)
65var root = semanticModel.SyntaxTree.GetRoot(cancellationToken);
Editing\DocumentEditor.cs (1)
36var root = model.SyntaxTree.GetRoot(cancellationToken);
Editing\SymbolEditor.cs (2)
298var newDeclaration = model.SyntaxTree.GetRoot(cancellationToken).GetCurrentNode(declaration); 489var newDeclaration = model.SyntaxTree.GetRoot(cancellationToken).GetCurrentNode(decl);
FindSymbols\FindReferences\FindReferencesDocumentState.cs (1)
27public SyntaxTree SyntaxTree => this.SemanticModel.SyntaxTree;
FindSymbols\SymbolFinder.cs (1)
116var syntaxTree = semanticModel.SyntaxTree;
FindSymbols\TopLevelSyntaxTree\DeclaredSymbolInfo.cs (1)
223var root = semanticModel.SyntaxTree.GetRoot(cancellationToken);
ReassignedVariable\AbstractReassignedVariableService.cs (3)
227if (methodOrPropertyDeclaration.SyntaxTree != semanticModel.SyntaxTree) 248if (parameterLocation.SourceTree == semanticModel.SyntaxTree) 273.Where(s => s.SyntaxTree == semanticModel.SyntaxTree)
Recommendations\Recommender.cs (1)
27var document = solution.GetRequiredDocument(semanticModel.SyntaxTree);
Rename\ConflictEngine\ConflictResolver.Session.cs (1)
796var originalSyntaxRoot = await semanticModel.SyntaxTree.GetRootAsync(_cancellationToken).ConfigureAwait(false);
Rename\RenameUtilities.cs (1)
47var bindableToken = semanticModel.SyntaxTree.GetRoot(cancellationToken).FindToken(position, findInsideTrivia: true);
SemanticModelReuse\AbstractSemanticModelReuseLanguageService.cs (2)
44var previousSyntaxTree = previousSemanticModel.SyntaxTree; 56var previousRoot = await previousSemanticModel.SyntaxTree.GetRootAsync(cancellationToken).ConfigureAwait(false);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\AnalysisContextExtensions.cs (1)
157=> context.SemanticModel.SyntaxTree.FindNode(context.FilterSpan, findInTrivia, getInnermostNodeForTie, context.CancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Helpers\RemoveUnnecessaryImports\AbstractUnnecessaryImportsProvider.cs (1)
32var node = model.SyntaxTree.FindNode(span, findInTrivia: false, getInnermostNodeForTie: false, cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.BodyLevelSymbolKey.cs (1)
258Contract.ThrowIfTrue(semanticModel.SyntaxTree != containerDeclaration.SyntaxTree);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AliasSymbolCache.cs (2)
37!treeMap.TryGetValue((semanticModel.SyntaxTree, namespaceId), out var symbolMap)) 55var key = (tree: semanticModel.SyntaxTree, namespaceId);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\ISpeculationAnalyzer.cs (2)
11/// <see cref="SemanticModel.SyntaxTree"/> that <see cref="OriginalSemanticModel"/> points at. 17/// cref="SemanticModel.SyntaxTree"/> that <see cref="SpeculativeSemanticModel"/> points at.
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ContextQuery\SyntaxContext.cs (1)
93this.SyntaxTree = semanticModel.SyntaxTree;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions.cs (1)
473var condition = generatorInternal.SupportsPatterns(semanticModel.SyntaxTree.Options)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (1)
74factory, generatorInternal, semanticModel.Compilation, semanticModel.SyntaxTree.Options, containingType, symbols);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_Negate.cs (4)
65var options = semanticModel.SyntaxTree.Options; 186else if (operation is IIsTypeOperation { TypeOperand.SpecialType: SpecialType.System_Object } && generatorInternal.SupportsPatterns(semanticModel.SyntaxTree.Options)) 191else if (syntaxFacts.IsIsTypeExpression(expressionNode) && syntaxFacts.SupportsNotPattern(semanticModel.SyntaxTree.Options)) 270if (syntaxFacts.SupportsNotPattern(semanticModel.SyntaxTree.Options))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.State.cs (1)
173if (semanticModel.SyntaxTree.OverlapsHiddenPosition(affectedSpan, cancellationToken))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (3)
203if (currentNodeOrToken.SyntaxTree != semanticModelForReduce.SyntaxTree) 237newRoot = await semanticModelForReduce.SyntaxTree.GetRootAsync(cancellationToken).ConfigureAwait(false); 292var root = await model.SyntaxTree.GetRootAsync(cancellationToken).ConfigureAwait(false);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\Simplifiers\AbstractMemberAccessExpressionSimplifier.cs (1)
71return !semanticModel.SyntaxTree.OverlapsHiddenPosition(memberAccessExpression.Span, cancellationToken) &&
Microsoft.CodeAnalysis.Workspaces.UnitTests (1)
SymbolKeyTests.cs (1)
1497GetAllSymbols(model, model.SyntaxTree.GetRoot(), list, predicate);
Microsoft.ML.InternalCodeAnalyzer (1)
BestFriendAnalyzer.cs (1)
66foreach (var node in model.SyntaxTree.GetRoot().DescendantNodes(n => !n.IsKind(SyntaxKind.UsingDirective)))
System.Private.CoreLib.Generators (1)
IntrinsicsInSystemPrivateCoreLibAnalyzer.cs (1)
296if (model.SyntaxTree != arrowExpression.SyntaxTree)