1 instantiation of ProjectState
Microsoft.CodeAnalysis.Workspaces (1)
Workspace\Solution\SolutionState.cs (1)
366var newProject = new ProjectState(languageServices, projectInfo, fallbackAnalyzerOptions);
220 references to ProjectState
Microsoft.CodeAnalysis.Features (1)
InheritanceMargin\AbstractInheritanceMarginService_Helpers.cs (1)
215var projectState = document.Project.State;
Microsoft.CodeAnalysis.LanguageServer.Protocol (1)
Handler\SpellCheck\AbstractSpellCheckingHandler.cs (1)
33/// cref="ProjectState.GetParseOptionsChecksum"/> and <see cref="DocumentStateChecksums.Text"/>
Microsoft.CodeAnalysis.Workspaces (217)
FindSymbols\FindReferences\DependentTypeFinder_ProjectIndex.cs (1)
24private static readonly ConditionalWeakTable<ProjectState, AsyncLazy<ProjectIndex>> s_projectToIndex = new();
FindSymbols\Shared\AbstractSyntaxIndex.cs (6)
19protected delegate TIndex IndexCreator(ProjectState project, SyntaxNode root, Checksum checksum, CancellationToken cancellationToken); 30SolutionKey solutionKey, ProjectState project, DocumentState document, IndexReader read, IndexCreator create, CancellationToken cancellationToken) 37protected static ValueTask<TIndex?> GetIndexAsync(SolutionKey solutionKey, ProjectState project, DocumentState document, IndexReader read, IndexCreator create, CancellationToken cancellationToken) 43ProjectState project, 81ProjectState project, 115ProjectState project,
FindSymbols\Shared\AbstractSyntaxIndex_Persistence.cs (4)
39ProjectState project, 93ProjectState project, 135ProjectState project, 156ProjectState project,
FindSymbols\SymbolTree\SymbolTreeInfo_Source.cs (2)
68private static readonly ConditionalWeakTable<ProjectState, AsyncLazy<Checksum>> s_projectToSourceChecksum = new(); 81private static async Task<Checksum> ComputeSourceSymbolsChecksumAsync(ProjectState projectState, CancellationToken cancellationToken)
FindSymbols\SyntaxTree\SyntaxTreeIndex.cs (3)
41public static ValueTask<SyntaxTreeIndex> GetRequiredIndexAsync(SolutionKey solutionKey, ProjectState project, DocumentState document, CancellationToken cancellationToken) 47public static ValueTask<SyntaxTreeIndex?> GetIndexAsync(SolutionKey solutionKey, ProjectState project, DocumentState document, CancellationToken cancellationToken) 53public static ValueTask<SyntaxTreeIndex?> GetIndexAsync(SolutionKey solutionKey, ProjectState project, DocumentState document, bool loadOnly, CancellationToken cancellationToken)
FindSymbols\SyntaxTree\SyntaxTreeIndex_Create.cs (3)
38private static readonly ConditionalWeakTable<ProjectState, StringTable> s_projectStringTable = new(); 41ProjectState project, SyntaxNode root, Checksum checksum, CancellationToken _) 335public static StringTable GetStringTable(ProjectState project)
FindSymbols\TopLevelSyntaxTree\IDeclaredSymbolInfoFactoryService.cs (1)
16void AddDeclaredSymbolInfos(ProjectState project, SyntaxNode root, ArrayBuilder<DeclaredSymbolInfo> declaredSymbolInfos, Dictionary<string, ArrayBuilder<int>> extensionMethodInfo, CancellationToken cancellationToken);
FindSymbols\TopLevelSyntaxTree\TopLevelSyntaxTreeIndex.cs (3)
49public static ValueTask<TopLevelSyntaxTreeIndex> GetRequiredIndexAsync(SolutionKey solutionKey, ProjectState project, DocumentState document, CancellationToken cancellationToken) 55public static ValueTask<TopLevelSyntaxTreeIndex?> GetIndexAsync(SolutionKey solutionKey, ProjectState project, DocumentState document, CancellationToken cancellationToken) 61public static ValueTask<TopLevelSyntaxTreeIndex?> GetIndexAsync(SolutionKey solutionKey, ProjectState project, DocumentState document, bool loadOnly, CancellationToken cancellationToken)
FindSymbols\TopLevelSyntaxTree\TopLevelSyntaxTreeIndex_Create.cs (1)
16ProjectState project, SyntaxNode root, Checksum checksum, CancellationToken cancellationToken)
LanguageServices\DeclaredSymbolFactoryService\AbstractDeclaredSymbolInfoFactoryService.cs (1)
153ProjectState project,
Workspace\Host\PersistentStorage\ProjectKey.cs (2)
37public static ProjectKey ToProjectKey(SolutionState solutionState, ProjectState projectState) 40public static ProjectKey ToProjectKey(SolutionKey solutionKey, ProjectState projectState)
Workspace\ProjectSystem\ProjectSystemProject.cs (1)
302var projectState = solution.SolutionState.GetRequiredProjectState(projectId);
Workspace\ProjectSystem\ProjectSystemProjectFactory.cs (2)
600var projectWithMetadataReference = solution.GetProjectState(projectIdWithMetadataReference); 601var referencedProject = solution.GetProjectState(referencedProjectId);
Workspace\Solution\Document.cs (1)
596var provider = (ProjectState.ProjectHostAnalyzerConfigOptionsProvider)Project.State.HostAnalyzerOptions.AnalyzerConfigOptionsProvider;
Workspace\Solution\Project.cs (2)
34internal Project(Solution solution, ProjectState projectState) 43internal ProjectState State { get; }
Workspace\Solution\ProjectState.AnalyzerConfigOptionsCache.cs (1)
19/// This cache is stored on <see cref="ProjectState"/> and needs to be invalidated whenever <see cref="SolutionState.FallbackAnalyzerOptions"/> for the language of the project change,
Workspace\Solution\ProjectState.cs (38)
387internal sealed class ProjectAnalyzerConfigOptionsProvider(ProjectState projectState) : AnalyzerConfigOptionsProvider 457internal sealed class ProjectHostAnalyzerConfigOptionsProvider(ProjectState projectState) : AnalyzerConfigOptionsProvider 706private ProjectState With( 732private ProjectState WithNewerAttributes(ProjectInfo.ProjectAttributes attributes) 740public ProjectState WithName(string name) 743public ProjectState WithFilePath(string? filePath) 746public ProjectState WithAssemblyName(string assemblyName) 749public ProjectState WithOutputFilePath(string? outputFilePath) 752public ProjectState WithOutputRefFilePath(string? outputRefFilePath) 755public ProjectState WithCompilationOutputInfo(in CompilationOutputInfo info) 758public ProjectState WithDefaultNamespace(string? defaultNamespace) 761public ProjectState WithHasAllInformation(bool hasAllInformation) 764public ProjectState WithRunAnalyzers(bool runAnalyzers) 767internal ProjectState WithHasSdkCodeStyleAnalyzers(bool hasSdkCodeStyleAnalyzers) 770public ProjectState WithChecksumAlgorithm(SourceHashAlgorithm checksumAlgorithm) 785public ProjectState WithCompilationOptions(CompilationOptions? options) 803public ProjectState WithParseOptions(ParseOptions? options) 825public ProjectState WithFallbackAnalyzerOptions(StructuredAnalyzerConfigOptions options) 835public static bool IsSameLanguage(ProjectState project1, ProjectState project2) 854public ProjectState WithProjectReferences(IReadOnlyList<ProjectReference> projectReferences) 864public ProjectState WithMetadataReferences(IReadOnlyList<MetadataReference> metadataReferences) 874public ProjectState WithAnalyzerReferences(IReadOnlyList<AnalyzerReference> analyzerReferences) 884public ProjectState AddDocuments(ImmutableArray<DocumentState> documents) 896public ProjectState AddAdditionalDocuments(ImmutableArray<AdditionalDocumentState> documents) 908public ProjectState AddAnalyzerConfigDocuments(ImmutableArray<AnalyzerConfigDocumentState> documents) 920private ProjectState CreateNewStateForChangedAnalyzerConfig(TextDocumentStates<AnalyzerConfigDocumentState> newAnalyzerConfigDocumentStates, StructuredAnalyzerConfigOptions fallbackOptions) 939public ProjectState RemoveDocuments(ImmutableArray<DocumentId> documentIds) 952public ProjectState RemoveAdditionalDocuments(ImmutableArray<DocumentId> documentIds) 962public ProjectState RemoveAnalyzerConfigDocuments(ImmutableArray<DocumentId> documentIds) 972public ProjectState RemoveAllNormalDocuments() 985public ProjectState UpdateDocument(DocumentState newDocument) 988public ProjectState UpdateDocuments(ImmutableArray<DocumentState> oldDocuments, ImmutableArray<DocumentState> newDocuments) 1011public ProjectState UpdateAdditionalDocument(AdditionalDocumentState newDocument) 1014public ProjectState UpdateAdditionalDocuments(ImmutableArray<AdditionalDocumentState> oldDocuments, ImmutableArray<AdditionalDocumentState> newDocuments) 1036public ProjectState UpdateAnalyzerConfigDocument(AnalyzerConfigDocumentState newDocument) 1039public ProjectState UpdateAnalyzerConfigDocuments(ImmutableArray<AnalyzerConfigDocumentState> oldDocuments, ImmutableArray<AnalyzerConfigDocumentState> newDocuments) 1046public ProjectState UpdateDocumentsOrder(ImmutableList<DocumentId> documentIds)
Workspace\Solution\Solution.cs (15)
86internal ProjectState? GetProjectState(ProjectId projectId) => this.SolutionState.GetProjectState(projectId); 156var state = solution.SolutionState.GetProjectState(projectId); 649var oldProject = GetRequiredProjectState(projectId); 741var oldProject = GetRequiredProjectState(projectId); 828var oldProject = GetRequiredProjectState(projectId); 922private static SourceCodeKind GetSourceCodeKind(ProjectState project) 937var project = GetRequiredProjectState(documentId.ProjectId); 958var project = GetRequiredProjectState(documentId.ProjectId); 977var project = GetRequiredProjectState(documentId.ProjectId); 984private Solution AddDocumentImpl(ProjectState project, DocumentId documentId, string name, SourceText text, IReadOnlyList<string>? folders, string? filePath, bool isGenerated) 1009var project = GetRequiredProjectState(documentId.ProjectId); 1102var project = GetRequiredProjectState(documentId.ProjectId); 1115internal ProjectState GetRequiredProjectState(ProjectId projectId) 1845var projectState = this.SolutionState.GetRequiredProjectState(projectId); 1853var referencedProjectState = this.SolutionState.GetProjectState(projectReference.ProjectId);
Workspace\Solution\SolutionChanges.cs (2)
40var newState = _newSolution.GetProjectState(id); 41var oldState = old.GetProjectState(id);
Workspace\Solution\SolutionCompilationState.cs (27)
36/// about the solution structure. Specifically, the set of green <see cref="ProjectState"/>s, with all their 180var newProjectState = stateChange.NewProjectState; 565var oldProject = SolutionState.GetRequiredProjectState(projectId); 601var oldProjectState = SolutionState.GetRequiredProjectState(projectId); 807var oldProjectState = SolutionState.GetRequiredProjectState(projectId); 832Func<ProjectState, ImmutableArray<TDocumentState>, TranslationAction> getTranslationAction) 866private static TranslationAction GetUpdateDocumentsTranslationAction<TDocumentState>(ProjectState oldProjectState, ImmutableArray<TDocumentState> newDocumentStates) 877TranslationAction GetUpdateOrdinaryDocumentsTranslationAction(ProjectState oldProjectState, ImmutableArray<DocumentState> newDocumentStates) 884TranslationAction GetUpdateAdditionalDocumentsTranslationAction(ProjectState oldProjectState, ImmutableArray<AdditionalDocumentState> newDocumentStates) 891TranslationAction GetUpdateAnalyzerConfigDocumentsTranslationAction(ProjectState oldProjectState, ImmutableArray<AnalyzerConfigDocumentState> newDocumentStates) 1091var projectState = solution.GetProjectState(projectId); 1138/// Returns the compilation for the specified <see cref="ProjectState"/>. Can return <see langword="null"/> when the project 1144public Task<Compilation?> GetCompilationAsync(ProjectState project, CancellationToken cancellationToken) 1154public Task<bool> HasSuccessfullyLoadedAsync(ProjectState project, CancellationToken cancellationToken) 1166public ValueTask<TextDocumentStates<SourceGeneratedDocumentState>> GetSourceGeneratedDocumentStatesAsync(ProjectState project, CancellationToken cancellationToken) 1169/// <inheritdoc cref="GetSourceGeneratedDocumentStatesAsync(ProjectState, CancellationToken)"/> 1171ProjectState project, bool withFrozenSourceGeneratedDocuments, CancellationToken cancellationToken) 1179ProjectState project, CancellationToken cancellationToken) 1187ProjectState project, CancellationToken cancellationToken) 1215ICompilationTracker tracker, ProjectState fromProject, ProjectReference projectReference, bool includeCrossLanguage, CancellationToken cancellationToken) 1249ProjectReference projectReference, ProjectState fromProject, bool includeCrossLanguage, CancellationToken cancellationToken) 1474private (ImmutableDictionary<ProjectId, ProjectState>, ImmutableSegmentedDictionary<ProjectId, ICompilationTracker>) ComputeFrozenSnapshotMaps(CancellationToken cancellationToken) 1630var oldProjectState = currentState.SolutionState.GetRequiredProjectState(documentId.ProjectId); 1675var projectState = SolutionState.GetRequiredProjectState(projectId); 1708var oldProjectState = SolutionState.GetRequiredProjectState(projectId); 1732private static TranslationAction GetRemoveDocumentsTranslationAction<TDocumentState>(ProjectState oldProject, ImmutableArray<DocumentId> documentIds, ImmutableArray<TDocumentState> states) 1741private static TranslationAction GetAddDocumentsTranslationAction<TDocumentState>(ProjectState oldProject, ImmutableArray<TDocumentState> states)
Workspace\Solution\SolutionCompilationState.ICompilationTracker.cs (2)
16ProjectState ProjectState { get; } 38ICompilationTracker Fork(ProjectState newProject, TranslationAction? translate);
Workspace\Solution\SolutionCompilationState.RegularCompilationTracker.cs (13)
32private static readonly Func<ProjectState, string> s_logBuildCompilationAsync = 37public ProjectState ProjectState { get; } 59ProjectState project, 79public RegularCompilationTracker(ProjectState project) 125ProjectState newProjectState, 495var referencedProject = compilationState.SolutionState.GetProjectState(projectReference.ProjectId); 811var frozenProjectState = inProgressState.PendingTranslationActions.IsEmpty 930var projectState = inProgressState.PendingTranslationActions is [var translationAction, ..] 947private static void ValidateCompilationTreesMatchesProjectState(Compilation compilation, ProjectState projectState, CompilationTrackerGeneratorInfo? generatorInfo) 1032var projectState = this.ProjectState; 1071var projectState = this.ProjectState; 1122var depProject = solution.GetRequiredProjectState(id); 1128var referencedProject = solution.GetRequiredProjectState(projectId);
Workspace\Solution\SolutionCompilationState.RegularCompilationTracker_Generators.cs (2)
391static GeneratorDriver CreateGeneratorDriver(ProjectState projectState) 406static void CheckGeneratorDriver(GeneratorDriver generatorDriver, ProjectState projectState)
Workspace\Solution\SolutionCompilationState.SkeletonReferenceCache.cs (2)
43/// cref="ProjectState"/>, causing it to see a view of the world inapplicable to its current snapshot. A downside 115/// Produces a copy of the <see cref="SkeletonReferenceCache"/>, allowing forks of <see cref="ProjectState"/> to
Workspace\Solution\SolutionCompilationState.SymbolToProjectId.cs (1)
24var projectState = this.SolutionState.GetProjectState(documentId.ProjectId);
Workspace\Solution\SolutionCompilationState.TranslationAction.cs (4)
21public readonly ProjectState OldProjectState; 26public readonly ProjectState NewProjectState; 28protected TranslationAction(ProjectState oldProjectState, ProjectState newProjectState)
Workspace\Solution\SolutionCompilationState.TranslationAction_Actions.cs (6)
22ProjectState oldProjectState, 23ProjectState newProjectState, 70ProjectState oldProjectState, 71ProjectState newProjectState, 112ProjectState oldProjectState, 113ProjectState newProjectState)
Workspace\Solution\SolutionCompilationState.WithFrozenSourceGeneratedDocumentsCompilationTracker.cs (2)
41public ProjectState ProjectState => UnderlyingTracker.ProjectState; 76public ICompilationTracker Fork(ProjectState newProject, TranslationAction? translate)
Workspace\Solution\SolutionCompilationState_SourceGenerators.cs (9)
34/// of analyzer references (see <see cref="ProjectState.AnalyzerReferences"/>) to all the <see 39private static readonly ConditionalWeakTable<ProjectState, SourceGeneratorMap> s_projectStateToSourceGeneratorsMap = new(); 56private static ImmutableArray<ISourceGenerator> GetSourceGenerators(ProjectState projectState) 65private static AnalyzerReference GetAnalyzerReference(ProjectState projectState, ISourceGenerator sourceGenerator) 79private static SourceGeneratorMap? GetSourceGeneratorMap(ProjectState projectState) 86static SourceGeneratorMap ComputeSourceGenerators(ProjectState projectState) 106var projectState = this.SolutionState.GetRequiredProjectState(projectId); 122AsyncLazy<bool> GetLazy(AnalyzerReferenceMap analyzerReferenceMap, ProjectState projectState) 129SolutionCompilationState solution, ProjectState projectState, CancellationToken cancellationToken)
Workspace\Solution\SolutionState.cs (57)
25ProjectState OldProjectState, 26ProjectState NewProjectState); 73ImmutableDictionary<ProjectId, ProjectState> idToProjectStateMap, 119idToProjectStateMap: ImmutableDictionary<ProjectId, ProjectState>.Empty, 129public ImmutableDictionary<ProjectId, ProjectState> ProjectStates { get; } 172ImmutableDictionary<ProjectId, ProjectState>? idToProjectStateMap = null, 254foreach (var project in this.ProjectStates.Values) 310public ProjectState? GetProjectState(ProjectId projectId) 311=> ProjectStates.TryGetValue(projectId, out var state) ? state : null; 313public ProjectState GetRequiredProjectState(ProjectId projectId) 315var result = GetProjectState(projectId); 332using var _ = ArrayBuilder<ProjectState>.GetInstance(projectInfos.Count, out var projectStates); 338ProjectState CreateProjectState(ProjectInfo projectInfo) 366var newProject = new ProjectState(languageServices, projectInfo, fallbackAnalyzerOptions); 370SolutionState AddProjects(ArrayBuilder<ProjectState> projectStates) 381foreach (var projectState in projectStates) 393foreach (var projectState in projectStates) 511var oldProject = GetRequiredProjectState(projectId); 527var oldProject = GetRequiredProjectState(projectId); 543var oldProject = GetRequiredProjectState(projectId); 559var oldProject = GetRequiredProjectState(projectId); 575var oldProject = GetRequiredProjectState(projectId); 591var oldProject = GetRequiredProjectState(projectId); 607var oldProject = GetRequiredProjectState(projectId); 623var oldProject = GetRequiredProjectState(projectId); 640var oldProject = GetRequiredProjectState(projectId); 657var oldProject = GetRequiredProjectState(projectId); 674var oldProject = GetRequiredProjectState(projectId); 692var oldProject = GetRequiredProjectState(projectId); 710var oldProject = GetRequiredProjectState(projectId); 728var oldProject = GetRequiredProjectState(projectId); 749var oldProject = GetRequiredProjectState(projectId); 789var oldProject = GetRequiredProjectState(projectId); 806var oldProject = GetRequiredProjectState(projectId); 837var oldProject = GetRequiredProjectState(projectId); 855var oldProject = GetRequiredProjectState(projectId); 872var oldProject = GetRequiredProjectState(projectId); 888var oldProject = GetRequiredProjectState(projectId); 940var oldProject = GetRequiredProjectState(documentId.ProjectId); 956var oldProject = GetRequiredProjectState(documentId.ProjectId); 968var oldProject = GetRequiredProjectState(newDocument.Id.ProjectId); 984var oldProject = GetRequiredProjectState(documentId.ProjectId); 1000var oldProject = GetRequiredProjectState(documentId.ProjectId); 1016var oldProject = GetRequiredProjectState(documentId.ProjectId); 1032var oldProject = GetRequiredProjectState(documentId.ProjectId); 1048var oldProject = GetRequiredProjectState(documentId.ProjectId); 1064var oldProject = GetRequiredProjectState(documentId.ProjectId); 1108var oldProject = GetRequiredProjectState(newDocument.Id.ProjectId); 1121var oldProject = GetRequiredProjectState(newDocument.Id.ProjectId); 1132var oldProject = GetRequiredProjectState(newDocument.Id.ProjectId); 1148ProjectState oldProjectState, 1149ProjectState newProjectState, 1190ImmutableDictionary<ProjectId, ProjectState> projectStates) 1241var projectState = this.GetProjectState(documentId.ProjectId); 1266var relatedProject = relatedProjectIdHint is null ? null : this.ProjectStates[relatedProjectIdHint]; 1292var projectState = this.GetProjectState(documentId.ProjectId); 1319var projectState = @this.GetProjectState(documentId.ProjectId);
Workspace\Solution\SolutionState_Checksum.cs (2)
121var projectState = this.ProjectStates[orderedProjectId]; 173var projectState = this.GetProjectState(projectConeId);
Workspace\Solution\StateChecksums.cs (1)
318var projectState = solution.GetProjectState(assetPath.ProjectId);
Microsoft.VisualStudio.LanguageServices (1)
Progression\GraphBuilder.cs (1)
88var projectState = _solution.GetProjectState(docIdWithPath.ProjectId);