https://learn.microsoft.com/en-us/dotnet/api/microsoft.codeanalysis.document.withfolders?view=roslyn-dotnet-3.2
Document.WithFolders(IEnumerableString) Method (Microsoft.CodeAnalysis) | Microsoft Learn
Creates a new instance of this document updated to have the specified folders.
documentmethodmicrosoftlearn