-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Preserve encoding during DocumentState updates (#77354)
Fixes dotnet/sdk#46780 This issue was introduced by #74623, which changed `Document.WithSyntaxRoot` to always use the encoding specified by the new syntax root. APIs like SyntaxRewriter do not preserve the input encoding during node rewrites, so `Formatter.Format` would overwrite the document syntax root with a node that did not specify any encoding. The fix _allows_ `WithSyntaxRoot` to specify a new encoding, but for cases where the encoding of the new syntax root is not known, we fall back to the original behavior of preserving the encoding from the previous root and/or document text.
- Loading branch information
Showing
2 changed files
with
19 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters