Check JSON syntax using language pack

Thanks. This is proving more difficult than I thought it would be. I’ve got the tree and a cursor to iterate over it. But it’s not clear how a SyntaxNode is marked as having an error.

// cm is EditorView
const tree: Tree = syntaxTree(cm.state);
const cursor: TreeCursor = this.tree.cursor();
while (cursor.next()) {
   const sn: SyntaxNode = cursor.node;
   const nt: NodeType = sn.type;
   if (nt.isError) {
      // syntax error!
    }
}

I went with TreeCursor based on the advice in Lezer Reference Manual