77 references to WithDocumentText
IdeCoreBenchmarks (1)
ProjectOperationBenchmarks.cs (1)
111var _ = solution.WithDocumentText(documentId, s_newText);
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (8)
CodeActions\ApplyChangesOperationTests.cs (7)
80return solution.WithDocumentText(document1.Id, SourceText.From("NewProgram1Content")); 85return solution.WithDocumentText(document2.Id, SourceText.From("NewProgram2Content")); 112return solution.WithDocumentText(document1.Id, SourceText.From("NewProgram1Content")); 144return solution.WithDocumentText(document1.Id, SourceText.From("NewProgram1Content1")); 149return solution.WithDocumentText(document1.Id, SourceText.From("NewProgram1Content2")); 175return solution.WithDocumentText(document1.Id, SourceText.From("NewProgram1Content1")); 212return solution.WithDocumentText(document2.Id, SourceText.From("NewProgram1Content2"));
Workspaces\WorkspaceTests_EditorFeatures.cs (1)
733var newSolution = oldSolution.WithDocumentText(document.Id, SourceText.From(newText));
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (7)
EditAndContinue\CSharpEditAndContinueAnalyzerTests.cs (7)
307var newSolution = oldSolution.WithDocumentText(documentId, SourceText.From(source2)); 372var newSolution = oldSolution.WithDocumentText(documentId, SourceText.From(source2)); 434var newSolution = oldSolution.WithDocumentText(documentId, SourceText.From(source2)); 516var newSolution = workspace.CurrentSolution.WithDocumentText(documentId, SourceText.From(source2)); 585var newSolution = oldSolution.WithDocumentText(documentId, SourceText.From(source2)); 624var newSolution = oldSolution.WithDocumentText(documentId, SourceText.From(source2)); 799var newSolution = oldSolution.WithDocumentText(documentId, SourceText.From(source2));
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (1)
LanguageServer\AbstractLanguageServerProtocolTests.cs (1)
341solution = solution.WithDocumentText(document.Id, SourceText.From(documentText.ToString(), System.Text.Encoding.UTF8, SourceHashAlgorithms.Default));
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (2)
LinkedFiles\LinkedFileDiffMergingEditorTests.cs (2)
108.WithDocumentText(document.Id, (await document.GetTextAsync()).Replace(textString.IndexOf("public"), "public".Length, "internal")) 109.WithDocumentText(linkedDocument.Id, sourceText.Replace(textString.LastIndexOf("public"), "public".Length, "private"));
Microsoft.CodeAnalysis.Features (2)
AddImport\CodeActions\InstallPackageAndAddImportCodeAction.cs (2)
113var newSolution = workspace.CurrentSolution.WithDocumentText( 125var rolledBackSolution = workspace.CurrentSolution.WithDocumentText(
Microsoft.CodeAnalysis.Features.UnitTests (20)
EditAndContinue\EditAndContinueWorkspaceServiceTests.cs (13)
249solution = solution.WithDocumentText(document1.Id, CreateText("dummy2")); 288solution = solution.WithDocumentText(document1.Id, CreateText(sourceV2)); 319solution = solution.WithDocumentText(documentInfo.Id, CreateText("class UpdatedC2 {}")); 361solution = solution.WithDocumentText(document1.Id, CreateText("class E {}")); 441solution = solution.WithDocumentText(designTimeOnlyDocumentId, CreateText(sourceDesignTimeOnly2)); 588solution = solution.WithDocumentText(document1.Id, CreateText("class C1 { void M() { System.Console.WriteLine(2); } }")); 825solution = solution.WithDocumentText(document1.Id, CreateText(source2)); 875solution = solution.WithDocumentText(document1.Id, CreateText(source2)); 975solution = solution.WithDocumentText(document1.Id, CreateText(source2)); 1112solution = solution.WithDocumentText(document1.Id, CreateText(sourceV2)); 1347solution = solution.WithDocumentText(document1.Id, CreateText("class C1 { void M() { ")); 1387solution = solution.WithDocumentText(document1.Id, CreateText("class C1 { void M() { int i = 0L; System.Console.WriteLine(i); } }")); 1447solution = solution.WithDocumentText(documentC.Id, CreateText("class C { void M() { "));
EditAndContinue\UnitTestingHotReloadServiceTests.cs (3)
63solution = solution.WithDocumentText(documentIdA, CreateText(source2)); 69solution = solution.WithDocumentText(documentIdA, CreateText(source3)); 80solution = solution.WithDocumentText(documentIdA, CreateText(source4));
EditAndContinue\WatchHotReloadServiceTests.cs (4)
75solution = solution.WithDocumentText(documentIdA, CreateText(source2)); 83solution = solution.WithDocumentText(documentIdA, CreateText(source3)); 94solution = solution.WithDocumentText(documentIdA, CreateText(source4)); 105solution = solution.WithDocumentText(documentIdA, CreateText(source5));
Microsoft.CodeAnalysis.Workspaces (4)
Shared\Extensions\ISolutionExtensions.cs (1)
62return solution.WithDocumentText(documentId, text, mode);
Workspace\Solution\Document.cs (1)
392=> this.Project.Solution.WithDocumentText(this.Id, text, PreservationMode.PreserveIdentity).GetRequiredDocument(Id);
Workspace\Workspace.cs (1)
1109(solution, docId, newTextAndMode) => solution.WithDocumentText(docId, newTextAndMode.newText, newTextAndMode.mode),
Workspace\Workspace_Editor.cs (1)
409return oldSolution.WithDocumentText(documentId, newText, PreservationMode.PreserveValue);
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (5)
VisualStudioMSBuildWorkspaceTests.cs (5)
398var solution1 = solution.WithDocumentText(document.Id, SourceText.From("using test;")); 2058workspace.TryApplyChanges(solution.WithDocumentText(document.Id, newText, PreservationMode.PreserveIdentity)); 2118var newSolution = solution.WithDocumentText(document.Id, newText); 2242workspace.TryApplyChanges(workspace.CurrentSolution.WithDocumentText(doc.Id, SourceText.From(newText), PreservationMode.PreserveIdentity)); 2275.WithDocumentText(
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (2)
WorkspaceExtensions.cs (1)
34var newSolution = oldSolution.WithDocumentText(documentId, newText);
Workspaces\TestWorkspace`1.cs (1)
542return ChangeDocumentAsync(documentId, this.CurrentSolution.WithDocumentText(documentId, text));
Microsoft.CodeAnalysis.Workspaces.UnitTests (19)
LinkedFileDiffMerging\LinkedFileDiffMergingTests.cs (1)
46.WithDocumentText(documentIds[i], SourceText.From(text));
SolutionTests\SolutionTests.cs (17)
352var newSolution1 = solution.WithDocumentText(documentId, text, PreservationMode.PreserveIdentity); 358var newSolution2 = newSolution1.WithDocumentText(documentId, text, PreservationMode.PreserveIdentity); 361Assert.Throws<ArgumentNullException>(() => solution.WithDocumentText(documentId, (SourceText)null!, PreservationMode.PreserveIdentity)); 362Assert.Throws<ArgumentOutOfRangeException>(() => solution.WithDocumentText(documentId, text, (PreservationMode)(-1))); 364Assert.Throws<ArgumentNullException>(() => solution.WithDocumentText((DocumentId)null!, text, PreservationMode.PreserveIdentity)); 365Assert.Throws<InvalidOperationException>(() => solution.WithDocumentText(s_unrelatedDocumentId, text, PreservationMode.PreserveIdentity)); 385Assert.Throws<ArgumentNullException>(() => solution.WithDocumentText(documentId, (SourceText)null!, PreservationMode.PreserveIdentity)); 500TextUpdateType.SourceText => solution.WithDocumentText(documentId1, text, mode), 3978var solution2 = solution.WithDocumentText(did3, SourceText.From(text4)); 4133var solution = project.Solution.WithDocumentText(documentToFreezeOriginal.Id, SourceText.From("class DocumentToFreeze { void M() { /*no top level change*/ } }")); 4178var solution = project.Solution.WithDocumentText(documentToFreezeOriginal.Id, SourceText.From("class DocumentToFreeze { void M() { } public void NewMethod() { } }")); 4366.WithDocumentText(documentId1, SourceText.From("// Document 1 Changed")) 4367.WithDocumentText(documentId2, SourceText.From("// Document 2 Changed")) 4368.WithDocumentText(documentId3, SourceText.From("// Document 3 Changed")); 5471static (sourceText, document) => document.Project.Solution.WithDocumentText(document.Id, sourceText, PreservationMode.PreserveIdentity), 5715var forkedProject1 = frozenSolution.WithDocumentText(project1.Documents.Single().Id, SourceText.From("class Doc2 { }")).GetProject(project1.Id); 5827old => old.WithDocumentText(documentId1, SourceText.From(lastContents)),
SolutionTests\SolutionWithSourceGeneratorTests.cs (1)
263project = project.Solution.WithDocumentText(documentId, SourceText.From("// Changed Source File")).Projects.Single();
Microsoft.VisualStudio.LanguageServices (2)
DebuggerIntelliSense\AbstractDebuggerIntelliSenseContext.cs (2)
172var forkedSolution = solution.WithDocumentText(document.Id, _projectionBuffer.CurrentSnapshot.AsText(), PreservationMode.PreserveIdentity); 175forkedSolution = forkedSolution.WithDocumentText(link, _projectionBuffer.CurrentSnapshot.AsText(), PreservationMode.PreserveIdentity);
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (1)
DocumentOutline\DocumentOutlineTestsBase.cs (1)
109solution = solution.WithDocumentText(document.Id, SourceText.From(documentText.ToString(), System.Text.Encoding.UTF8));
Microsoft.VisualStudio.LanguageServices.Test.Utilities2 (1)
CodeModel\Mocks\MockVisualStudioWorkspace.vb (1)
50Assert.True(_workspace.TryApplyChanges(_workspace.CurrentSolution.WithDocumentText(documentId, newText)))
Roslyn.VisualStudio.Next.UnitTests (2)
Services\ServiceHubServicesTests.cs (1)
451Assert.True(localWorkspace.SetCurrentSolution(s => s.WithDocumentText(tempDocId, SourceText.From("// " + i)), WorkspaceChangeKind.SolutionChanged));
Services\SolutionServiceTests.cs (1)
410return s.WithDocumentText(documentId, SourceText.From("class Changed { }"));