Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
nahk-ivanov committed Oct 24, 2024
1 parent 6c26d5c commit 7333635
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
32 changes: 16 additions & 16 deletions YamlDotNet/Core/EmitterSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public EmitterSettings()
{
}

public EmitterSettings(int bestIndent, int bestWidth, bool isCanonical, int maxSimpleKeyLength, bool skipAnchorName = false, bool indentSequences = false, bool useUtf16SurrogatePairs = false, string? newLine = null)
public EmitterSettings(int bestIndent, int bestWidth, bool isCanonical, int maxSimpleKeyLength, bool skipAnchorName = false, bool indentSequences = false, string? newLine = null, bool useUtf16SurrogatePairs = false)
{
if (bestIndent < 2 || bestIndent > 9)
{
Expand All @@ -101,8 +101,8 @@ public EmitterSettings(int bestIndent, int bestWidth, bool isCanonical, int maxS
MaxSimpleKeyLength = maxSimpleKeyLength;
SkipAnchorName = skipAnchorName;
IndentSequences = indentSequences;
UseUtf16SurrogatePairs = useUtf16SurrogatePairs;
NewLine = newLine ?? Environment.NewLine;
UseUtf16SurrogatePairs = useUtf16SurrogatePairs;
}

public EmitterSettings WithBestIndent(int bestIndent)
Expand All @@ -114,8 +114,8 @@ public EmitterSettings WithBestIndent(int bestIndent)
MaxSimpleKeyLength,
SkipAnchorName,
IndentSequences,
UseUtf16SurrogatePairs,
NewLine
NewLine,
UseUtf16SurrogatePairs
);
}

Expand All @@ -128,8 +128,8 @@ public EmitterSettings WithBestWidth(int bestWidth)
MaxSimpleKeyLength,
SkipAnchorName,
IndentSequences,
UseUtf16SurrogatePairs,
NewLine
NewLine,
UseUtf16SurrogatePairs
);
}

Expand All @@ -142,8 +142,8 @@ public EmitterSettings WithMaxSimpleKeyLength(int maxSimpleKeyLength)
maxSimpleKeyLength,
SkipAnchorName,
IndentSequences,
UseUtf16SurrogatePairs,
NewLine
NewLine,
UseUtf16SurrogatePairs
);
}

Expand All @@ -156,8 +156,8 @@ public EmitterSettings WithNewLine(string newLine)
MaxSimpleKeyLength,
SkipAnchorName,
IndentSequences,
UseUtf16SurrogatePairs,
newLine
newLine,
UseUtf16SurrogatePairs
);
}

Expand All @@ -181,8 +181,8 @@ public EmitterSettings WithoutAnchorName()
MaxSimpleKeyLength,
true,
IndentSequences,
UseUtf16SurrogatePairs,
NewLine
NewLine,
UseUtf16SurrogatePairs
);
}

Expand All @@ -195,8 +195,8 @@ public EmitterSettings WithIndentedSequences()
MaxSimpleKeyLength,
SkipAnchorName,
true,
UseUtf16SurrogatePairs,
NewLine
NewLine,
UseUtf16SurrogatePairs
);
}

Expand All @@ -209,8 +209,8 @@ public EmitterSettings WithUtf16SurrogatePairs()
MaxSimpleKeyLength,
SkipAnchorName,
IndentSequences,
true,
NewLine
NewLine,
true
);
}
}
Expand Down
3 changes: 2 additions & 1 deletion YamlDotNet/Serialization/StaticSerializerBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,8 @@ public StaticSerializerBuilder JsonCompatible()
{
this.emitterSettings = this.emitterSettings
.WithMaxSimpleKeyLength(int.MaxValue)
.WithoutAnchorName();
.WithoutAnchorName()
.WithUtf16SurrogatePairs();

return this
.WithTypeConverter(new GuidConverter(true), w => w.InsteadOf<GuidConverter>())
Expand Down

0 comments on commit 7333635

Please sign in to comment.