Skip to content

Commit

Permalink
Allow specifying encoding of source file content
Browse files Browse the repository at this point in the history
  • Loading branch information
kzu committed Nov 23, 2024
1 parent 69e2fa7 commit d6b25d9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ Microsoft.CodeAnalysis.Testing.SourceFileCollection
Microsoft.CodeAnalysis.Testing.SourceFileCollection.Add((System.Type sourceGeneratorType, string filename, Microsoft.CodeAnalysis.Text.SourceText content) file) -> void
Microsoft.CodeAnalysis.Testing.SourceFileCollection.Add((System.Type sourceGeneratorType, string filename, string content) file) -> void
Microsoft.CodeAnalysis.Testing.SourceFileCollection.Add((string filename, string content) file) -> void
Microsoft.CodeAnalysis.Testing.SourceFileCollection.Add((string filename, string content, System.Text.Encoding encoding) file) -> void
Microsoft.CodeAnalysis.Testing.SourceFileCollection.SourceFileCollection() -> void
Microsoft.CodeAnalysis.Testing.SourceFileList
Microsoft.CodeAnalysis.Testing.SourceFileList.Add(Microsoft.CodeAnalysis.Text.SourceText content) -> void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ public void Add((string filename, string content) file)
Add((file.filename, SourceText.From(file.content)));
}

public void Add((string filename, string content, Encoding encoding) file)
{
Add((file.filename, SourceText.From(file.content, file.encoding)));
}

public void Add((Type sourceGeneratorType, string filename, string content) file)
{
var contentWithEncoding = SourceText.From(file.content, Encoding.UTF8);
Expand Down

0 comments on commit d6b25d9

Please sign in to comment.