(execCtx ExecutionContext, path, content, lineEndings string, isPartial bool)
| 1126 | func jsonMarshalCompact(v any) (string, error) { |
| 1127 | var buf bytes.Buffer |
| 1128 | encoder := json.NewEncoder(&buf) |
| 1129 | encoder.SetEscapeHTML(false) |
| 1130 | err := encoder.Encode(v) |
| 1131 | if err != nil { |
| 1132 | return "{}", err |
| 1133 | } |
| 1134 | return string(spacePythonJSONSeparators(bytes.TrimSuffix(buf.Bytes(), []byte("\n")))), nil |
| 1135 | } |
| 1136 | |
| 1137 | func spacePythonJSONSeparators(data []byte) []byte { |
| 1138 | out := make([]byte, 0, len(data)+8) |
| 1139 | inString := false |
| 1140 | escaped := false |
| 1141 | for _, b := range data { |
| 1142 | out = append(out, b) |
| 1143 | if escaped { |
| 1144 | escaped = false |
| 1145 | continue |
| 1146 | } |
no test coverage detected