1 type derived from DocumentState
Microsoft.CodeAnalysis.Workspaces (1)
Workspace\Solution\SourceGeneratedDocumentState.cs (1)
12internal sealed class SourceGeneratedDocumentState : DocumentState
9 instantiations of DocumentState
Microsoft.CodeAnalysis.Workspaces (9)
Workspace\Solution\DocumentState.cs (7)
81return new DocumentState( 327return new DocumentState( 374return new DocumentState( 421return new DocumentState( 432=> new DocumentState( 476return new DocumentState( 518return new DocumentState(
Workspace\Solution\DocumentState_LinkedFileReuse.cs (2)
68return new DocumentState( 124return new DocumentState(
161 references to DocumentState
IdeCoreBenchmarks (10)
NavigateToBenchmarks.cs (10)
119Console.WriteLine($"{nameof(DocumentState.TestAccessor.TryReuseSyntaxTree)} - {DocumentState.TestAccessor.TryReuseSyntaxTree}"); 120Console.WriteLine($"{nameof(DocumentState.TestAccessor.CouldReuseBecauseOfEqualPPNames)} - {DocumentState.TestAccessor.CouldReuseBecauseOfEqualPPNames}"); 121Console.WriteLine($"{nameof(DocumentState.TestAccessor.CouldReuseBecauseOfNoDirectives)} - {DocumentState.TestAccessor.CouldReuseBecauseOfNoDirectives}"); 122Console.WriteLine($"{nameof(DocumentState.TestAccessor.CouldReuseBecauseOfNoPPDirectives)} - {DocumentState.TestAccessor.CouldReuseBecauseOfNoPPDirectives}"); 123Console.WriteLine($"{nameof(DocumentState.TestAccessor.CouldNotReuse)} - {DocumentState.TestAccessor.CouldNotReuse}");
Microsoft.CodeAnalysis.EditorFeatures (3)
EditAndContinue\PdbMatchingSourceTextProvider.cs (3)
33private readonly Dictionary<string, (DocumentState state, int solutionVersion)> _documentsWithChangedLoaderByPath = []; 130DocumentState? state; 165public ImmutableDictionary<string, (DocumentState state, int solutionVersion)> GetDocumentsWithChangedLoaderByPath()
Microsoft.CodeAnalysis.Features (2)
EditAndContinue\Utilities\Extensions.cs (2)
107if (textDocumentState is DocumentState { SupportsSyntaxTree: false }) 127if (textDocumentState is DocumentState documentState)
Microsoft.CodeAnalysis.Remote.ServiceHub (1)
Host\RemoteWorkspace.SolutionCreator.cs (1)
389project = await UpdateDocumentsAsync<DocumentState>(
Microsoft.CodeAnalysis.Workspaces (145)
FindSymbols\FindReferences\DependentTypeFinder_ProjectIndex.cs (1)
84sourceGeneratorDocumentStates.States.Select(kvp => (kvp.Key, (DocumentState)kvp.Value)));
FindSymbols\Shared\AbstractSyntaxIndex.cs (6)
21private static readonly ConditionalWeakTable<DocumentState, TIndex?> s_documentToIndex = new(); 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) 44DocumentState document, 82DocumentState document, 116DocumentState document,
FindSymbols\Shared\AbstractSyntaxIndex_Persistence.cs (5)
40DocumentState document, 94DocumentState document, 136DocumentState document, 149(DocumentState)document.State, 157DocumentState document,
FindSymbols\SyntaxTree\SyntaxTreeIndex.cs (6)
39=> GetRequiredIndexAsync(SolutionKey.ToSolutionKey(document.Project.Solution), document.Project.State, (DocumentState)document.State, cancellationToken); 41public static ValueTask<SyntaxTreeIndex> GetRequiredIndexAsync(SolutionKey solutionKey, ProjectState project, DocumentState document, CancellationToken cancellationToken) 45=> GetIndexAsync(SolutionKey.ToSolutionKey(document.Project.Solution), document.Project.State, (DocumentState)document.State, cancellationToken); 47public static ValueTask<SyntaxTreeIndex?> GetIndexAsync(SolutionKey solutionKey, ProjectState project, DocumentState document, CancellationToken cancellationToken) 51=> GetIndexAsync(SolutionKey.ToSolutionKey(document.Project.Solution), document.Project.State, (DocumentState)document.State, loadOnly, cancellationToken); 53public static ValueTask<SyntaxTreeIndex?> GetIndexAsync(SolutionKey solutionKey, ProjectState project, DocumentState document, bool loadOnly, CancellationToken cancellationToken)
FindSymbols\TopLevelSyntaxTree\NavigateToSearchIndex.cs (6)
41=> GetRequiredIndexAsync(SolutionKey.ToSolutionKey(document.Project.Solution), document.Project.State, (DocumentState)document.State, cancellationToken); 43public static ValueTask<NavigateToSearchIndex> GetRequiredIndexAsync(SolutionKey solutionKey, ProjectState project, DocumentState document, CancellationToken cancellationToken) 47=> GetIndexAsync(SolutionKey.ToSolutionKey(document.Project.Solution), document.Project.State, (DocumentState)document.State, cancellationToken); 49public static ValueTask<NavigateToSearchIndex?> GetIndexAsync(SolutionKey solutionKey, ProjectState project, DocumentState document, CancellationToken cancellationToken) 53=> GetIndexAsync(SolutionKey.ToSolutionKey(document.Project.Solution), document.Project.State, (DocumentState)document.State, loadOnly, cancellationToken); 55public static ValueTask<NavigateToSearchIndex?> GetIndexAsync(SolutionKey solutionKey, ProjectState project, DocumentState document, bool loadOnly, CancellationToken cancellationToken)
FindSymbols\TopLevelSyntaxTree\TopLevelSyntaxTreeIndex.cs (6)
47=> GetRequiredIndexAsync(SolutionKey.ToSolutionKey(document.Project.Solution), document.Project.State, (DocumentState)document.State, cancellationToken); 49public static ValueTask<TopLevelSyntaxTreeIndex> GetRequiredIndexAsync(SolutionKey solutionKey, ProjectState project, DocumentState document, CancellationToken cancellationToken) 53=> GetIndexAsync(SolutionKey.ToSolutionKey(document.Project.Solution), document.Project.State, (DocumentState)document.State, cancellationToken); 55public static ValueTask<TopLevelSyntaxTreeIndex?> GetIndexAsync(SolutionKey solutionKey, ProjectState project, DocumentState document, CancellationToken cancellationToken) 59=> GetIndexAsync(SolutionKey.ToSolutionKey(document.Project.Solution), document.Project.State, (DocumentState)document.State, loadOnly, cancellationToken); 61public static ValueTask<TopLevelSyntaxTreeIndex?> GetIndexAsync(SolutionKey solutionKey, ProjectState project, DocumentState document, bool loadOnly, CancellationToken cancellationToken)
Workspace\Solution\Document.cs (3)
45internal Document(Project project, DocumentState state) 50internal DocumentState DocumentState => (DocumentState)State;
Workspace\Solution\DocumentState.cs (15)
54public static DocumentState Create( 293public bool HasContentChanged(DocumentState oldState) 300public bool HasTextChanged(DocumentState oldState) 303public DocumentState UpdateChecksumAlgorithm(SourceHashAlgorithm checksumAlgorithm) 337public DocumentState UpdateParseOptionsAndSourceCodeKind(ParseOptions options, bool onlyPreprocessorDirectiveChange) 384public DocumentState UpdateSourceCodeKind(SourceCodeKind kind) 441public new DocumentState WithAttributes(DocumentInfo.DocumentAttributes newAttributes) 442=> (DocumentState)base.WithAttributes(newAttributes); 444public new DocumentState UpdateText(SourceText newText, PreservationMode mode) 445=> (DocumentState)base.UpdateText(newText, mode); 447public new DocumentState UpdateText(TextAndVersion newTextAndVersion, PreservationMode mode) 448=> (DocumentState)base.UpdateText(newTextAndVersion, mode); 450public new DocumentState UpdateText(TextLoader loader, PreservationMode mode) 451=> (DocumentState)base.UpdateText(loader, mode); 486internal DocumentState UpdateTree(SyntaxNode newRoot, PreservationMode mode)
Workspace\Solution\DocumentState_LinkedFileReuse.cs (2)
61public DocumentState UpdateTextAndTreeContents( 100private static DocumentState UpdateTextAndTreeContentsWorker(
Workspace\Solution\Project.cs (1)
497(documentId, project) => project.State.DocumentStates.TryGetState(documentId, out var state) ? new Document(project, state) : null;
Workspace\Solution\ProjectState.cs (29)
34public readonly TextDocumentStates<DocumentState> DocumentStates; 59TextDocumentStates<DocumentState> documentStates, 105DocumentStates = new TextDocumentStates<DocumentState>(projectInfoFixed.Documents, info => CreateDocument(info, parseOptions, loadTextOptions)); 121typeof(TDocumentState) == typeof(DocumentState) ? DocumentStates : 213private static async ValueTask<VersionStamp> ComputeLatestDocumentVersionAsync(TextDocumentStates<DocumentState> documentStates, TextDocumentStates<AdditionalDocumentState> additionalDocumentStates, CancellationToken cancellationToken) 241TextDocumentStates<DocumentState> newDocumentStates, 271private static async Task<VersionStamp> ComputeLatestDocumentTopLevelChangeVersionAsync(TextDocumentStates<DocumentState> documentStates, TextDocumentStates<AdditionalDocumentState> additionalDocumentStates, CancellationToken cancellationToken) 294internal DocumentState CreateDocument(DocumentInfo documentInfo, ParseOptions? parseOptions, LoadTextOptions loadTextOptions) 296var doc = DocumentState.Create(LanguageServices, documentInfo, parseOptions, loadTextOptions); 309typeof(TDocumentState) == typeof(DocumentState) ? CreateDocument(documentInfo, ParseOptions, new LoadTextOptions(ChecksumAlgorithm)) : 379private static string? GetEffectiveFilePath(DocumentState documentState, ProjectState projectState) 422var documentId = DocumentState.GetDocumentIdForTree(tree); 424if (documentId != null && projectState.DocumentStates.TryGetState(documentId, out var documentState)) 432internal async ValueTask<StructuredAnalyzerConfigOptions> GetOptionsAsync(DocumentState documentState, CancellationToken cancellationToken) 438private StructuredAnalyzerConfigOptions GetOptions(in AnalyzerConfigOptionsCache.Value cache, DocumentState documentState) 468var documentId = DocumentState.GetDocumentIdForTree(tree); 470if (documentId != null && projectState.DocumentStates.TryGetState(documentId, out var documentState)) 478internal async ValueTask<StructuredAnalyzerConfigOptions> GetOptionsAsync(DocumentState documentState, CancellationToken cancellationToken) 484private StructuredAnalyzerConfigOptions GetOptions(in AnalyzerConfigOptionsCache.Value cache, DocumentState documentState) 570var state = DocumentState.GetDocumentIdForTree(tree); 690TextDocumentStates<DocumentState>? documentStates = null, 764private TextDocumentStates<DocumentState> UpdateDocumentsChecksumAlgorithm(SourceHashAlgorithm checksumAlgorithm) 866public ProjectState AddDocuments(ImmutableArray<DocumentState> documents) 963documentStates: TextDocumentStates<DocumentState>.Empty, 967public ProjectState UpdateDocument(DocumentState newDocument) 970public ProjectState UpdateDocuments(ImmutableArray<DocumentState> oldDocuments, ImmutableArray<DocumentState> newDocuments) 1041TextDocumentStates<DocumentState> newDocumentStates,
Workspace\Solution\Solution.cs (6)
330var documentState = CompilationState.GetDocumentState(syntaxTree, projectId); 341else if (documentState is DocumentState) 1082=> WithCompilationState(CompilationState.AddDocumentsToMultipleProjects<DocumentState>(documentInfos)); 1193=> WithCompilationState(CompilationState.RemoveDocumentsFromMultipleProjects<DocumentState>(documentIds)); 1436internal Solution WithDocumentContentsFrom(DocumentId documentId, DocumentState documentState) 1439internal Solution WithDocumentContentsFrom(ImmutableArray<(DocumentId documentId, DocumentState documentState)> documentIdsAndStates)
Workspace\Solution\SolutionCompilationState.cs (23)
37/// green <see cref="DocumentState"/>s. Contains the attributes, options and relationships between projects. 626UpdateDocuments<DocumentState>(info.Documents); 810return UpdateDocumentsInMultipleProjects<DocumentState, SourceText, PreservationMode>( 841private static bool SourceTextIsUnchanged(DocumentState oldDocument, SourceText text) 927ImmutableArray<DocumentState> ordinaryNewDocumentStates => GetUpdateOrdinaryDocumentsTranslationAction(oldProjectState, ordinaryNewDocumentStates), 933TranslationAction GetUpdateOrdinaryDocumentsTranslationAction(ProjectState oldProjectState, ImmutableArray<DocumentState> newDocumentStates) 956DocumentState documentState) 1013return UpdateDocumentsInMultipleProjects<DocumentState, SyntaxNode, PreservationMode>( 1047ImmutableArray<(DocumentId documentId, DocumentState documentState)> documentIdsAndStates, bool forceEvenIfTreesWouldDiffer) 1049return UpdateDocumentsInMultipleProjects<DocumentState, DocumentState, bool>( 1121var oldDocument = stateChange.OldProjectState.DocumentStates.GetRequiredState(documentId); 1122var newDocument = stateChange.NewProjectState.DocumentStates.GetRequiredState(documentId); 1663var currentDocumentState = this.SolutionState.GetRequiredDocumentState(documentId); 1714using var _ = ArrayBuilder<DocumentState>.GetInstance(allDocumentIds.Length, out var documentStates); 1722var documentState = @this.SolutionState.GetRequiredDocumentState(currentDocumentId); 1739ArrayBuilder<DocumentState> documentStates, 1744using var _ = PooledDictionary<ProjectId, ArrayBuilder<DocumentState>>.GetInstance(out var missingDocumentStates); 1747foreach (var newDocumentState in documentStates) 1751var oldDocumentState = oldProjectState.DocumentStates.GetState(documentId); 1855ImmutableArray<DocumentState> documentStates => new TranslationAction.RemoveDocumentsAction(oldProject, oldProject.RemoveDocuments(documentIds), documentStates), 1864ImmutableArray<DocumentState> documentStates => new TranslationAction.AddDocumentsAction(oldProject, oldProject.AddDocuments(documentStates), documentStates), 1885var documentState = this.SolutionState.GetProjectState(documentId.ProjectId)?.DocumentStates.GetState(documentId);
Workspace\Solution\SolutionCompilationState.RegularCompilationTracker.cs (3)
784using var _1 = ArrayBuilder<DocumentState>.GetInstance(out var documentsWithTreesBuilder); 786foreach (var documentState in this.ProjectState.DocumentStates.GetStatesInCompilationOrder()) 804foreach (var documentState in documentsWithTrees)
Workspace\Solution\SolutionCompilationState.SymbolToProjectId.cs (3)
16internal DocumentState? GetDocumentState(SyntaxTree? syntaxTree, ProjectId? projectId) 21var documentId = DocumentState.GetDocumentIdForTree(syntaxTree); 28var document = projectState.DocumentStates.GetState(documentId);
Workspace\Solution\SolutionCompilationState.TranslationAction_Actions.cs (14)
25ImmutableArray<DocumentState> oldStates, 26ImmutableArray<DocumentState> newStates) : TranslationAction(oldProjectState, newProjectState) 28private readonly ImmutableArray<DocumentState> _oldStates = oldStates; 29private readonly ImmutableArray<DocumentState> _newStates = newStates; 37var newState = _newStates[i]; 38var oldState = _oldStates[i]; 137ImmutableArray<DocumentState> documents) 143foreach (var document in documents) 162ImmutableArray<DocumentState> documents) 171public readonly ImmutableArray<DocumentState> Documents = documents; 178using var _ = PooledDictionary<DocumentState, int>.GetInstance(out var documentToIndex); 179foreach (var document in this.Documents) 182var documentsAndTrees = await ProducerConsumer<(DocumentState document, SyntaxTree tree)>.RunParallelAsync( 210foreach (var documentState in this.NewProjectState.DocumentStates.GetStatesInCompilationOrder())
Workspace\Solution\SolutionState.cs (12)
327internal DocumentState GetRequiredDocumentState(DocumentId documentId) 975var oldDocument = GetRequiredDocumentState(documentId); 977var newDocument = oldDocument.WithAttributes(updateAttributes(oldDocument.Attributes, arg)); 993var oldDocument = GetRequiredDocumentState(documentId); 1003public StateChange WithDocumentState(DocumentState newDocument) 1005var oldDocument = GetRequiredDocumentState(newDocument.Id); 1053var oldDocument = GetRequiredDocumentState(documentId); 1101var oldDocument = GetRequiredDocumentState(documentId); 1113var oldDocument = GetRequiredDocumentState(documentId); 1146private StateChange UpdateDocumentState(DocumentState newDocument) 1286var documentState = projectState.DocumentStates.GetState(documentId); 1341var documentState = projectState.DocumentStates.GetState(documentId);
Workspace\Workspace.cs (4)
332using var _ = ArrayBuilder<(DocumentId, DocumentState)>.GetInstance(out var relatedDocumentIdsAndStates); 376using var _ = PooledDictionary<DocumentId, DocumentState>.GetInstance(out var relatedDocumentIdsAndStates); 380DocumentState? changedDocumentState = null; 1753var document = projectChanges.OldProject.State.DocumentStates.GetState(documentId) ??