Improve unset unions

This commit is contained in:
Misode
2024-10-24 21:01:47 +02:00
parent e71267f1de
commit 874b9cdc33
2 changed files with 14 additions and 12 deletions

View File

@@ -86,7 +86,7 @@ export function SchemaGenerator({ gen, allowedVersions }: Props) {
return AsyncCancel
}
if (data) {
await service.writeFile(uri, JSON.stringify(data))
await service.writeFile(uri, JSON.stringify(data, null, 2))
}
// TODO: if data is undefined, set to generator's default
const docAndNode = await service.getFile(uri, () => '{}')
@@ -101,8 +101,8 @@ export function SchemaGenerator({ gen, allowedVersions }: Props) {
setCurrentPreset(undefined, true)
setSharedSnippetId(undefined, true)
}
const data = JSON.parse(doc.getText())
if (file) {
const data = JSON.parse(doc.getText())
updateFile(gen.id, file.id, { id: file.id, data })
}
ignoreChange.current = false