2 instantiations of TextAndVersion
Microsoft.CodeAnalysis.Workspaces (2)
217 references to TextAndVersion
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (1)
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (1)
Microsoft.CodeAnalysis.EditorFeatures (3)
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (4)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (7)
EditAndContinue\EditAndContinueWorkspaceServiceTests.cs (4)
401loader: TextLoader.From(TextAndVersion.Create(sourceText, VersionStamp.Create(), path)),
409public override Task<TextAndVersion> LoadTextAndVersionAsync(LoadTextOptions options, CancellationToken cancellationToken)
756loader: TextLoader.From(TextAndVersion.Create(sourceText, VersionStamp.Create(), "design-time-only.cs")),
3718loader: TextLoader.From(TextAndVersion.Create(sourceText, VersionStamp.Create(), filePath)),
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (1)
Microsoft.CodeAnalysis.Features (3)
Microsoft.CodeAnalysis.LanguageServer.Protocol (2)
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (1)
Microsoft.CodeAnalysis.Remote.Workspaces (1)
Microsoft.CodeAnalysis.Workspaces (121)
Workspace\Solution\RecoverableTextAndVersion.cs (8)
58public bool TryGetValue(LoadTextOptions options, [MaybeNullWhen(false)] out TextAndVersion value)
67value = TextAndVersion.Create(text, recoverableText.Version, recoverableText.LoadDiagnostic);
82if (TryGetValue(options, out var textAndVersion))
92public TextAndVersion GetValue(LoadTextOptions options, CancellationToken cancellationToken)
117public async Task<TextAndVersion> GetValueAsync(LoadTextOptions options, CancellationToken cancellationToken)
152public RecoverableText(ITextAndVersionSource source, TextAndVersion textAndVersion, LoadTextOptions options, SolutionServices services)
170public TextAndVersion ToTextAndVersion(SourceText text)
171=> TextAndVersion.Create(text, Version, LoadDiagnostic);
Workspace\Solution\Solution.cs (5)
1057loader: TextLoader.From(TextAndVersion.Create(text, VersionStamp.Create(), name)),
1187var loader = TextLoader.From(TextAndVersion.Create(text, version, name));
1451public Solution WithDocumentText(DocumentId documentId, TextAndVersion textAndVersion, PreservationMode mode = PreservationMode.PreserveValue)
1478public Solution WithAdditionalDocumentText(DocumentId documentId, TextAndVersion textAndVersion, PreservationMode mode = PreservationMode.PreserveValue)
1505public Solution WithAnalyzerConfigDocumentText(DocumentId documentId, TextAndVersion textAndVersion, PreservationMode mode = PreservationMode.PreserveValue)
Workspace\Solution\TextDocumentState.cs (18)
64: CreateStrongText(TextAndVersion.Create(SourceText.From(string.Empty, encoding: null, loadTextOptions.ChecksumAlgorithm), VersionStamp.Default, info.FilePath)),
74private static ITextAndVersionSource CreateStrongText(TextAndVersion text)
80private static ITextAndVersionSource CreateRecoverableText(TextAndVersion text, LoadTextOptions loadTextOptions, SolutionServices services)
103if (this.TextAndVersionSource.TryGetValue(LoadTextOptions, out var textAndVersion))
123if (this.TextAndVersionSource.TryGetValue(LoadTextOptions, out var textAndVersion))
135public bool TryGetTextAndVersion([NotNullWhen(true)] out TextAndVersion? textAndVersion)
154var textAndVersion = this.TextAndVersionSource.GetValue(LoadTextOptions, cancellationToken);
160var textAndVersion = this.TextAndVersionSource.GetValue(LoadTextOptions, cancellationToken);
172var textAndVersion = await GetTextAndVersionAsync(cancellationToken).ConfigureAwait(false);
176public TextDocumentState UpdateText(TextAndVersion newTextAndVersion, PreservationMode mode)
188var newTextAndVersion = TextAndVersion.Create(newText, newVersion, FilePath);
213private ValueTask<TextAndVersion> GetTextAndVersionAsync(CancellationToken cancellationToken)
215if (this.TextAndVersionSource.TryGetValue(LoadTextOptions, out var textAndVersion))
217return new ValueTask<TextAndVersion>(textAndVersion);
221return new ValueTask<TextAndVersion>(TextAndVersionSource.GetValueAsync(LoadTextOptions, cancellationToken));
230if (this.TextAndVersionSource.TryGetValue(LoadTextOptions, out var textAndVersion))
240var textAndVersion = await this.TextAndVersionSource.GetValueAsync(LoadTextOptions, cancellationToken).ConfigureAwait(false);
Workspace\Solution\TextLoader.cs (16)
53public virtual Task<TextAndVersion> LoadTextAndVersionAsync(LoadTextOptions options, CancellationToken cancellationToken)
58_ => new StrongBox<bool>(new Func<Workspace, DocumentId, CancellationToken, Task<TextAndVersion>>(LoadTextAndVersionAsync).Method.DeclaringType != typeof(TextLoader))).Value)
76public virtual Task<TextAndVersion> LoadTextAndVersionAsync(Workspace? workspace, DocumentId? documentId, CancellationToken cancellationToken)
85internal virtual TextAndVersion LoadTextAndVersionSynchronously(LoadTextOptions options, CancellationToken cancellationToken)
91internal async Task<TextAndVersion> LoadTextAsync(LoadTextOptions options, CancellationToken cancellationToken)
120internal TextAndVersion LoadTextSynchronously(LoadTextOptions options, CancellationToken cancellationToken)
151private TextAndVersion CreateFailedText(string message)
169return TextAndVersion.Create(
178public static TextLoader From(TextAndVersion textAndVersion)
206private readonly TextAndVersion _textAndVersion;
208internal TextDocumentLoader(TextAndVersion textAndVersion)
211public override Task<TextAndVersion> LoadTextAndVersionAsync(LoadTextOptions options, CancellationToken cancellationToken)
214internal override TextAndVersion LoadTextAndVersionSynchronously(LoadTextOptions options, CancellationToken cancellationToken)
234public override Task<TextAndVersion> LoadTextAndVersionAsync(LoadTextOptions options, CancellationToken cancellationToken)
237internal override TextAndVersion LoadTextAndVersionSynchronously(LoadTextOptions options, CancellationToken cancellationToken)
238=> TextAndVersion.Create(_container.CurrentText, _version, _filePath);
Workspace\Workspace_Editor.cs (7)
377var newTextAndVersion = GetProperTextAndVersion(oldText, newText, version, oldDocumentState.FilePath);
462private static TextAndVersion GetProperTextAndVersion(SourceText oldText, SourceText newText, VersionStamp version, string? filePath)
467? TextAndVersion.Create(newText, version, filePath)
468: TextAndVersion.Create(newText, version.GetNewerVersion(), filePath);
524Func<Solution, DocumentId, TextAndVersion, PreservationMode, Solution> withDocumentTextAndVersion,
547var newTextAndVersion = TextAndVersion.Create(newText, version, oldDocument.FilePath);
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (2)
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (3)
Microsoft.CodeAnalysis.Workspaces.UnitTests (58)
SolutionTests\SolutionTests.cs (26)
350var textAndVersion = TextAndVersion.Create(SourceText.From("new text"), VersionStamp.Default);
428var textAndVersion = TextAndVersion.Create(text, VersionStamp.Create());
472private static Solution UpdateSolution(PreservationMode mode, TextUpdateType updateType, Solution solution, DocumentId documentId1, SourceText text, TextAndVersion textAndVersion)
516var textAndVersion = TextAndVersion.Create(text, VersionStamp.Create());
599var textAndVersion = TextAndVersion.Create(text, VersionStamp.Create());
682var textAndVersion = TextAndVersion.Create(text, VersionStamp.Create());
758var textAndVersion = TextAndVersion.Create(text, VersionStamp.Create());
830var textAndVersion = TextAndVersion.Create(SourceText.From("new text"), VersionStamp.Default);
876var textAndVersion = TextAndVersion.Create(SourceText.From("new text"), VersionStamp.Default);
3763var unused = await loader.LoadTextAndVersionAsync(new LoadTextOptions(SourceHashAlgorithms.Default), CancellationToken.None);
3777var unused = loader.LoadTextAndVersionSynchronously(new LoadTextOptions(SourceHashAlgorithms.Default), CancellationToken.None);
3935loader: TextLoader.From(TextAndVersion.Create(SourceText.From("[*.*]\r\n\r\ndotnet_diagnostic.CA1234.severity = error"), VersionStamp.Default)))));
3969loader: TextLoader.From(TextAndVersion.Create(SourceText.From("[*.*]\r\n\r\ndotnet_diagnostic.CA1234.severity = error"), VersionStamp.Default)))));
4011loader: TextLoader.From(TextAndVersion.Create(SourceText.From("[*.*]\r\n\r\ndotnet_diagnostic.CA1234.severity = error"), VersionStamp.Default)))));
4023TextLoader.From(TextAndVersion.Create(SourceText.From("[*.*]\r\n\r\ndotnet_diagnostic.CA6789.severity = error"), VersionStamp.Default)),
4059loader: TextLoader.From(TextAndVersion.Create(SourceText.From("is_global = true\r\n\r\ndotnet_diagnostic.CA1234.severity = error"), VersionStamp.Default)))));
4105loader: TextLoader.From(TextAndVersion.Create(SourceText.From("[*.*]\r\n\r\ngenerated_code = true"), VersionStamp.Default)))));
4294var docInfo = DocumentInfo.Create(DocumentId.CreateNewId(pid), "c.cs", loader: TextLoader.From(TextAndVersion.Create(text, version)));
SolutionTests\TextLoaderTests.cs (26)
22public new virtual Task<TextAndVersion> LoadTextAndVersionAsync(Workspace? workspace, DocumentId? documentId, CancellationToken cancellationToken)
23=> Task.FromResult((TextAndVersion?)null!);
29public new virtual Task<TextAndVersion> LoadTextAndVersionAsync(Workspace? workspace, DocumentId? documentId, CancellationToken cancellationToken)
30=> Task.FromResult((TextAndVersion?)null!);
33public virtual Task<TextAndVersion> LoadTextAndVersionAsync(Workspace? workspace, DocumentId? documentId)
34=> Task.FromResult((TextAndVersion?)null!);
37public virtual Task<TextAndVersion> LoadTextAndVersionAsync(Workspace? workspace, ref DocumentId? documentId, CancellationToken cancellationToken)
38=> Task.FromResult((TextAndVersion?)null!);
41public virtual Task<TextAndVersion> LoadTextAndVersionAsync<T>(Workspace? workspace, DocumentId? documentId, CancellationToken cancellationToken)
42=> Task.FromResult((TextAndVersion?)null!);
47public override Task<TextAndVersion> LoadTextAndVersionAsync(Workspace? workspace, DocumentId? documentId, CancellationToken cancellationToken)
48=> Task.FromResult((TextAndVersion?)null!);
53public override Task<TextAndVersion> LoadTextAndVersionAsync(Workspace? workspace, DocumentId? documentId)
59public override Task<TextAndVersion> LoadTextAndVersionAsync(Workspace? workspace, ref DocumentId? documentId, CancellationToken cancellationToken)
60=> Task.FromResult((TextAndVersion?)null!);
65public override Task<TextAndVersion> LoadTextAndVersionAsync<T>(Workspace? workspace, DocumentId? documentId, CancellationToken cancellationToken)
66=> Task.FromResult((TextAndVersion?)null!);
82public static readonly TextAndVersion Value = TextAndVersion.Create(SourceText.From(""), VersionStamp.Default);
85public override Task<TextAndVersion> LoadTextAndVersionAsync(Workspace? workspace, DocumentId? documentId, CancellationToken cancellationToken)
91public static new readonly TextAndVersion Value = TextAndVersion.Create(SourceText.From(""), VersionStamp.Default);
94public override Task<TextAndVersion> LoadTextAndVersionAsync(Workspace? workspace, DocumentId? documentId, CancellationToken cancellationToken)
100public static readonly TextAndVersion Value = TextAndVersion.Create(SourceText.From(""), VersionStamp.Default);
102public override Task<TextAndVersion> LoadTextAndVersionAsync(LoadTextOptions options, CancellationToken cancellationToken)
WorkspaceTests\AdhocWorkspaceTests.cs (5)
158loader: TextLoader.From(TextAndVersion.Create(SourceText.From(""), VersionStamp.Create())));
218var docInfo = DocumentInfo.Create(DocumentId.CreateNewId(pid), "c.cs", loader: TextLoader.From(TextAndVersion.Create(text, version)));
252var docInfo = DocumentInfo.Create(DocumentId.CreateNewId(pid), "c.cs", loader: TextLoader.From(TextAndVersion.Create(text, version)));
290loader: TextLoader.From(TextAndVersion.Create(text, version, analyzerConfigDocFilePath)),
346var docInfo = DocumentInfo.Create(DocumentId.CreateNewId(pid), "c.cs", loader: TextLoader.From(TextAndVersion.Create(text, version)));
Microsoft.VisualStudio.LanguageServices (3)
Microsoft.VisualStudio.LanguageServices.LiveShare (2)
Roslyn.VisualStudio.Next.UnitTests (4)