Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
for (const pending of pendings) {
const record = this.getRecordByKey(pending.keypath, pending.locale, true)
if (!record)
continue
const sectionIndex = record.meta ? (record.meta.VueSfcSectionIndex || 0) : 0
const section = this._meta.components[this.filepath][sectionIndex]
const locale = record?.meta?.VueSfcLocale || pending.locale
section.messages[locale] = await applyPendingToObject(section.messages[locale] || {}, pending)
}
const doc = await workspace.openTextDocument(this.uri)
const [file] = infuse(Global.rootpath, this.getSFCFileInfo(doc), this._meta)
if (doc.isDirty) {
const edit = new WorkspaceEdit()
edit.replace(this.uri, new Range(doc.positionAt(0), doc.positionAt(Infinity)), file.content)
await workspace.applyEdit(edit)
}
else {
await File.write(this.filepath, file.content)
}
await this.load()
}