}
} else {
return []; // property does not exist, nothing to do
}
const newProperty = `${JSON.stringify(lastSegment)}: ${JSON.stringify(value)}`;
const index = getInsertionIndex ? getInsertionIndex(parent.children.map(p => p.children![0].value)) : parent.children.length;
jsonEdit.ts
let edit: Edit;
if (index > 0) {
const previous = parent.children[index - 1];
edit = { offset: previous.offset + previous.length, length: 0, content: ',' + newProperty };