1 override of SourceTree
Microsoft.CodeAnalysis (1)
Diagnostic\SourceLocation.cs (1)
72public override SyntaxTree SourceTree
401 references to SourceTree
AnalyzerRunner (1)
DiagnosticAnalyzerRunner.cs (1)
206.ThenBy(tuple => tuple.Item2.Location.SourceTree?.FilePath, StringComparer.OrdinalIgnoreCase)
Microsoft.CodeAnalysis (30)
Diagnostic\Diagnostic.cs (1)
516if (location.SourceTree != tree)
Diagnostic\Location.cs (3)
31[MemberNotNullWhen(true, nameof(SourceTree))] 32public bool IsInSource { get { return SourceTree != null; } } 100result += "(" + this.SourceTree?.FilePath + this.SourceSpan + ")";
DiagnosticAnalyzer\AnalysisResultBuilder.cs (1)
303=> diagnostic.Location.SourceTree;
DiagnosticAnalyzer\AnalysisScope.cs (1)
228if (diagnostic.Location.SourceTree != filterFile.SourceTree)
DiagnosticAnalyzer\AnalyzerDriver.cs (6)
1173Debug.Assert(location.SourceTree != null); 1176if (IsGeneratedOrHiddenCodeLocation(location.SourceTree, location.SourceSpan)) 1184var generatedCodeSymbolsInTree = getOrComputeGeneratedCodeSymbolsInTree(location.SourceTree, compilation, cancellationToken); 1187var model = compilation.GetSemanticModel(location.SourceTree); 1188for (var node = location.SourceTree.GetRoot(cancellationToken).FindNode(location.SourceSpan, getInnermostNodeForTie: true); 1914if (diagnostic?.Location.SourceTree is { } tree &&
DiagnosticAnalyzer\AnalyzerExecutor.AnalyzerDiagnosticReporter.cs (1)
121_contextFile.Value.SourceTree == diagnostic.Location.SourceTree;
DiagnosticAnalyzer\AnalyzerExecutor.cs (3)
1368if (syntaxRef.SyntaxTree == diagnostic.Location.SourceTree) 1476if (location.SourceTree != null && 1477!IsAnalyzerSuppressedForTree(analyzer, location.SourceTree))
DiagnosticAnalyzer\CompilationWithAnalyzers.cs (3)
863if (location.SourceTree != null) 865partialTrees.Add(location.SourceTree); 1043if (tree == location.SourceTree)
DiagnosticAnalyzer\DiagnosticAnalysisContextHelpers.cs (5)
95Debug.Assert(location.SourceTree != null); 96if (!compilation.ContainsSyntaxTree(location.SourceTree)) 99throw new ArgumentException(string.Format(CodeAnalysisResources.InvalidDiagnosticLocationReported, id, location.SourceTree.FilePath), "diagnostic"); 102if (location.SourceSpan.End > location.SourceTree.Length) 105throw new ArgumentException(string.Format(CodeAnalysisResources.InvalidDiagnosticSpanReported, id, location.SourceSpan, location.SourceTree.FilePath), "diagnostic");
DiagnosticAnalyzer\SuppressMessageAttributeState.cs (2)
159var model = _compilation.GetSemanticModel(location.SourceTree); 162for (var node = location.SourceTree.GetRoot().FindNode(location.SourceSpan, getInnermostNodeForTie: true);
ReferenceManager\CommonReferenceManager.Resolution.cs (4)
813Debug.Assert(referenceDirective.Location.SourceTree is object); 814if (localBoundReferenceDirectives != null && localBoundReferenceDirectives.ContainsKey((referenceDirective.Location.SourceTree.FilePath, referenceDirective.File))) 834localBoundReferenceDirectives.Add((referenceDirective.Location.SourceTree.FilePath, referenceDirective.File), boundReference); 870var tree = location.SourceTree;
Microsoft.CodeAnalysis.CodeStyle (19)
AbstractMakeFieldReadonlyDiagnosticAnalyzer.cs (1)
262=> options.GetAnalyzerOptions(field.Locations[0].SourceTree!).PreferReadonly;
AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (2)
495if (diagnostic.Location.SourceTree == tree) 552Debug.Assert(diagnostic.Location.SourceTree == tree);
AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (2)
525foreach (var tree in namedTypeSymbol.Locations.Select(l => l.SourceTree)) 539foreach (var root in namedTypeSymbol.Locations.Select(l => l.SourceTree.GetRoot(cancellationToken)))
AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.cs (1)
141var option = analyzerOptions.GetAnalyzerOptions(location.SourceTree).UnusedParameters;
LocationExtensions.cs (5)
15Contract.ThrowIfNull(location.SourceTree); 16return location.SourceTree; 38var tree = loc.SourceTree; 45return loc1.SourceTree == loc2.SourceTree && loc1.SourceSpan.IntersectsWith(loc2.SourceSpan);
NamingStyleDiagnosticAnalyzerBase.cs (1)
131var sourceTree = symbol.Locations.FirstOrDefault()?.SourceTree;
SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
46var syntaxTree = location.SourceTree;
SymbolKey.BodyLevelSymbolKey.cs (2)
78var syntaxTree = locations[0].SourceTree; 182var firstSourceTree = locations[0]?.SourceTree;
SymbolKey.cs (1)
164return compilation.SyntaxTrees.Contains(locations.First().SourceTree);
SymbolKey.SymbolKeyReader.cs (2)
742if (location.SourceTree != null) 745var semanticModel = Compilation.GetSemanticModel(location.SourceTree);
SymbolKey.SymbolKeyWriter.cs (1)
257WriteString(location.SourceTree.FilePath);
Microsoft.CodeAnalysis.CodeStyle.Fixes (8)
AbstractChangeNamespaceToMatchFolderCodeFixProvider.CustomFixAllProvider.cs (1)
86.GroupBy(diagnostic => diagnostic.Location.SourceTree)
AbstractCodeGenerationService.cs (1)
494if (location.SourceTree != destinationMember.SyntaxTree)
AbstractCodeGenerationService_FindDeclaration.cs (1)
190declaration = await SelectFirstOrDefaultAsync(declarations.Where(r => r.SyntaxTree == location.SourceTree), node => true, cancellationToken).ConfigureAwait(false);
AbstractUseIsNullForReferenceEqualsCodeFixProvider.cs (1)
41var title = GetTitle(negated, diagnostic.Location.SourceTree!.Options);
AddParameterService.cs (1)
95=> solution.GetRequiredDocument(declarationLocation.Locations[0].SourceTree!));
CodeGenerationHelpers.cs (2)
203if (info.Context.AfterThisLocation?.SourceTree is { } afterSourceTree && 219if (info.Context.BeforeThisLocation?.SourceTree is { } beforeSourceTree &&
ProjectExtensions.cs (1)
53var diagnosticFilePath = PathUtilities.GetDirectoryName(diagnostic?.Location.SourceTree?.FilePath ?? project.FilePath);
Microsoft.CodeAnalysis.CodeStyle.LegacyTestFramework.UnitTestUtilities (1)
AbstractCodeActionOrUserDiagnosticTest.cs (1)
529var documentOffset = initialMarkupWithoutSpans.IndexOf(diagnosticsWithTag.First().Location.SourceTree.ToString());
Microsoft.CodeAnalysis.CSharp (44)
Binder\Binder_Expressions.cs (1)
2024if (node.SyntaxTree == localSymbolLocation.SourceTree)
Binder\Binder_Symbols.cs (4)
1851if (containerResult == 0 && la.SourceTree == lb.SourceTree) return lb.SourceSpan.Start - la.SourceSpan.Start; 1932arg0 = srcSymbol.Locations.First().SourceTree.FilePath; 2086arg0 = first.Locations.First().SourceTree.FilePath;
Binder\BinderFactory.BinderFactoryVisitor.cs (1)
619return (location.SourceTree == syntaxTree) && span.Contains(location.SourceSpan);
Binder\InMethodBinder.cs (1)
248Debug.Assert(oldLocation != newLocation || oldLocation == Location.None || newLocation.SourceTree?.GetRoot().ContainsDiagnostics == true,
CommandLine\CSharpCompiler.cs (1)
262string entryPointFileName = PathUtilities.GetFileName(entryPoint.Locations.First().SourceTree!.FilePath);
Compilation\CSharpCompilation.cs (3)
3332var filePath = location.SourceTree?.FilePath; 4232var comparison = CompareSyntaxTreeOrdering(loc1.SourceTree!, loc2.SourceTree!);
Compilation\CSharpDiagnosticFilter.cs (3)
145Debug.Assert(location.SourceTree is null || location.SourceTree is CSharpSyntaxTree); 146var tree = location.SourceTree as CSharpSyntaxTree;
Compilation\CSharpSemanticModel.cs (1)
3229if (location.SourceTree == this.SyntaxTree && parameter.Span.Contains(location.SourceSpan))
Compilation\SyntaxTreeSemanticModel.cs (4)
1779if (loc.IsInSource && loc.SourceTree == this.SyntaxTree && declarationSpan.Contains(loc.SourceSpan)) 1800if (loc.IsInSource && loc.SourceTree == this.SyntaxTree && declarationSpan.Contains(loc.SourceSpan)) 2175if (location.SourceTree == this.SyntaxTree && parameter.Span.Contains(location.SourceSpan)) 2391if (location.SourceTree != this.SyntaxTree)
Compiler\DocumentationCommentCompiler.cs (3)
379Debug.Assert(location.SourceTree!.ReportDocumentationCommentDiagnostics()); //Should be the same tree as for the symbol. 394Debug.Assert(location.SourceTree!.ReportDocumentationCommentDiagnostics()); //Should be the same tree as for the symbol. 596if (location.SourceTree.ReportDocumentationCommentDiagnostics())
Compiler\DocumentationCommentCompiler.IncludeElementExpander.cs (2)
636if (treelessSyntax.ContainsDiagnostics && ((SyntaxTree)sourceLocation.SourceTree).ReportDocumentationCommentDiagnostics()) 652if (((SyntaxTree)sourceLocation.SourceTree).ReportDocumentationCommentDiagnostics())
Emitter\Model\PEModuleBuilder.cs (1)
447Cci.DebugSourceDocument doc = DebugDocumentsBuilder.TryGetDebugDocument(span.Path, basePath: location.SourceTree.FilePath);
SymbolDisplay\SymbolDisplayVisitor.Types.cs (1)
189: internalSymbol.Locations.FirstOrNone().SourceTree is { } tree ? $"<tree {internalSymbol.DeclaringCompilation.GetSyntaxTreeOrdinal(tree)}>"
SymbolDisplay\SymbolDisplayVisitor_Minimal.cs (2)
226if (location.IsInSource && location.SourceTree == semanticModelOpt.SyntaxTree) 228var token = location.SourceTree.GetRoot().FindToken(positionOpt);
Symbols\ConstantValueUtils.cs (1)
37var binderFactory = compilation.GetBinderFactory((SyntaxTree)symbol.Locations[0].SourceTree);
Symbols\LexicalSortKey.cs (1)
75: this((SyntaxTree)location.SourceTree, location.SourceSpan.Start, compilation)
Symbols\RangeVariableSymbol.cs (1)
64SyntaxToken token = (SyntaxToken)_locations[0].SourceTree.GetRoot().FindToken(_locations[0].SourceSpan.Start);
Symbols\Source\ModifierUtils.cs (5)
116=> ((result & modifier) != 0) && !Binder.CheckFeatureAvailability(errorLocation.SourceTree, featureID, diagnostics, errorLocation); 154LanguageVersion availableVersion = ((CSharpParseOptions)errorLocation.SourceTree.Options).LanguageVersion; 181Binder.CheckFeatureAvailability(errorLocation.SourceTree, MessageID.IDS_DefaultInterfaceImplementation, diagnostics, errorLocation); 216Debug.Assert(location.SourceTree is not null); 218LanguageVersion availableVersion = ((CSharpParseOptions)location.SourceTree.Options).LanguageVersion;
Symbols\Source\SourceMemberContainerSymbol.cs (1)
4194var languageVersion = ((CSharpParseOptions)this.Locations[0].SourceTree!.Options).LanguageVersion;
Symbols\Source\SourceUserDefinedOperatorSymbolBase.cs (3)
166LanguageVersion availableVersion = ((CSharpParseOptions)location.SourceTree.Options).LanguageVersion; 190Binder.CheckFeatureAvailability(location.SourceTree, MessageID.IDS_DefaultInterfaceImplementation, diagnostics, location); 727Binder.CheckFeatureAvailability(location.SourceTree, MessageID.IDS_FeatureRelaxedShiftOperator, diagnostics, location);
Symbols\Symbol.cs (2)
381SyntaxToken token = location.SourceTree.GetRoot().FindToken(location.SourceSpan.Start); 397SyntaxNode parent = location.SourceTree.GetRoot();
Symbols\Symbol_Attributes.cs (2)
482if (location.SourceTree == argumentLocation.SourceTree &&
Microsoft.CodeAnalysis.CSharp.CodeStyle (2)
CSharpSemanticFacts.cs (2)
69if (symbol.Locations.Any(static (loc, location) => loc.SourceTree == location.SourceTree && loc.SourceSpan.Contains(location.SourceSpan), location))
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (4)
CSharpCodeGenerationHelpers.cs (1)
200? contextLocation.SourceTree
CSharpMakeMethodAsynchronousCodeFixProvider.cs (2)
46if (diagnostic.Location.SourceTree is null) 49var root = diagnostic.Location.SourceTree.GetRoot(cancellationToken);
CSharpUseIsNullCheckForCastAndEqualityOperatorCodeFixProvider.cs (1)
47var title = GetTitle(negated, diagnostic.Location.SourceTree!.Options);
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (3)
Formatting\CodeCleanupTests.TestFixers.cs (3)
34var sourceTree = diagnostic.Location.SourceTree; 103var sourceTree = diagnostic.Location.SourceTree; 159var sourceTree = diagnostic.Location.SourceTree;
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (2)
Emit\EditAndContinue\EditAndContinueTestBase.cs (2)
80var tree1 = method1.Locations[0].SourceTree; 81var tree0 = method0.Locations[0].SourceTree;
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (5)
Diagnostics\GetDiagnosticsTests.cs (5)
386Assert.True(diagnostics[0].Location.SourceTree.Equals(syntaxTree1)); 387Assert.True(diagnostics[1].Location.SourceTree.Equals(syntaxTree2)); 388Assert.True(diagnostics[2].Location.SourceTree.Equals(syntaxTree3)); 412Assert.True(diagnostics[0].Location.SourceTree.Equals(syntaxTree1)); 413Assert.True(diagnostics[1].Location.SourceTree.Equals(syntaxTree2));
Microsoft.CodeAnalysis.CSharp.Features (4)
CSharpMakeMethodAsynchronousCodeFixProvider.cs (2)
46if (diagnostic.Location.SourceTree is null) 49var root = diagnostic.Location.SourceTree.GetRoot(cancellationToken);
CSharpUseIsNullCheckForCastAndEqualityOperatorCodeFixProvider.cs (1)
47var title = GetTitle(negated, diagnostic.Location.SourceTree!.Options);
Debugging\BreakpointResolver.cs (1)
41var tree = location.SourceTree;
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (2)
Semantics\OutVarTests.cs (2)
35604Assert.Equal(tree, identifierBefore.Location.SourceTree); 35610Assert.Null(identifierAfter.Location.SourceTree);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (8)
Symbols\Source\DeclaringSyntaxNodeTests.cs (4)
742Assert.Equal(new[] { source0, source1, source3 }, locations.Select(l => l.SourceTree)); 748Assert.Equal(new[] { source0, source1, source3, source4 }, locations.Select(l => l.SourceTree)); 753Assert.Equal(new[] { source0, source4, source3 }, locations.Select(l => l.SourceTree)); 763Assert.Equal(new[] { source4, source3 }, locations.Select(l => l.SourceTree));
Symbols\Source\FileModifierTests.cs (4)
614Assert.Equal(source1, classC.Locations[0].SourceTree); 661Assert.Equal(source1, member.Locations[0].SourceTree); 694Assert.Equal(source1, classC.Locations[0].SourceTree); 722Assert.Equal(source1, classC.Locations[0].SourceTree);
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (6)
Diagnostics\DiagnosticTest.cs (2)
86Assert.Same(syntaxTree, d1.Location.SourceTree); 100Assert.Same(syntaxTree, d3.Location.SourceTree);
Syntax\SyntaxNodeTests.cs (4)
2045Assert.Equal(tree, nodeLocation.SourceTree); 2050Assert.Equal(tree, tokenLocation.SourceTree); 2055Assert.Equal(tree, triviaLocation.SourceTree); 2061Assert.Equal(tree, spanLocation.SourceTree);
Microsoft.CodeAnalysis.CSharp.Workspaces (7)
CSharpCodeGenerationHelpers.cs (1)
200? contextLocation.SourceTree
CSharpSemanticFacts.cs (2)
69if (symbol.Locations.Any(static (loc, location) => loc.SourceTree == location.SourceTree && loc.SourceSpan.Contains(location.SourceSpan), location))
Rename\CSharpRenameRewriterLanguageService.cs (4)
146_renamableDeclarationLocation = _renamedSymbol.Locations.FirstOrDefault(loc => loc.IsInSource && loc.SourceTree == _semanticModel.SyntaxTree); 874var tree = location.SourceTree; 905var token = await location.SourceTree!.GetTouchingTokenAsync(location.SourceSpan.Start, cancellationToken, findInsideTrivia: true).ConfigureAwait(false); 1009var token = await implicitReferenceLocation.Location.SourceTree!.GetTouchingTokenAsync(
Microsoft.CodeAnalysis.EditorFeatures (3)
GoToDefinition\AbstractGoToDefinitionService.cs (1)
108var definitionTree = definitionLocation.SourceTree;
GoToDefinition\GoToDefinitionHelpers.cs (1)
92if (sourceLocations.All(l => solution.GetDocument(l.SourceTree) == null))
InlineRename\AbstractEditorInlineRenameService.SymbolRenameInfo.cs (1)
172var symbolSourceDocument = this.Document.Project.Solution.GetDocument(RenameSymbol.Locations.Single().SourceTree);
Microsoft.CodeAnalysis.EditorFeatures.DiagnosticsTests.Utilities (1)
CodeActions\AbstractCodeActionOrUserDiagnosticTest.cs (1)
529var documentOffset = initialMarkupWithoutSpans.IndexOf(diagnosticsWithTag.First().Location.SourceTree.ToString());
Microsoft.CodeAnalysis.EditorFeatures.Wpf (2)
Peek\PeekHelpers.cs (2)
50var root = identifierLocation.SourceTree.GetRoot(cancellationToken); 70return identifierLocation.SourceTree.GetLocation(node.Span).GetMappedLineSpan().Span;
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (6)
FindReferences\FindReferencesTests.LinkedFiles.vb (1)
267Dim documents = references.Select(Function(r) workspace.CurrentSolution.GetDocument(r.Definition.Locations.Single().SourceTree))
FindReferences\FindReferencesTests.vb (3)
307GroupBy(Function(loc) loc.SourceTree). 419GroupBy(Function(loc) loc.SourceTree). 500Return loc.IsInSource AndAlso Not loc.SourceTree.IsHiddenPosition(loc.SourceSpan.Start)
Rename\RenameEngineResult.vb (2)
219Dim documentId = ConflictResolution.OldSolution.GetDocumentId(location.SourceTree) 242Dim documentId = ConflictResolution.OldSolution.GetDocumentId(location.SourceTree)
Microsoft.CodeAnalysis.Features (62)
AbstractChangeNamespaceToMatchFolderCodeFixProvider.CustomFixAllProvider.cs (1)
86.GroupBy(diagnostic => diagnostic.Location.SourceTree)
AbstractMakeFieldReadonlyDiagnosticAnalyzer.cs (1)
262=> options.GetAnalyzerOptions(field.Locations[0].SourceTree!).PreferReadonly;
AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (2)
495if (diagnostic.Location.SourceTree == tree) 552Debug.Assert(diagnostic.Location.SourceTree == tree);
AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (2)
525foreach (var tree in namedTypeSymbol.Locations.Select(l => l.SourceTree)) 539foreach (var root in namedTypeSymbol.Locations.Select(l => l.SourceTree.GetRoot(cancellationToken)))
AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.cs (1)
141var option = analyzerOptions.GetAnalyzerOptions(location.SourceTree).UnusedParameters;
AbstractUseIsNullForReferenceEqualsCodeFixProvider.cs (1)
41var title = GetTitle(negated, diagnostic.Location.SourceTree!.Options);
AddParameterService.cs (1)
95=> solution.GetRequiredDocument(declarationLocation.Locations[0].SourceTree!));
ChangeSignature\AbstractChangeSignatureService.cs (2)
162var declarationDocument = solution.GetRequiredDocument(declarationLocation.SourceTree!); 451var tree = location.SourceTree;
CodeFixes\Configuration\ConfigurationUpdater.cs (1)
448var diagnosticSourceTree = _diagnostic?.Location.SourceTree;
CodeFixes\Configuration\ConfigureCodeStyle\ConfigureCodeStyleOptionCodeFixProvider.cs (2)
45diagnostic.Location.SourceTree == null) 50var language = diagnostic.Location.SourceTree.Options.Language;
CodeLens\CodeLensReferencesService.cs (4)
104var document = solution.GetDocument(location.SourceTree); 149var documentId = solution.GetDocument(location.SourceTree)?.Id; 248var document = solution.GetDocument(commonLocation.SourceTree); 279var document = solution.GetDocument(syntaxNode.GetLocation().SourceTree);
CodeLens\LocationComparer.cs (3)
22x.SourceTree.FilePath.Equals(y.SourceTree.FilePath, StringComparison.OrdinalIgnoreCase); 33StringComparer.OrdinalIgnoreCase.GetHashCode(obj.SourceTree.FilePath));
Debugging\AbstractBreakpointResolver.cs (1)
83var document = _solution.GetDocument(location.SourceTree);
DocumentHighlighting\AbstractDocumentHighlightsService.cs (2)
234var document = solution.GetDocument(location.SourceTree); 310var tree = location.SourceTree;
EditAndContinue\EmitSolutionUpdateResults.cs (3)
85var document = solution.GetDocument(diagnostic.Location.SourceTree); 101Debug.Assert(SyntaxError.Location.SourceTree != null); 102return DiagnosticData.Create(SyntaxError, solution.GetRequiredDocument(SyntaxError.Location.SourceTree));
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.UnitTestingSemanticChangeProcessor.cs (1)
183var documentId = solution.GetDocumentId(location.SourceTree, projectId);
ExtractMethod\MethodExtractor.VariableSymbol.cs (10)
160var commonTree = leftLocations.Select(l => l.SourceTree).Intersect(rightLocations.Select(l => l.SourceTree)).WhereNotNull().First(); 162var leftLocation = leftLocations.First(l => l.SourceTree == commonTree); 163var rightLocation = rightLocations.First(l => l.SourceTree == commonTree); 216Contract.ThrowIfFalse(_localSymbol.Locations[0].SourceTree == other._localSymbol.Locations[0].SourceTree); 236Contract.ThrowIfNull(_localSymbol.Locations[0].SourceTree); 238var tree = _localSymbol.Locations[0].SourceTree; 328Contract.ThrowIfFalse(locationLeft.SourceTree == locationRight.SourceTree);
FindUsages\AbstractFindUsagesService_FindImplementations.cs (1)
128if (location.IsInSource && !seenLocations.Add((location.SourceTree.FilePath, location.SourceSpan)))
FindUsages\IDefinitionsAndReferencesFactory.cs (1)
191var document = solution.GetDocument(location.SourceTree);
GenerateType\AbstractGenerateTypeService.State.cs (1)
309var sourceTreeToBeGeneratedIn = symbol.Locations.First(loc => loc.IsInSource).SourceTree;
InheritanceMargin\AbstractInheritanceMarginService_Helpers.cs (1)
725var document = solution.GetDocument(location.SourceTree);
NamingStyleDiagnosticAnalyzerBase.cs (1)
131var sourceTree = symbol.Locations.FirstOrDefault()?.SourceTree;
Navigation\NavigableItemFactory.cs (1)
46let doc = solution.GetDocument(c.SourceTree)
Navigation\NavigableItemFactory.SymbolLocationNavigableItem.cs (1)
42=> _location.IsInSource ? _solution.GetDocument(_location.SourceTree) : null;
NavigationBar\AbstractNavigationBarItemService.cs (4)
67var navigationLocationSpan = symbol.Locations.FirstOrDefault(loc => loc.SourceTree == tree)?.SourceSpan ?? 79var navigationLocation = symbol.Locations.FirstOrDefault(loc => loc.SourceTree != null && loc.SourceTree != tree) ?? 82var documentId = solution.GetDocumentId(navigationLocation.SourceTree);
PdbSourceDocument\PdbSourceDocumentMetadataAsSourceFileProvider.cs (1)
265var navigateDocument = navigateProject.GetDocument(navigateLocation.SourceTree);
PullMemberUp\MemberAndDestinationValidator.cs (1)
25destination.Locations.Any(static (location, arg) => location.IsInSource && !arg.solution.GetRequiredDocument(location.SourceTree).IsGeneratedCode(arg.cancellationToken), (solution, cancellationToken));
Rename\SymbolicRenameInfo.cs (1)
222var sourceDocument = solution.GetRequiredDocument(location.SourceTree);
Shared\Utilities\AnnotatedSymbolMapping.cs (1)
78var tree = location.SourceTree!;
SolutionCrawler\WorkCoordinator.SemanticChangeProcessor.cs (1)
182var documentId = solution.GetDocumentId(location.SourceTree, projectId);
SyncNamespaces\AbstractSyncNamespacesService.cs (3)
103RoslynDebug.AssertNotNull(firstDiagnostic?.Location?.SourceTree); 105var document = solution.GetRequiredDocument(firstDiagnostic.Location.SourceTree); 171.Where(diagnostic => diagnostic.Location.SourceTree?.FilePath == document.FilePath)
ValueTracking\ValueTrackedItem.cs (2)
51Contract.ThrowIfNull(location.SourceTree); 53var document = solution.GetRequiredDocument(location.SourceTree);
ValueTracking\ValueTracker.cs (3)
203if (location.SourceTree is null) 209var sourceDoc = collector.Solution.GetRequiredDocument(location.SourceTree); 291if (definitionLocation is not { SourceTree: not null })
Microsoft.CodeAnalysis.LanguageServer.Protocol (7)
Features\Diagnostics\DocumentAnalysisExecutor_Helpers.cs (7)
331RoslynDebug.Assert(location.SourceTree != null); 332if (project.GetDocument(location.SourceTree) == null) 335throw new ArgumentException(string.Format(FeaturesResources.Reported_diagnostic_0_has_a_source_location_in_file_1_which_is_not_part_of_the_compilation_being_analyzed, id, location.SourceTree.FilePath), "diagnostic"); 338if (location.SourceSpan.End > location.SourceTree.Length) 341throw new ArgumentException(string.Format(FeaturesResources.Reported_diagnostic_0_has_a_source_location_1_in_file_2_which_is_outside_of_the_given_file, id, location.SourceSpan, location.SourceTree.FilePath), "diagnostic"); 408if (diagnostic.Location.SourceTree != null) 410return targetTextDocument.Project.GetDocument(diagnostic.Location.SourceTree) == targetTextDocument;
Microsoft.CodeAnalysis.Test.Utilities (5)
Diagnostics\CommonDiagnosticAnalyzers.cs (1)
1696context.TryGetValue(location.SourceTree, _treeValueProvider, out var isGeneratedCode);
Diagnostics\DiagnosticDescription.cs (4)
160_squiggledText = _location.SourceTree.GetText().ToString(_location.SourceSpan); 284if (!_syntaxPredicate(d._location.SourceTree.GetRoot().FindToken(_location.SourceSpan.Start, true).Parent)) 297if (!d._syntaxPredicate(_location.SourceTree.GetRoot().FindToken(_location.SourceSpan.Start, true).Parent)) 544assertText.AppendLine(l.SourceTree.GetText().Lines.GetLineFromPosition(l.SourceSpan.Start).ToString());
Microsoft.CodeAnalysis.VisualBasic (27)
Binding\Binder_Expressions.vb (2)
2998declarationLocation.SourceTree Is referenceLocation.SourceTree Then
Binding\Binder_Invocation.vb (1)
1949If argument.Syntax.SyntaxTree Is diagnostic.Location.SourceTree AndAlso
CommandLine\CommandLineDiagnosticFormatter.vb (1)
132text = diagnostic.Location.SourceTree.GetText()
Compilation\SyntaxTreeSemanticModel.vb (3)
868If location.SourceTree Is Me.SyntaxTree AndAlso nodeToCheck.Span.Contains(location.SourceSpan) Then 1144If location.IsInSource AndAlso location.SourceTree Is _syntaxTree AndAlso parameter.Span.Contains(location.SourceSpan) Then 1330If location.IsInSource AndAlso location.SourceTree Is _syntaxTree AndAlso declarationSyntax.Span.Contains(location.SourceSpan) Then
Compilation\VisualBasicDiagnosticFilter.vb (3)
136Dim tree = location?.SourceTree 182If location IsNot Nothing AndAlso location.SourceTree IsNot Nothing AndAlso 183location.SourceTree.GetWarningState(id, location.SourceSpan.Start) = ReportDiagnostic.Suppress Then
Emit\PEModuleBuilder.vb (1)
282Dim doc As Cci.DebugSourceDocument = DebugDocumentsBuilder.TryGetDebugDocument(span.Path, basePath:=location.SourceTree.FilePath)
Locations\LocationExtensions.vb (1)
38Return DirectCast(location.SourceTree, VisualBasicSyntaxTree)
Locations\VBLocation.vb (1)
32Return DirectCast(Me.SourceTree, VisualBasicSyntaxTree)
Lowering\AsyncRewriter\AsyncRewriter.vb (1)
121Dim syntaxTree = containingType.Locations.FirstOrDefault()?.SourceTree
Symbols\LexicalSortKey.vb (3)
187If first.SourceTree IsNot Nothing AndAlso first.SourceTree Is second.SourceTree Then
Symbols\MethodSymbolExtensions.vb (1)
51If location.IsInSource AndAlso location.SourceTree Is syntaxTree AndAlso parameter.Span.Contains(location.SourceSpan) Then
Symbols\NamedTypeSymbolExtensions.vb (3)
30If methodLoc.IsInSource AndAlso methodLoc.SourceTree Is tree AndAlso methodLoc.SourceSpan = nameSpan Then 40If methodLoc.IsInSource AndAlso methodLoc.SourceTree Is tree AndAlso methodLoc.SourceSpan = nameSpan Then 62methodLoc.SourceTree Is tree AndAlso
Symbols\Source\SourceAssemblySymbol.vb (1)
478Dim compilationUnitSyntax = DirectCast(rootNs.Location.SourceTree.GetRoot(), CompilationUnitSyntax)
Symbols\Source\SourceMemberContainerTypeSymbol.vb (1)
1370Return containingSourceNamespace.GetDeclarationSpelling(firstLocation.SourceTree, firstLocation.SourceSpan.Start)
Symbols\Source\SourceModuleSymbol.vb (1)
1039Dim tree = DirectCast(loc.SourceTree, VisualBasicSyntaxTree)
Symbols\Source\SourceNamedTypeSymbol.vb (1)
540If location.IsInSource AndAlso Not DirectCast(location.SourceTree, VisualBasicSyntaxTree).IsEmbeddedSyntaxTree Then
Symbols\Symbol.vb (2)
313If location.IsInSource AndAlso location.SourceTree IsNot Nothing Then 314Dim token = CType(location.SourceTree.GetRoot().FindToken(location.SourceSpan.Start), SyntaxToken)
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures.UnitTests (3)
Formatting\CodeCleanUpTests.vb (3)
656Dim node = (Await diagnostic.Location.SourceTree.GetRootAsync(cancellationToken)).FindNode(diagnostic.Location.SourceSpan) 701Dim node = (Await diagnostic.Location.SourceTree.GetRootAsync(cancellationToken)).FindNode(diagnostic.Location.SourceSpan) 730Dim node = (Await diagnostic.Location.SourceTree.GetRootAsync(cancellationToken)).FindNode(diagnostic.Location.SourceSpan)
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (2)
Emit\EditAndContinue\EditAndContinueTestBase.vb (2)
126Dim tree1 = method1.Locations(0).SourceTree 127Dim tree0 = method0.Locations(0).SourceTree
Microsoft.CodeAnalysis.VisualBasic.Features (2)
Debugging\BreakpointResolver.vb (1)
31Dim tree = location.SourceTree
ExtractMethod\VisualBasicSelectionValidator.vb (1)
286symbol.Locations.First().SourceTree IsNot semanticModel.SyntaxTree Then
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (9)
Diagnostics\GetDiagnosticsTests.vb (9)
309Assert.True(diagnostics(0).Location.SourceTree.Equals(syntaxTree1)) 310Assert.True(diagnostics(1).Location.SourceTree.Equals(syntaxTree2)) 311Assert.True(diagnostics(2).Location.SourceTree.Equals(syntaxTree3)) 342Assert.True(diagnostics(0).Location.SourceTree.Equals(syntaxTree1)) 343Assert.True(diagnostics(1).Location.SourceTree.Equals(syntaxTree2)) 372Assert.True(diagnostics(0).Location.SourceTree.Equals(syntaxTree2)) ' Syntax tree parse options are reported in CompilationStage.Parse 375Assert.Null(diagnostics(1).Location.SourceTree) ' Compilation parse options are reported in CompilationStage.Declare 408Assert.True(diagnostics(0).Location.SourceTree.Equals(syntaxTree)) ' Syntax tree parse options are reported in CompilationStage.Parse 411Assert.Null(diagnostics(1).Location.SourceTree) ' Compilation parse options are reported in CompilationStage.Declare
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (40)
SymbolsTests\Source\SourceSymbolTests.vb (40)
337Order By l.SourceTree.FilePath 340Assert.Equal("a.vb", locs(0).SourceTree.FilePath) 341Assert.Equal("C", locs(0).SourceTree.GetText().ToString(locs(0).SourceSpan)) 342Assert.Equal("b.vb", locs(1).SourceTree.FilePath) 343Assert.Equal("C", locs(1).SourceTree.GetText().ToString(locs(1).SourceSpan)) 346Order By l.SourceTree.FilePath 349Assert.Equal("a.vb", locs(0).SourceTree.FilePath) 350Assert.Equal("D", locs(0).SourceTree.GetText().ToString(locs(0).SourceSpan)) 351Assert.Equal("b.vb", locs(1).SourceTree.FilePath) 352Assert.Equal("D", locs(1).SourceTree.GetText().ToString(locs(1).SourceSpan)) 355Order By l.SourceTree.FilePath 358Assert.Equal("a.vb", locs(0).SourceTree.FilePath) 359Assert.Equal("T", locs(0).SourceTree.GetText().ToString(locs(0).SourceSpan)) 360Assert.Equal("b.vb", locs(1).SourceTree.FilePath) 361Assert.Equal("T", locs(1).SourceTree.GetText().ToString(locs(1).SourceSpan)) 366Assert.Equal("a.vb", locs(0).SourceTree.FilePath) 367Assert.Equal("m1", locs(0).SourceTree.GetText().ToString(locs(0).SourceSpan)) 372Assert.Equal("a.vb", locs(0).SourceTree.FilePath) 373Assert.Equal("x", locs(0).SourceTree.GetText().ToString(locs(0).SourceSpan)) 378Assert.Equal("a.vb", locs(0).SourceTree.FilePath) 379Assert.Equal("v1$", locs(0).SourceTree.GetText().ToString(locs(0).SourceSpan)) 382Order By l.SourceTree.FilePath 385Assert.Equal("a.vb", locs(0).SourceTree.FilePath) 386Assert.Equal("N1", locs(0).SourceTree.GetText().ToString(locs(0).SourceSpan)) 387Assert.Equal("b.vb", locs(1).SourceTree.FilePath) 388Assert.Equal("N1", locs(1).SourceTree.GetText().ToString(locs(1).SourceSpan)) 391Order By l.SourceTree.FilePath 394Assert.Equal("a.vb", locs(0).SourceTree.FilePath) 395Assert.Equal("N2", locs(0).SourceTree.GetText().ToString(locs(0).SourceSpan)) 396Assert.Equal("b.vb", locs(1).SourceTree.FilePath) 397Assert.Equal("N2", locs(1).SourceTree.GetText().ToString(locs(1).SourceSpan)) 400Order By l.SourceTree.FilePath 403Assert.Equal("a.vb", locs(0).SourceTree.FilePath) 404Assert.Equal("N3", locs(0).SourceTree.GetText().ToString(locs(0).SourceSpan)) 405Assert.Equal("b.vb", locs(1).SourceTree.FilePath) 406Assert.Equal("N3", locs(1).SourceTree.GetText().ToString(locs(1).SourceSpan)) 658Assert.Equal({source0, source1, source3}, locations.Select(Function(l) l.SourceTree)) 672Assert.Equal({source0, source1, source3, source4}, locations.Select(Function(l) l.SourceTree)) 677Assert.Equal({source0, source4, source3}, locations.Select(Function(l) l.SourceTree)) 687Assert.Equal({source4, source3}, locations.Select(Function(l) l.SourceTree))
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (3)
CompilationTestUtils.vb (3)
996Dim lineText As String = GetLineText(sourceLocation.SourceTree.GetText(), sourceLocation.SourceSpan.Start, offsetInLine) 1039Dim sourceTree1 = loc1.SourceTree 1040Dim sourceTree2 = loc2.SourceTree
Microsoft.CodeAnalysis.VisualBasic.Workspaces (2)
Rename\VisualBasicRenameRewriterLanguageService.vb (2)
124_renamableDeclarationLocation = _renamedSymbol.Locations.Where(Function(loc) loc.IsInSource AndAlso loc.SourceTree Is _semanticModel.SyntaxTree).FirstOrDefault() 816Dim token = Await implicitReferenceLocation.Location.SourceTree.GetTouchingTokenAsync(
Microsoft.CodeAnalysis.Workspaces (57)
AbstractCodeGenerationService.cs (1)
494if (location.SourceTree != destinationMember.SyntaxTree)
AbstractCodeGenerationService_FindDeclaration.cs (1)
190declaration = await SelectFirstOrDefaultAsync(declarations.Where(r => r.SyntaxTree == location.SourceTree), node => true, cancellationToken).ConfigureAwait(false);
CodeFixes\CodeFix.cs (1)
64var document = Project.GetDocument(diagnostic.Location.SourceTree);
CodeFixes\FixAllOccurrences\BatchFixAllProvider.cs (2)
121.OrderBy(d => d.Location.SourceTree!.FilePath) 150var document = solution.GetRequiredDocument(diagnostic.Location.SourceTree!);
CodeFixes\FixAllOccurrences\FixAllContextHelper.cs (1)
133foreach (var (document, diagnosticsForDocument) in diagnostics.GroupBy(d => solution.GetDocument(d.Location.SourceTree)))
CodeGenerationHelpers.cs (2)
203if (info.Context.AfterThisLocation?.SourceTree is { } afterSourceTree && 219if (info.Context.BeforeThisLocation?.SourceTree is { } beforeSourceTree &&
Diagnostics\DiagnosticAnalysisResultBuilder.cs (2)
134=> AddDiagnostic(ref _lazySemanticLocals, diagnostic.Location.SourceTree, diagnostic); 172var diagnosticTree = diagnostic.Location.SourceTree;
Diagnostics\DiagnosticData.cs (1)
291builder.AddIfNotNull(CreateLocation(document.Project.Solution.GetDocument(location.SourceTree), location));
Diagnostics\Extensions.cs (4)
198var diagnostics = additionalPragmaSuppressionDiagnostics.WhereAsArray(d => d.Location.SourceTree == treeToAnalyze); 205foreach (var group in additionalPragmaSuppressionDiagnostics.GroupBy(d => d.Location.SourceTree!)) 263Debug.Assert(diagnostics.All(d => d.Location.SourceTree == tree)); 275Debug.Assert(diagnostics.All(d => d.Location.SourceTree == tree));
Editing\SymbolEditor.cs (1)
325var sourceTree = location.SourceTree;
FindSymbols\FindReferences\Finders\AbstractMemberScopedReferenceFinder.cs (1)
38var document = project.GetDocument(location.SourceTree);
FindSymbols\ReferenceLocation.cs (2)
148var thisPath = this.Location.SourceTree?.FilePath; 149var otherPath = other.Location.SourceTree?.FilePath;
LocationExtensions.cs (5)
15Contract.ThrowIfNull(location.SourceTree); 16return location.SourceTree; 38var tree = loc.SourceTree; 45return loc1.SourceTree == loc2.SourceTree && loc1.SourceSpan.IntersectsWith(loc2.SourceSpan);
ProjectExtensions.cs (1)
53var diagnosticFilePath = PathUtilities.GetDirectoryName(diagnostic?.Location.SourceTree?.FilePath ?? project.FilePath);
ReassignedVariable\AbstractReassignedVariableService.cs (1)
188if (parameterLocation.SourceTree == semanticModel.SyntaxTree)
Recommendations\AbstractRecommendationServiceRunner.cs (1)
306static (candidateLocation, declarationSyntax) => !(declarationSyntax.SyntaxTree == candidateLocation.SourceTree &&
Rename\ConflictEngine\ConflictResolver.cs (10)
193Contract.ThrowIfNull(implicitUsageConflict.SourceTree); 195implicitUsageConflict.SourceSpan, conflictResolution.OldSolution.GetRequiredDocument(implicitUsageConflict.SourceTree).Id, RelatedLocationType.UnresolvableConflict)); 217Contract.ThrowIfNull(implicitConflict.SourceTree); 219implicitConflict.SourceSpan, conflictResolution.OldSolution.GetRequiredDocument(implicitConflict.SourceTree).Id, RelatedLocationType.UnresolvableConflict)); 310Contract.ThrowIfNull(languageConflict.SourceTree); 312languageConflict.SourceSpan, conflictResolution.OldSolution.GetRequiredDocument(languageConflict.SourceTree).Id, RelatedLocationType.UnresolvableConflict)); 337Contract.ThrowIfNull(oldLocation.SourceTree); 339oldLocation.SourceSpan, conflictResolution.OldSolution.GetRequiredDocument(oldLocation.SourceTree).Id, RelatedLocationType.UnresolvableConflict)); 373renameDeclarationLocations[symbolIndex] = new RenameDeclarationLocationReference(solution.GetDocumentId(location.SourceTree), location.SourceSpan, overriddenFromMetadata, locations.Length); 414.OrderBy(l => l.IsInSource ? solution.GetDocumentId(l.SourceTree)!.Id : Guid.Empty)
Rename\ConflictEngine\ConflictResolver.Session.cs (4)
68_documentIdOfRenameSymbolDeclaration = renameLocationSet.Solution.GetRequiredDocument(renameSymbolDeclarationLocation.SourceTree!).Id; 244.Select(l => conflictResolution.OldSolution.GetRequiredDocument(l.SourceTree!)) 598var overridingSymbol = await SymbolFinder.FindSymbolAtPositionAsync(solution.GetRequiredDocument(newLocation.SourceTree), newLocation.SourceSpan.Start, cancellationToken: _cancellationToken).ConfigureAwait(false); 704var allRenamedDocuments = _renameLocationSet.Locations.Select(loc => loc.Location.SourceTree!).Distinct().Select(solution.GetRequiredDocument);
Rename\RenameUtilities.cs (1)
91var documentsOfRenameSymbolDeclaration = symbol.Locations.Where(l => l.IsInSource).Select(l => solution.GetRequiredDocument(l.SourceTree!));
Rename\SymbolicRenameLocations.ReferenceProcessing.cs (6)
190var syntaxFacts = solution.GetRequiredDocument(firstLocation.SourceTree!) 221var document = solution.GetRequiredDocument(location.SourceTree); 266Contract.ThrowIfNull(aliasLocation.SourceTree); 267results.Add(new RenameLocation(aliasLocation, solution.GetRequiredDocument(aliasLocation.SourceTree).Id)); 285Contract.ThrowIfNull(aliasLocation.SourceTree); 286results.Add(new RenameLocation(aliasLocation, solution.GetRequiredDocument(aliasLocation.SourceTree).Id));
SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
46var syntaxTree = location.SourceTree;
SymbolKey.BodyLevelSymbolKey.cs (2)
78var syntaxTree = locations[0].SourceTree; 182var firstSourceTree = locations[0]?.SourceTree;
SymbolKey.cs (1)
164return compilation.SyntaxTrees.Contains(locations.First().SourceTree);
SymbolKey.SymbolKeyReader.cs (2)
742if (location.SourceTree != null) 745var semanticModel = Compilation.GetSemanticModel(location.SourceTree);
SymbolKey.SymbolKeyWriter.cs (1)
257WriteString(location.SourceTree.FilePath);
Workspace\Solution\SolutionState.SymbolToProjectId.cs (2)
37var syntaxTree = symbol.Locations[0].SourceTree; 137var tree = typeParameter.Locations[0].SourceTree;
Microsoft.VisualStudio.LanguageServices (18)
CallHierarchy\CallHierarchyDetail.cs (5)
38_documentId = workspace.CurrentSolution.GetDocumentId(location.SourceTree); 42_sourceFile = location.SourceTree.FilePath; 51var start = location.SourceTree.GetText().Lines[lineSpan.StartLinePosition.Line].Start; 52var end = location.SourceTree.GetText().Lines[lineSpan.EndLinePosition.Line].End; 53return location.SourceTree.GetText().GetSubText(TextSpan.FromBounds(start, end)).ToString();
Diagnostics\VisualStudioVenusSpanMappingService.cs (2)
73if (location.SourceTree != null) 75return location.SourceTree.GetText().Lines;
MoveStaticMembers\VisualStudioMoveStaticMembersOptionsService.cs (1)
161private static string GetFile(Location loc) => loc.SourceTree!.FilePath;
Progression\GraphBuilder.cs (4)
186var preferredLocation = symbol.Locations.FirstOrDefault(l => l.SourceTree != null); 193preferredLocation = symbol.Locations.FirstOrDefault(l => l.SourceTree == syntaxTree) ?? preferredLocation; 218if (preferredLocation?.SourceTree != null) 222preferredLocation.SourceTree.FilePath,
Progression\GraphQueries\IsUsedByGraphQuery.cs (3)
53if (location.SourceTree == null) 56var lineText = location.SourceTree.GetText(cancellationToken).Lines[span.StartLinePosition.Line].ToString(); 57var filePath = location.SourceTree.FilePath;
Venus\ContainedLanguageCodeSupport.cs (2)
211var position = type.Locations.First(loc => loc.SourceTree == targetSyntaxTree).SourceSpan.Start; 496var typeLocation = type.Locations.FirstOrDefault(d => d.SourceTree == containingTree);
Workspace\VisualStudioSymbolNavigationService.cs (1)
75var targetDocument = solution.GetDocument(sourceLocation.SourceTree);
Microsoft.VisualStudio.LanguageServices.Implementation (4)
CodeModel\AbstractCodeModelService.cs (1)
596var document = project.GetDocument(location.SourceTree);
CodeModel\Collections\OverloadsCollection.cs (1)
74var document = solution.GetDocument(location.SourceTree);
CodeModel\Collections\PartialTypeCollection.cs (1)
57var document = solution.GetDocument(location.SourceTree);
RoslynVisualStudioWorkspace.cs (1)
161var tree = sourceLocation.SourceTree;
Microsoft.VisualStudio.LanguageServices.VisualBasic (2)
Venus\ContainedLanguageStaticEventBinding.vb (2)
66Dim targetDocument = document.Project.Solution.GetDocument(memberSymbol.Locations.First().SourceTree) 94Dim targetDocument = document.Project.Solution.GetDocument(memberSymbol.Locations.First().SourceTree)