Preserve comments between formatting

This commit is contained in:
世界
2026-04-28 08:10:05 +08:00
parent d9c9edd6f8
commit fd1624e426
4 changed files with 18 additions and 3 deletions
+2
View File
@@ -38,10 +38,12 @@ func format() error {
return err
}
for _, optionsEntry := range optionsList {
comments := optionsEntry.options.Comments()
optionsEntry.options, err = badjson.Omitempty(globalCtx, optionsEntry.options)
if err != nil {
return err
}
optionsEntry.options.SetComments(comments)
buffer := new(bytes.Buffer)
encoder := json.NewEncoder(buffer)
encoder.SetIndent("", " ")