1 type derived from DocumentState
Microsoft.CodeAnalysis.Workspaces (1)
Workspace\Solution\SourceGeneratedDocumentState.cs (1)
12
internal sealed class SourceGeneratedDocumentState :
DocumentState
9 instantiations of DocumentState
Microsoft.CodeAnalysis.Workspaces (9)
Workspace\Solution\DocumentState.cs (7)
81
return new
DocumentState
(
327
return new
DocumentState
(
374
return new
DocumentState
(
421
return new
DocumentState
(
432
=> new
DocumentState
(
476
return new
DocumentState
(
518
return new
DocumentState
(
Workspace\Solution\DocumentState_LinkedFileReuse.cs (2)
68
return new
DocumentState
(
124
return new
DocumentState
(
157 references to DocumentState
IdeCoreBenchmarks (10)
NavigateToBenchmarks.cs (10)
119
Console.WriteLine($"{nameof(
DocumentState
.TestAccessor.TryReuseSyntaxTree)} - {
DocumentState
.TestAccessor.TryReuseSyntaxTree}");
120
Console.WriteLine($"{nameof(
DocumentState
.TestAccessor.CouldReuseBecauseOfEqualPPNames)} - {
DocumentState
.TestAccessor.CouldReuseBecauseOfEqualPPNames}");
121
Console.WriteLine($"{nameof(
DocumentState
.TestAccessor.CouldReuseBecauseOfNoDirectives)} - {
DocumentState
.TestAccessor.CouldReuseBecauseOfNoDirectives}");
122
Console.WriteLine($"{nameof(
DocumentState
.TestAccessor.CouldReuseBecauseOfNoPPDirectives)} - {
DocumentState
.TestAccessor.CouldReuseBecauseOfNoPPDirectives}");
123
Console.WriteLine($"{nameof(
DocumentState
.TestAccessor.CouldNotReuse)} - {
DocumentState
.TestAccessor.CouldNotReuse}");
Microsoft.CodeAnalysis.EditorFeatures (3)
EditAndContinue\PdbMatchingSourceTextProvider.cs (3)
33
private readonly Dictionary<string, (
DocumentState
state, int solutionVersion)> _documentsWithChangedLoaderByPath = [];
130
DocumentState
? state;
165
public ImmutableDictionary<string, (
DocumentState
state, int solutionVersion)> GetDocumentsWithChangedLoaderByPath()
Microsoft.CodeAnalysis.Features (4)
EditAndContinue\CommittedSolution.cs (1)
381
IEnumerable<(Project, IEnumerable<CodeAnalysis.
DocumentState
>)> documentsByProject,
EditAndContinue\EditAndContinueService.cs (1)
183
private static IEnumerable<(Project, IEnumerable<
DocumentState
>)> GetDocumentStatesGroupedByProject(Solution solution, ImmutableArray<DocumentId> documentIds)
EditAndContinue\Utilities\Extensions.cs (1)
112
if (textDocumentState is
DocumentState
documentState)
Workspace\CompileTimeSolutionProvider.cs (1)
170
private static bool IsRazorDesignTimeDocument(
DocumentState
documentState)
Microsoft.CodeAnalysis.Remote.ServiceHub (1)
Host\RemoteWorkspace.SolutionCreator.cs (1)
389
project = await UpdateDocumentsAsync<
DocumentState
>(
Microsoft.CodeAnalysis.Workspaces (139)
FindSymbols\FindReferences\DependentTypeFinder_ProjectIndex.cs (1)
84
sourceGeneratorDocumentStates.States.Select(kvp => (kvp.Key, (
DocumentState
)kvp.Value)));
FindSymbols\Shared\AbstractSyntaxIndex.cs (6)
21
private static readonly ConditionalWeakTable<
DocumentState
, TIndex?> s_documentToIndex = new();
30
SolutionKey solutionKey, ProjectState project,
DocumentState
document, IndexReader read, IndexCreator create, CancellationToken cancellationToken)
37
protected static ValueTask<TIndex?> GetIndexAsync(SolutionKey solutionKey, ProjectState project,
DocumentState
document, IndexReader read, IndexCreator create, CancellationToken cancellationToken)
44
DocumentState
document,
82
DocumentState
document,
116
DocumentState
document,
FindSymbols\Shared\AbstractSyntaxIndex_Persistence.cs (5)
40
DocumentState
document,
94
DocumentState
document,
136
DocumentState
document,
149
(
DocumentState
)document.State,
157
DocumentState
document,
FindSymbols\SyntaxTree\SyntaxTreeIndex.cs (6)
39
=> GetRequiredIndexAsync(SolutionKey.ToSolutionKey(document.Project.Solution), document.Project.State, (
DocumentState
)document.State, cancellationToken);
41
public 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);
47
public 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);
53
public static ValueTask<SyntaxTreeIndex?> 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);
49
public 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);
55
public 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);
61
public static ValueTask<TopLevelSyntaxTreeIndex?> GetIndexAsync(SolutionKey solutionKey, ProjectState project,
DocumentState
document, bool loadOnly, CancellationToken cancellationToken)
Workspace\Solution\Document.cs (3)
45
internal Document(Project project,
DocumentState
state)
50
internal
DocumentState
DocumentState => (
DocumentState
)State;
Workspace\Solution\DocumentState.cs (15)
54
public static
DocumentState
Create(
293
public bool HasContentChanged(
DocumentState
oldState)
300
public bool HasTextChanged(
DocumentState
oldState)
303
public
DocumentState
UpdateChecksumAlgorithm(SourceHashAlgorithm checksumAlgorithm)
337
public
DocumentState
UpdateParseOptionsAndSourceCodeKind(ParseOptions options, bool onlyPreprocessorDirectiveChange)
384
public
DocumentState
UpdateSourceCodeKind(SourceCodeKind kind)
441
public new
DocumentState
WithAttributes(DocumentInfo.DocumentAttributes newAttributes)
442
=> (
DocumentState
)base.WithAttributes(newAttributes);
444
public new
DocumentState
UpdateText(SourceText newText, PreservationMode mode)
445
=> (
DocumentState
)base.UpdateText(newText, mode);
447
public new
DocumentState
UpdateText(TextAndVersion newTextAndVersion, PreservationMode mode)
448
=> (
DocumentState
)base.UpdateText(newTextAndVersion, mode);
450
public new
DocumentState
UpdateText(TextLoader loader, PreservationMode mode)
451
=> (
DocumentState
)base.UpdateText(loader, mode);
486
internal
DocumentState
UpdateTree(SyntaxNode newRoot, PreservationMode mode)
Workspace\Solution\DocumentState_LinkedFileReuse.cs (2)
61
public
DocumentState
UpdateTextAndTreeContents(
100
private 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)
34
public readonly TextDocumentStates<
DocumentState
> DocumentStates;
59
TextDocumentStates<
DocumentState
> documentStates,
105
DocumentStates = new TextDocumentStates<
DocumentState
>(projectInfoFixed.Documents, info => CreateDocument(info, parseOptions, loadTextOptions));
121
typeof(TDocumentState) == typeof(
DocumentState
) ? DocumentStates :
213
private static async ValueTask<VersionStamp> ComputeLatestDocumentVersionAsync(TextDocumentStates<
DocumentState
> documentStates, TextDocumentStates<AdditionalDocumentState> additionalDocumentStates, CancellationToken cancellationToken)
241
TextDocumentStates<
DocumentState
> newDocumentStates,
271
private static async Task<VersionStamp> ComputeLatestDocumentTopLevelChangeVersionAsync(TextDocumentStates<
DocumentState
> documentStates, TextDocumentStates<AdditionalDocumentState> additionalDocumentStates, CancellationToken cancellationToken)
294
internal
DocumentState
CreateDocument(DocumentInfo documentInfo, ParseOptions? parseOptions, LoadTextOptions loadTextOptions)
296
var
doc =
DocumentState
.Create(LanguageServices, documentInfo, parseOptions, loadTextOptions);
309
typeof(TDocumentState) == typeof(
DocumentState
) ? CreateDocument(documentInfo, ParseOptions, new LoadTextOptions(ChecksumAlgorithm)) :
389
var documentId =
DocumentState
.GetDocumentIdForTree(tree);
391
if (documentId != null && projectState.DocumentStates.TryGetState(documentId, out
var
documentState))
399
internal async ValueTask<StructuredAnalyzerConfigOptions> GetOptionsAsync(
DocumentState
documentState, CancellationToken cancellationToken)
405
private StructuredAnalyzerConfigOptions GetOptions(in AnalyzerConfigOptionsCache.Value cache,
DocumentState
documentState)
422
private string? GetEffectiveFilePath(
DocumentState
documentState)
461
var documentId =
DocumentState
.GetDocumentIdForTree(tree);
463
if (documentId != null && projectState.DocumentStates.TryGetState(documentId, out
var
documentState))
471
internal async ValueTask<StructuredAnalyzerConfigOptions> GetOptionsAsync(
DocumentState
documentState, CancellationToken cancellationToken)
477
private StructuredAnalyzerConfigOptions GetOptions(in AnalyzerConfigOptionsCache.Value cache,
DocumentState
documentState)
501
private string? GetEffectiveFilePath(
DocumentState
documentState)
700
TextDocumentStates<
DocumentState
>? documentStates = null,
774
private TextDocumentStates<
DocumentState
> UpdateDocumentsChecksumAlgorithm(SourceHashAlgorithm checksumAlgorithm)
876
public ProjectState AddDocuments(ImmutableArray<
DocumentState
> documents)
973
documentStates: TextDocumentStates<
DocumentState
>.Empty,
977
public ProjectState UpdateDocument(
DocumentState
newDocument)
980
public ProjectState UpdateDocuments(ImmutableArray<
DocumentState
> oldDocuments, ImmutableArray<
DocumentState
> newDocuments)
1051
TextDocumentStates<
DocumentState
> newDocumentStates,
Workspace\Solution\Solution.cs (6)
331
var
documentState = CompilationState.GetDocumentState(syntaxTree, projectId);
342
else if (documentState is
DocumentState
)
1045
=> WithCompilationState(CompilationState.AddDocumentsToMultipleProjects<
DocumentState
>(documentInfos));
1156
=> WithCompilationState(CompilationState.RemoveDocumentsFromMultipleProjects<
DocumentState
>(documentIds));
1399
internal Solution WithDocumentContentsFrom(DocumentId documentId,
DocumentState
documentState)
1402
internal 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.
607
UpdateDocuments<
DocumentState
>(info.Documents);
791
return UpdateDocumentsInMultipleProjects<
DocumentState
, SourceText, PreservationMode>(
822
private static bool SourceTextIsUnchanged(
DocumentState
oldDocument, SourceText text)
908
ImmutableArray<
DocumentState
> ordinaryNewDocumentStates => GetUpdateOrdinaryDocumentsTranslationAction(oldProjectState, ordinaryNewDocumentStates),
914
TranslationAction GetUpdateOrdinaryDocumentsTranslationAction(ProjectState oldProjectState, ImmutableArray<
DocumentState
> newDocumentStates)
937
DocumentState
documentState)
994
return UpdateDocumentsInMultipleProjects<
DocumentState
, SyntaxNode, PreservationMode>(
1028
ImmutableArray<(DocumentId documentId,
DocumentState
documentState)> documentIdsAndStates, bool forceEvenIfTreesWouldDiffer)
1030
return UpdateDocumentsInMultipleProjects<
DocumentState
,
DocumentState
, bool>(
1102
var
oldDocument = stateChange.OldProjectState.DocumentStates.GetRequiredState(documentId);
1103
var
newDocument = stateChange.NewProjectState.DocumentStates.GetRequiredState(documentId);
1643
var
currentDocumentState = this.SolutionState.GetRequiredDocumentState(documentId);
1694
using var _ = ArrayBuilder<
DocumentState
>.GetInstance(allDocumentIds.Length, out var documentStates);
1702
var
documentState = @this.SolutionState.GetRequiredDocumentState(currentDocumentId);
1719
ArrayBuilder<
DocumentState
> documentStates,
1724
using var _ = PooledDictionary<ProjectId, ArrayBuilder<
DocumentState
>>.GetInstance(out var missingDocumentStates);
1727
foreach (
var
newDocumentState in documentStates)
1731
var
oldDocumentState = oldProjectState.DocumentStates.GetState(documentId);
1835
ImmutableArray<
DocumentState
> documentStates => new TranslationAction.RemoveDocumentsAction(oldProject, oldProject.RemoveDocuments(documentIds), documentStates),
1844
ImmutableArray<
DocumentState
> documentStates => new TranslationAction.AddDocumentsAction(oldProject, oldProject.AddDocuments(documentStates), documentStates),
1894
var
documentState = this.SolutionState.GetProjectState(documentId.ProjectId)?.DocumentStates.GetState(documentId);
Workspace\Solution\SolutionCompilationState.RegularCompilationTracker.cs (3)
775
using var _1 = ArrayBuilder<
DocumentState
>.GetInstance(out var documentsWithTreesBuilder);
777
foreach (
var
documentState in this.ProjectState.DocumentStates.GetStatesInCompilationOrder())
795
foreach (
var
documentState in documentsWithTrees)
Workspace\Solution\SolutionCompilationState.SymbolToProjectId.cs (3)
16
internal
DocumentState
? GetDocumentState(SyntaxTree? syntaxTree, ProjectId? projectId)
21
var documentId =
DocumentState
.GetDocumentIdForTree(syntaxTree);
28
var
document = projectState.DocumentStates.GetState(documentId);
Workspace\Solution\SolutionCompilationState.TranslationAction_Actions.cs (14)
25
ImmutableArray<
DocumentState
> oldStates,
26
ImmutableArray<
DocumentState
> newStates) : TranslationAction(oldProjectState, newProjectState)
28
private readonly ImmutableArray<
DocumentState
> _oldStates = oldStates;
29
private readonly ImmutableArray<
DocumentState
> _newStates = newStates;
37
var
newState = _newStates[i];
38
var
oldState = _oldStates[i];
137
ImmutableArray<
DocumentState
> documents)
143
foreach (
var
document in documents)
162
ImmutableArray<
DocumentState
> documents)
171
public readonly ImmutableArray<
DocumentState
> Documents = documents;
178
using var _ = PooledDictionary<
DocumentState
, int>.GetInstance(out var documentToIndex);
179
foreach (
var
document in this.Documents)
182
var documentsAndTrees = await ProducerConsumer<(
DocumentState
document, SyntaxTree tree)>.RunParallelAsync(
210
foreach (
var
documentState in this.NewProjectState.DocumentStates.GetStatesInCompilationOrder())
Workspace\Solution\SolutionState.cs (12)
312
internal
DocumentState
GetRequiredDocumentState(DocumentId documentId)
963
var
oldDocument = GetRequiredDocumentState(documentId);
965
var
newDocument = oldDocument.WithAttributes(updateAttributes(oldDocument.Attributes, arg));
981
var
oldDocument = GetRequiredDocumentState(documentId);
991
public StateChange WithDocumentState(
DocumentState
newDocument)
993
var
oldDocument = GetRequiredDocumentState(newDocument.Id);
1041
var
oldDocument = GetRequiredDocumentState(documentId);
1089
var
oldDocument = GetRequiredDocumentState(documentId);
1101
var
oldDocument = GetRequiredDocumentState(documentId);
1134
private StateChange UpdateDocumentState(
DocumentState
newDocument)
1270
var
documentState = projectState.DocumentStates.GetState(documentId);
1325
var
documentState = projectState.DocumentStates.GetState(documentId);
Workspace\Workspace.cs (4)
332
using var _ = ArrayBuilder<(DocumentId,
DocumentState
)>.GetInstance(out var relatedDocumentIdsAndStates);
376
using var _ = PooledDictionary<DocumentId,
DocumentState
>.GetInstance(out var relatedDocumentIdsAndStates);
380
DocumentState
? changedDocumentState = null;
1787
var
document = projectChanges.OldProject.State.DocumentStates.GetState(documentId) ??