findRegions(state) {
        let lang = state.facet(language);
        if ((lang === null || lang === void 0 ? void 0 : lang.data) == this.data)
            return [{ from: 0, to: state.doc.length }];
        if (!lang || !lang.allowsNesting)
            return [];
        let result = [];
        let explore = (tree, from) => {
            if (tree.prop(languageDataProp) == this.data) {
                result.push({ from, to: from + tree.length });
                return;
            }
            let mount = tree.prop(NodeProp.mounted);
            if (mount) {
                if (mount.tree.prop(languageDataProp) == this.data) {
                    if (mount.overlay)
                        for (let r of mount.overlay)
                            result.push({ from: r.from + from, to: r.to + from });
                    else
                        result.push({ from: from, to: from + tree.length });
                    return;
                }
                else if (mount.overlay) {
                    let size = result.length;
                    explore(mount.tree, mount.overlay[0].from + from);
                    if (result.length > size)
                        return;
                }
            }
            for (let i = 0; i < tree.children.length; i++) {
                let ch = tree.children[i];
                if (ch instanceof Tree)
                    explore(ch, tree.positions[i] + from);
            }
        };
        explore(syntaxTree(state), 0);
        return result;
    }
/**
    Find the document regions that were parsed using this language.
    The returned regions will _include_ any nested languages rooted
    in this language, when those exist.
    */
Find the document regions that were parsed using this language.
The returned regions will _include_ any nested languages rooted
in this language, when those exist.
Find the document regions that were parsed using this language . The returned regions will _include_ any nested languages rooted in this language when those exist .
findRegions(state) {
        let lang = state.facet(language);
        if ((lang === null || lang === void 0 ? void 0 : lang.data) == this.data)
            return [{ from: 0, to: state.doc.length }];
        if (!lang || !lang.allowsNesting)
            return [];
        let result = [];
        let explore = (tree, from) => {
            if (tree.prop(languageDataProp) == this.data) {
                result.push({ from, to: from + tree.length });
                return;
            }
            let mount = tree.prop(NodeProp.mounted);
            if (mount) {
                if (mount.tree.prop(languageDataProp) == this.data) {
                    if (mount.overlay)
                        for (let r of mount.overlay)
                            result.push({ from: r.from + from, to: r.to + from });
                    else
                        result.push({ from: from, to: from + tree.length });
                    return;
                }
                else if (mount.overlay) {
                    let size = result.length;
                    explore(mount.tree, mount.overlay[0].from + from);
                    if (result.length > size)
                        return;
                }
            }
            for (let i = 0; i < tree.children.length; i++) {
                let ch = tree.children[i];
                if (ch instanceof Tree)
                    explore(ch, tree.positions[i] + from);
            }
        };
        explore(syntaxTree(state), 0);
        return result;
    }
findRegions ( state ) { let lang = state . facet ( language ) ; if ( ( lang === null || lang === void 0 ? void 0 : lang . data ) == this . data ) return [ { from : 0 , to : state . doc . length } ] ; if ( ! lang || ! lang . allowsNesting ) return [ ] ; let result = [ ] ; let explore = ( tree , from ) => { if ( tree . prop ( languageDataProp ) == this . data ) { result . push ( { from , to : from + tree . length } ) ; return ; } let mount = tree . prop ( NodeProp . mounted ) ; if ( mount ) { if ( mount . tree . prop ( languageDataProp ) == this . data ) { if ( mount . overlay ) for ( let r of mount . overlay ) result . push ( { from : r . from + from , to : r . to + from } ) ; else result . push ( { from : from , to : from + tree . length } ) ; return ; } else if ( mount . overlay ) { let size = result . length ; explore ( mount . tree , mount . overlay [ 0 ] . from + from ) ; if ( result . length > size ) return ; } } for ( let i = 0 ; i < tree . children . length ; i ++ ) { let ch = tree . children [ i ] ; if ( ch instanceof Tree ) explore ( ch , tree . positions [ i ] + from ) ; } } ; explore ( syntaxTree ( state ) , 0 ) ; return result ; }
Find the document regions that were parsed using this language.
Find the document regions that were parsed using this language .