❌
// 获取当前编辑器中的多个光标位置
const selections = editor.selections
let count = selections.length
selections.forEach(selection => {
// 在光标位置插入连续数字
void editor.edit(editBuilder => {
editBuilder.insert(selection.active, count.toString())
})
count--
})
✅
void editor.edit(editBuilder => {
// 获取当前编辑器中的多个光标位置
const selections = editor.selections
let count = selections.length
selections.forEach(selection => {
// 在光标位置插入连续数字
editBuilder.insert(selection.active, count.toString())
count--
})
})