Remove list items when list is toggled off (#13580)

GitOrigin-RevId: 19c63b26798fcf3c8e631090c614f0a693d4f071
This commit is contained in:
Alf Eaton
2023-07-17 10:50:02 +00:00
committed by Copybot
parent 52d9ee79a3
commit 7e20d41c4c
3 changed files with 198 additions and 25 deletions
@@ -138,16 +138,16 @@ export const lastAncestorAtEndPosition = (
export const descendantsOfNodeWithType = (
node: SyntaxNode,
type: string | number,
nested = false
leaveType?: string | number
): SyntaxNode[] => {
const children: SyntaxNode[] = []
node.cursor().iterate(nodeRef => {
if (nodeRef.type.is(type)) {
children.push(nodeRef.node)
if (!nested) {
return false
}
}
if (leaveType && nodeRef.type.is(leaveType) && nodeRef.node !== node) {
return false
}
})