deleting syntaxTree nodes -> changeSpec ?

This is a followup / more specific variant of converting ops on the syntaxTree to https://codemirror.net/docs/ref/#state.ChangeSpec ?

I have the following problem: I have a Scheme/Lisp like language. I want to ensure () and [] and {} are always balanced.

Now, making changes on the syntaxTree and mapping them to changeSpec, in the general problem, we do not have a nice solution for.

I have a more specific question: if all I need to do is to delete nodes of syntaxTree, is there a simple way to do

input: list of nodes of syntaxTree to deleted
output: list of changeSpec

The basic idea here is – in the case of unbalanced () [] or {}, instead of trying to add to make it balanced, I’m just going to delete the spurious one.

Well, sure, just dispatching {changes: nodes.map(n => ({from: n.from, to: n.to}))} should delete the content of those nodes.