95 references to PreserveIdentity
Microsoft.CodeAnalysis.CodeStyle.Fixes (2)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\TextDocumentExtensions.cs (2)
51return textDocument.Project.Solution.WithAdditionalDocumentText(textDocument.Id, text, PreservationMode.PreserveIdentity).GetTextDocument(textDocument.Id)!; 60return textDocument.Project.Solution.WithAnalyzerConfigDocumentText(textDocument.Id, text, PreservationMode.PreserveIdentity).GetTextDocument(textDocument.Id)!;
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (1)
EditorConfigSettings\Updater\SettingsUpdaterTests.cs (1)
56var newSolution1 = solution.WithAnalyzerConfigDocumentText(documentId, text, PreservationMode.PreserveIdentity);
Microsoft.CodeAnalysis.CSharp.Features (1)
GenerateType\CSharpGenerateTypeService.cs (1)
777updatedSolution = updatedSolution.WithDocumentSyntaxRoot(document.Id, addedCompilationRoot, PreservationMode.PreserveIdentity);
Microsoft.CodeAnalysis.EditorFeatures (4)
Interactive\InteractiveWorkspace.cs (1)
58OnDocumentTextChanged(document, appliedText.AsText(), PreservationMode.PreserveIdentity);
Preview\AbstractPreviewFactoryService.cs (2)
488leftSolution = leftSolution.WithDocumentText(allLeftIds, oldBuffer.AsTextContainer().CurrentText, PreservationMode.PreserveIdentity); 495rightSolution = rightSolution.WithDocumentText(allRightIds, newBuffer.AsTextContainer().CurrentText, PreservationMode.PreserveIdentity);
Shared\Extensions\WorkspaceExtensions.cs (1)
44return solution.WithDocumentText(id, newText, PreservationMode.PreserveIdentity);
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (2)
Diagnostics\DiagnosticServiceTests.vb (2)
561solution = solution.WithDocumentTextLoader(documentId, New FailingTextLoader("Test.cs"), PreservationMode.PreserveIdentity) 899solution = solution.WithDocumentTextLoader(documentId, New FailingTextLoader("Test.cs"), PreservationMode.PreserveIdentity)
Microsoft.CodeAnalysis.Features (4)
CodeRefactorings\MoveType\AbstractMoveTypeService.MoveTypeEditor.cs (1)
144solutionWithNewDocument = solutionWithNewDocument.WithDocumentSyntaxRoot(newDocumentId, modifiedRoot, PreservationMode.PreserveIdentity);
ConvertTupleToStruct\AbstractConvertTupleToStructCodeRefactoringProvider.cs (1)
592var updatedDocument = currentSolution.WithDocumentSyntaxRoot(docId, newRoot, PreservationMode.PreserveIdentity)
GenerateType\AbstractGenerateTypeService.Editor.cs (2)
357updatedSolution = updatedSolution.WithDocumentSyntaxRoot(documentId, root, PreservationMode.PreserveIdentity); 446var updatedSolution = solution.WithDocumentSyntaxRoot(generateTypeOptionsResult.ExistingDocument.Id, newRoot, PreservationMode.PreserveIdentity);
Microsoft.CodeAnalysis.Features.Test.Utilities (1)
EditAndContinue\EditAndContinueTestVerifier.cs (1)
460newSolution = newSolution.WithDocumentSyntaxRoot(oldDocument.Id, editScripts[documentIndex].Match.NewRoot, PreservationMode.PreserveIdentity);
Microsoft.CodeAnalysis.LanguageServer (2)
HostWorkspace\LanguageServerWorkspace.cs (2)
71this.OnDocumentTextChanged(documentId, sourceText, PreservationMode.PreserveIdentity, requireDocumentPresent: false); 75this.OnAdditionalDocumentTextChanged(documentId, sourceText, PreservationMode.PreserveIdentity);
Microsoft.CodeAnalysis.LanguageServer.Protocol (1)
Workspaces\LspMiscellaneousFilesWorkspace.cs (1)
106this.OnDocumentTextChanged(documentId, sourceText, PreservationMode.PreserveIdentity, requireDocumentPresent: false);
Microsoft.CodeAnalysis.VisualBasic.Features (2)
ExtractInterface\VisualBasicExtractInterfaceService.vb (1)
88finalSolution = finalSolution.WithDocumentSyntaxRoot(docId, root, PreservationMode.PreserveIdentity)
GenerateType\VisualBasicGenerateTypeService.vb (1)
671updatedSolution = updatedSolution.WithDocumentSyntaxRoot(document.Id, addedCompilationRoot, PreservationMode.PreserveIdentity)
Microsoft.CodeAnalysis.Workspaces (20)
Rename\ConflictEngine\ConflictResolver.Session.cs (1)
847partiallyRenamedSolution = partiallyRenamedSolution.WithDocumentSyntaxRoot(documentId, newRoot, PreservationMode.PreserveIdentity);
Rename\ConflictEngine\MutableConflictResolution.cs (1)
86intermediateSolution = intermediateSolution.WithDocumentSyntaxRoot(documentId, newRoot, PreservationMode.PreserveIdentity);
Shared\Extensions\ISolutionExtensions.cs (1)
56public static Solution WithTextDocumentText(this Solution solution, DocumentId documentId, SourceText text, PreservationMode mode = PreservationMode.PreserveIdentity)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\TextDocumentExtensions.cs (2)
51return textDocument.Project.Solution.WithAdditionalDocumentText(textDocument.Id, text, PreservationMode.PreserveIdentity).GetTextDocument(textDocument.Id)!; 60return textDocument.Project.Solution.WithAnalyzerConfigDocumentText(textDocument.Id, text, PreservationMode.PreserveIdentity).GetTextDocument(textDocument.Id)!;
Workspace\Solution\Document.cs (2)
392=> this.Project.Solution.WithDocumentText(this.Id, text, PreservationMode.PreserveIdentity).GetRequiredDocument(Id); 398=> this.Project.Solution.WithDocumentSyntaxRoot(this.Id, root, PreservationMode.PreserveIdentity).GetRequiredDocument(Id);
Workspace\Solution\DocumentState.cs (1)
559if (mode != PreservationMode.PreserveIdentity)
Workspace\Solution\PreservationMode.cs (1)
28=> mode is >= PreservationMode.PreserveValue and <= PreservationMode.PreserveIdentity;
Workspace\Solution\Project.cs (1)
705return this.Solution.AddDocument(id, name, syntaxRoot, folders, filePath, preservationMode: PreservationMode.PreserveIdentity).GetDocument(id)!;
Workspace\Solution\TextDocumentState.cs (2)
139=> UpdateText(mode == PreservationMode.PreserveIdentity 170if (mode == PreservationMode.PreserveIdentity)
Workspace\TextExtensions.cs (4)
38solution = solution.WithDocumentText(relatedIds, text, PreservationMode.PreserveIdentity); 76return solution.WithDocumentText(allIds, text, PreservationMode.PreserveIdentity) 85return solution.WithAdditionalDocumentText(id, text, PreservationMode.PreserveIdentity) 94return solution.WithAnalyzerConfigDocumentText(id, text, PreservationMode.PreserveIdentity)
Workspace\Workspace.TextTracker.cs (1)
51_onChangedHandler(_workspace, _documentId, e.NewText, PreservationMode.PreserveIdentity);
Workspace\Workspace_Editor.cs (3)
403return oldSolution.WithDocumentText(documentId, newTextAndVersion, PreservationMode.PreserveIdentity); 597return data.withDocumentTextAndVersion(oldSolution, documentId, newTextAndVersion, PreservationMode.PreserveIdentity); 601return data.withDocumentText(oldSolution, documentId, newText, PreservationMode.PreserveIdentity);
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (3)
VisualStudioMSBuildWorkspaceTests.cs (3)
2058workspace.TryApplyChanges(solution.WithDocumentText(document.Id, newText, PreservationMode.PreserveIdentity)); 2242workspace.TryApplyChanges(workspace.CurrentSolution.WithDocumentText(doc.Id, SourceText.From(newText), PreservationMode.PreserveIdentity)); 2278PreservationMode.PreserveIdentity));
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (1)
Workspaces\TestWorkspace_ILspWorkspace.cs (1)
20OnDocumentTextChanged(documentId, sourceText, PreservationMode.PreserveIdentity, requireDocumentPresent: false);
Microsoft.CodeAnalysis.Workspaces.UnitTests (47)
SolutionTests\SolutionTests.cs (47)
309var newSolution1 = solution.WithDocumentSyntaxRoot(documentId, root, PreservationMode.PreserveIdentity); 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)); 364Assert.Throws<ArgumentNullException>(() => solution.WithDocumentText((DocumentId)null!, text, PreservationMode.PreserveIdentity)); 365Assert.Throws<InvalidOperationException>(() => solution.WithDocumentText(s_unrelatedDocumentId, text, PreservationMode.PreserveIdentity)); 376var newSolution1 = solution.WithDocumentText(documentId, textAndVersion, PreservationMode.PreserveIdentity); 382var newSolution2 = newSolution1.WithDocumentText(documentId, textAndVersion, PreservationMode.PreserveIdentity); 385Assert.Throws<ArgumentNullException>(() => solution.WithDocumentText(documentId, (SourceText)null!, PreservationMode.PreserveIdentity)); 388Assert.Throws<ArgumentNullException>(() => solution.WithDocumentText((DocumentId)null!, textAndVersion, PreservationMode.PreserveIdentity)); 389Assert.Throws<InvalidOperationException>(() => solution.WithDocumentText(s_unrelatedDocumentId, textAndVersion, PreservationMode.PreserveIdentity)); 922var newSolution1 = solution.WithAdditionalDocumentText(documentId, text, PreservationMode.PreserveIdentity); 926var newSolution2 = newSolution1.WithAdditionalDocumentText(documentId, text, PreservationMode.PreserveIdentity); 929Assert.Throws<ArgumentNullException>(() => solution.WithAdditionalDocumentText(documentId, (SourceText)null!, PreservationMode.PreserveIdentity)); 932Assert.Throws<ArgumentNullException>(() => solution.WithAdditionalDocumentText((DocumentId)null!, text, PreservationMode.PreserveIdentity)); 933Assert.Throws<InvalidOperationException>(() => solution.WithAdditionalDocumentText(s_unrelatedDocumentId, text, PreservationMode.PreserveIdentity)); 944var newSolution1 = solution.WithAdditionalDocumentText(documentId, textAndVersion, PreservationMode.PreserveIdentity); 950var newSolution2 = newSolution1.WithAdditionalDocumentText(documentId, textAndVersion, PreservationMode.PreserveIdentity); 953Assert.Throws<ArgumentNullException>(() => solution.WithAdditionalDocumentText(documentId, (SourceText)null!, PreservationMode.PreserveIdentity)); 956Assert.Throws<ArgumentNullException>(() => solution.WithAdditionalDocumentText((DocumentId)null!, textAndVersion, PreservationMode.PreserveIdentity)); 957Assert.Throws<InvalidOperationException>(() => solution.WithAdditionalDocumentText(s_unrelatedDocumentId, textAndVersion, PreservationMode.PreserveIdentity)); 968var newSolution1 = solution.WithAnalyzerConfigDocumentText(documentId, text, PreservationMode.PreserveIdentity); 972var newSolution2 = newSolution1.WithAnalyzerConfigDocumentText(documentId, text, PreservationMode.PreserveIdentity); 975Assert.Throws<ArgumentNullException>(() => solution.WithAnalyzerConfigDocumentText(documentId, (SourceText)null!, PreservationMode.PreserveIdentity)); 978Assert.Throws<ArgumentNullException>(() => solution.WithAnalyzerConfigDocumentText((DocumentId)null!, text, PreservationMode.PreserveIdentity)); 979Assert.Throws<InvalidOperationException>(() => solution.WithAnalyzerConfigDocumentText(s_unrelatedDocumentId, text, PreservationMode.PreserveIdentity)); 990var newSolution1 = solution.WithAnalyzerConfigDocumentText(documentId, textAndVersion, PreservationMode.PreserveIdentity); 996var newSolution2 = newSolution1.WithAnalyzerConfigDocumentText(documentId, textAndVersion, PreservationMode.PreserveIdentity); 999Assert.Throws<ArgumentNullException>(() => solution.WithAnalyzerConfigDocumentText(documentId, (SourceText)null!, PreservationMode.PreserveIdentity)); 1002Assert.Throws<ArgumentNullException>(() => solution.WithAnalyzerConfigDocumentText((DocumentId)null!, textAndVersion, PreservationMode.PreserveIdentity)); 1003Assert.Throws<InvalidOperationException>(() => solution.WithAnalyzerConfigDocumentText(s_unrelatedDocumentId, textAndVersion, PreservationMode.PreserveIdentity)); 1014var newSolution1 = solution.WithDocumentTextLoader(documentId, loader, PreservationMode.PreserveIdentity); 1018var newSolution2 = solution.WithDocumentTextLoader(documentId, loader, PreservationMode.PreserveIdentity); 1021Assert.Throws<ArgumentNullException>(() => solution.WithDocumentTextLoader(documentId, null!, PreservationMode.PreserveIdentity)); 1024Assert.Throws<ArgumentNullException>(() => solution.WithDocumentTextLoader(null!, loader, PreservationMode.PreserveIdentity)); 1025Assert.Throws<InvalidOperationException>(() => solution.WithDocumentTextLoader(s_unrelatedDocumentId, loader, PreservationMode.PreserveIdentity)); 1036var newSolution1 = solution.WithAdditionalDocumentTextLoader(documentId, loader, PreservationMode.PreserveIdentity); 1040var newSolution2 = solution.WithAdditionalDocumentTextLoader(documentId, loader, PreservationMode.PreserveIdentity); 1043Assert.Throws<ArgumentNullException>(() => solution.WithAdditionalDocumentTextLoader(documentId, null!, PreservationMode.PreserveIdentity)); 1046Assert.Throws<ArgumentNullException>(() => solution.WithAdditionalDocumentTextLoader(null!, loader, PreservationMode.PreserveIdentity)); 1047Assert.Throws<InvalidOperationException>(() => solution.WithAdditionalDocumentTextLoader(s_unrelatedDocumentId, loader, PreservationMode.PreserveIdentity)); 1058var newSolution1 = solution.WithAnalyzerConfigDocumentTextLoader(documentId, loader, PreservationMode.PreserveIdentity); 1062var newSolution2 = solution.WithAnalyzerConfigDocumentTextLoader(documentId, loader, PreservationMode.PreserveIdentity); 1065Assert.Throws<ArgumentNullException>(() => solution.WithAnalyzerConfigDocumentTextLoader(documentId, null!, PreservationMode.PreserveIdentity)); 1068Assert.Throws<ArgumentNullException>(() => solution.WithAnalyzerConfigDocumentTextLoader(null!, loader, PreservationMode.PreserveIdentity)); 1069Assert.Throws<InvalidOperationException>(() => solution.WithAnalyzerConfigDocumentTextLoader(s_unrelatedDocumentId, loader, PreservationMode.PreserveIdentity)); 5471static (sourceText, document) => document.Project.Solution.WithDocumentText(document.Id, sourceText, PreservationMode.PreserveIdentity),
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.Xaml (1)
Implementation\XamlProjectService.cs (1)
178_workspace.OnDocumentTextChanged(documentId, textContainer.CurrentText, PreservationMode.PreserveIdentity);
Roslyn.VisualStudio.Next.UnitTests (1)
Remote\RemoteHostClientServiceFactoryTests.cs (1)
52var newSolution = document.Project.Solution.WithDocumentText(document.Id, newText, PreservationMode.PreserveIdentity);